[AI Readability Summary]
This practical Windows-based guide shows how to connect Cursor to Simulink through the Model Context Protocol (MCP), so AI can directly load models, edit parameters, build block diagrams, and run simulations. It focuses on the three failure points that break most setups: MATLAB Engine and Python version conflicts, proxy-related installation failures, and mismatched Python interpreters. Keywords: Simulink MCP, Cursor, MATLAB Engine.
The technical specification snapshot clarifies the deployment baseline
| Parameter |
Details |
| Project |
simulink-mcp |
| Core capability |
Exposes about 14 structured Simulink tools to AI through MCP |
| Runtime environment |
Windows + MATLAB/Simulink + Python |
| Protocol |
Model Context Protocol (MCP) |
| Python requirement |
Usually Python 3.10 or 3.11 |
| Engine constraint |
Must be supported by the current MATLAB version |
| Installation source |
Local installation from GitHub is more reliable |
| Core dependencies |
matlab.engine, mcp[cli], setuptools, wheel, hatchling |
| License |
PolyForm Noncommercial 1.0.0 |
| Upstream repository |
sohumsuthar/simulink-mcp |
This workflow lets AI operate Simulink models directly
Traditional Simulink modeling depends heavily on drag-and-drop actions, signal wiring, and repeated switching between parameter dialogs. In control systems, signal processing, and teaching scenarios, that repetitive work adds up quickly.
After you introduce simulink-mcp, the Agent in Cursor can call model tools directly to load, save, add blocks, delete blocks, modify parameters, configure solvers, and run simulations. The interaction layer shifts from a GUI-first workflow to natural language.
You can do the following after the setup works
- Load, close, and save
.slx models
- Enumerate blocks and signal connections
- Read and write block parameters and model configuration
- Automatically build control loops and run simulations
# MATLAB starts only when a tool is actually invoked for the first time
# So the MCP handshake is fast, but a cold start may take 15–20 seconds
python -m simulink_mcp
This command is only the service entry point. The real delay usually appears during the first tool invocation.
Version compatibility is the most fragile part of the entire chain
This setup is not just about installing a single package. You must align MATLAB, MATLAB Engine for Python, the Python interpreter, and the mcp package at the same time.
There are three critical constraints: MATLAB Engine must support your Python minor version; mcp[cli] requires Python 3.10+; and the interpreter that runs MCP must be exactly the same interpreter used to install MATLAB Engine.
A single common conflict can block the entire workflow
For example, an older MATLAB release may support only Python 3.9 or below, while newer versions of mcp require Python 3.10+. In that situation, even if MATLAB Engine installs successfully, MCP still cannot run. The reverse is also possible: MCP installs, but import matlab.engine fails.
# Use the same interpreter for a minimal validation test
import sys # Check the current interpreter path
import matlab.engine # Verify that MATLAB Engine can be imported
print(sys.executable) # Critical: confirm that only one interpreter is in use
print("OK") # If this prints, MATLAB Engine is installed correctly
Use this script to verify interpreter consistency and MATLAB Engine availability. It should be your first troubleshooting step.
Installing MATLAB Engine correctly matters more than using pip install blindly
Run matlabroot in the MATLAB command window first to locate the installation root, then go to `
\extern\engines\python`. That directory should contain `setup.py`.
In Windows PowerShell, the recommended approach is to run `setup.py install` directly from the source directory instead of prioritizing `pip install .`. In some environments, `pip` copies the source into a temporary build directory, which can trigger false errors or corrupt the installation.
### Use the following installation method
“`powershell
cd “F:\MATLAB2024\extern\engines\python”
& “C:\Path\To\Python310\python.exe” setup.py install
& “C:\Path\To\Python310\python.exe” -c “import matlab.engine; print(‘OK’)”
“`
These commands install MATLAB Engine and run a self-check. A successful installation prints `OK`.
## Installing simulink-mcp requires you to stabilize networking and the build toolchain first
In practice, the most reliable way to install `simulink-mcp` is to clone the repository from GitHub and install it locally, rather than depending on uncertain package name mappings.
Before installation, upgrade `pip`, `setuptools`, `wheel`, and `hatchling`, then install `mcp[cli]>=1.2.0` separately. If your proxy or package mirror is misconfigured, the build often fails during `hatchling` resolution or package index access.
### A step-by-step installation sequence is more stable
“`powershell
# Clear proxy environment variables so pip does not use an invalid proxy
Remove-Item Env:HTTP_PROXY,Env:HTTPS_PROXY,Env:ALL_PROXY,Env:http_proxy,Env:https_proxy,Env:all_proxy -ErrorAction SilentlyContinue
cd “C:\Path\To\simulink-mcp”
& “C:\Path\To\Python310\python.exe” -m pip install –upgrade pip setuptools wheel hatchling “mcp[cli]>=1.2.0” –index-url https://pypi.org/simple –trusted-host pypi.org –trusted-host files.pythonhosted.org
& “C:\Path\To\Python310\python.exe” -m pip install . –no-build-isolation –index-url https://pypi.org/simple –trusted-host pypi.org –trusted-host files.pythonhosted.org
“`
The key idea here is to install the build dependencies first, then disable build isolation to reduce failures caused by repeated dependency downloads.
## The mcp.json file in Cursor must point to the same Python interpreter
After installation succeeds, the factor that actually determines whether the tools work is not your system default Python. It is the interpreter specified by `command` in `mcp.json`.
If that field points to a different `python.exe`, Cursor will still report unavailable tools or missing modules, even if MATLAB Engine and `simulink-mcp` are installed correctly.
### Here is a minimal working configuration
“`json
{
“mcpServers”: {
“simulink”: {
“command”: “C:/Users/YourName/AppData/Local/Programs/Python/Python310/python.exe”,
“args”: [“-m”, “simulink_mcp”],
“env”: {
“SIMULINK_MCP_WORKDIR”: “F:/SimulinkModels”
}
}
}
}
“`
This configuration defines the Simulink MCP service entry point. `SIMULINK_MCP_WORKDIR` controls the default directory used to read and write model files.
## Real-world testing shows that AI can automatically build a closed-loop control model
A representative test is to ask the Agent not to use the built-in PID Controller block, but instead assemble a parallel PID closed loop manually with Gain, Integrator, Derivative, Sum, Transfer Fcn, Step, and Scope blocks.
If the toolchain works correctly, AI can automatically create the model, place the blocks, connect the feedback loop, and call `simulate` to return a figure. That means it can do more than just read a model. It can generate one.

