
MATLAB Simulink 的 MCP 服务器——让大型语言模型控制并理解 Simulink。
概览
14个结构化MCP工具,用于加载模型、检查块、调整参数、运行仿真以及以图像形式捕获图形。每个操作都是带有验证输入的类型化工具调用——无任意代码执行。 通用的MATLAB服务器会将任意代码字符串传递给eval()。这在AI产生函数名幻觉、忘记分号或写入永久阻塞的plot()调用之前是正常的。该服务器将Simulink操作作为离散且经过验证的工具——AI选择合适的工具,填写输入参数,而非生成自由文本的MATLAB代码。 MATLAB 引擎随所有 MATLAB 安装一同附带: 通常是:- /Applications/MATLAB_R2024b.app - /usr/local/MATLAB/R2024b - C:\Program Files\MATLAB\R2024b 然后让Claude加载模型,它会接手。 - — MATLAB 在第一次工具调用时启动,而非服务器启动。MCP 握手完成时间为 ~0.5 秒;MATLAB 在后台启动(约 15-20 秒)。
概述(AI 翻译)
让AI助手直接访问MATLAB Simulink。
14个结构化MCP工具,用于加载模型、检查块、调整参数、运行仿真以及以图像形式捕获图形。每个操作都是带有验证输入的类型化工具调用——无任意代码执行。
为什么选择这部通用的MATLAB MCP服务器?
通用的MATLAB服务器会将任意代码字符串传递给eval()。这在AI产生函数名幻觉、忘记分号或写入永久阻塞的plot()调用之前是正常的。该服务器将Simulink操作作为离散且经过验证的工具——AI选择正确的工具,填写输入参数,而不是生成自由文本的MATLAB代码。
安装
1.Python 版 MATLAB 引擎
MATLAB 引擎随所有 MATLAB 安装一同附带:
通常为:
- macOS:
/Applications/MATLAB_R2024b.app - Linux:
/usr/local/MATLAB/R2024b - Windows:
C:\Program Files\MATLAB\R2024b
2.Simulink-MCP
或者引用来源:
3.验证
配置
克劳德·科德
克劳德桌面
在你的claude_desktop_config.json中添加:
然后让Claude加载模型,它会接手。
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
14 structured MCP tools for loading models, inspecting blocks, tweaking parameters, running simulations, and capturing figures as images. Every operation is a typed tool call with validated inputs — no arbitrary code execution.
Why this over a general MATLAB MCP server?
General-purpose MATLAB servers pass arbitrary code strings to eval(). That works until the AI hallucinates a function name, forgets a semicolon, or writes a plot() call that blocks forever. This server exposes Simulink operations as discrete, validated tools — the AI picks the right tool and fills in typed parameters instead of generating free-text MATLAB code.
Install
1. MATLAB Engine for Python
The MATLAB Engine ships with every MATLAB installation:
cd /extern/engines/python
pip install .
`` is typically:
- macOS:
/Applications/MATLAB_R2024b.app - Linux:
/usr/local/MATLAB/R2024b - Windows:
C:\Program Files\MATLAB\R2024b
2. simulink-mcp
pip install simulink-mcp
Or from source:
git clone https://github.com/sohumsuthar/simulink-mcp.git
cd simulink-mcp
pip install .
3. Verify
python -c "import matlab.engine; print('OK')"
Configuration
Claude Code
claude mcp add simulink -- python -m simulink_mcp
Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"simulink": {
"command": "python",
"args": ["-m", "simulink_mcp"],
"env": {
"SIMULINK_MCP_WORKDIR": "/path/to/your/models"
}
}
}
}
Then ask Claude to load a model and it’ll take it from there.
Environment Variables
| Variable | Default | Description |
|---|---|---|
SIMULINK_MCP_WORKDIR |
~ |
MATLAB working directory on startup |
Tools
| Tool | What it does |
|---|---|
load_model |
Load a .slx model and list top-level blocks |
close_model |
Close a model (with optional save) |
create_model |
Create a new blank Simulink model |
save_model |
Save a model to disk |
list_blocks |
List blocks with configurable depth and type filtering |
get_block_params |
Read all dialog parameters of any block |
get_model_config |
Read solver, timing, and logging configuration |
set_block_param |
Set any block parameter via set_param() |
set_model_config |
Set model-level config (solver, stop time, etc.) |
安装
This server does not publish a one-line install command.
Open the repository installation guide 新手?先看 mcpskill.org 教程 →配置
{
"mcpServers": {
"simulink": {
"command": "python",
"args": ["-m", "simulink_mcp"],
"env": {
"SIMULINK_MCP_WORKDIR": "/path/to/your/models"
}
}
}
}