**AI Visual Insight:** This image shows the Simulink editor after AI automatically generated the control system block diagram through Simulink MCP. The visible elements include the error summing junction, the PID branch blocks, the plant, and the observation path. It demonstrates that model creation is not a static template dump, but a real editable block-level structure on the Simulink canvas.

**AI Visual Insight:** This image shows that automatically placed blocks may overlap or have imperfect alignment. That indicates the current toolchain is optimized more for functional correctness than visual layout quality. Developers can use Simulink’s built-in auto-layout tools or ask AI to perform a second cleanup pass.
### The simulation output is the final proof that the full loop works
If `simulate` successfully returns an image, it confirms that the MCP service, MATLAB Engine, model path, Scope output, and session communication are all working end to end.
“`text
Please use Simulink MCP: load demo_pid_blocks.slx,
set stop_time to 20, set return_figures to true,
and describe whether the step response converges and whether obvious oscillation is present.
“`
Use this prompt to validate the three core capabilities: model loading, simulation execution, and image return.

**AI Visual Insight:** This image shows the response curve returned after simulation through MCP. It is typically used to evaluate convergence speed, overshoot, and oscillation trends under a unit step input. The result confirms that AI successfully triggered Simulink execution, captured the Scope image, and returned it to the chat interface.

**AI Visual Insight:** This image shows a combined interaction pattern where simulation results appear alongside textual analysis. It demonstrates that Cursor can return figures and also generate an initial interpretation of convergence and oscillation behavior, forming an execution-plus-explanation workflow.
## Troubleshooting should start with three checks instead of blind reinstallation
First, confirm that `python -V`, `import matlab.engine`, and the `command` field in `mcp.json` all point to the same interpreter. Second, inspect your proxy, VPN, `pip config`, and WinHTTP proxy settings. Third, confirm that the working directory exists and has read/write permission for `.slx` files.
Many failures are not caused by Simulink itself. They come from fragmented Python versions and polluted environments. If your main interpreter already carries heavyweight dependencies such as TensorFlow or Streamlit, consider creating a dedicated virtual environment for MCP later.
### FAQ
**Q1: Why can’t Cursor find the Simulink tools even though MATLAB Engine is already installed?**
A1: The most common reason is that the `command` field in `mcp.json` points to a different Python interpreter. MATLAB Engine, `simulink-mcp`, and the MCP startup command must all use the same interpreter.
**Q2: Why does the first tool call take more than ten seconds? Does that mean the configuration failed?**
A2: Not necessarily. This project uses lazy MATLAB startup, so MATLAB launches only when a tool is invoked for the first time. A 15–20 second engine cold start is normal.
**Q3: What should I do if installing `mcp[cli]` or project dependencies fails with ProxyError or SSLError?**
A3: First disable your VPN, clear the `HTTP_PROXY/HTTPS_PROXY` environment variables, and inspect `pip config list` and `netsh winhttp show proxy`. If needed, switch to the official PyPI index and add `–trusted-host`.
Core summary: This guide reconstructs a real-world `simulink-mcp` deployment workflow and explains how to connect MATLAB Engine, Python 3.10+, MCP, and Cursor on Windows. Once configured correctly, AI can use natural language to build Simulink models, modify parameters, and run simulations, while avoiding the most common issues around version conflicts, proxy failures, and interpreter mismatches.