MATLAB Simulink MCP Server
This Model Context Protocol (MCP) server lets MCP clients (such as Claude Desktop or other LLM-based agents) to interact with MATLAB and Simulink in real time. It runs locally, is built on FastMCP 2.0, and communicates with MATLAB and Simulink via the MATLAB Engine for Python API.
Features
-
Allows an LLM client to
- Read, write, and execute MATLAB code and scripts
- Parse and interact with Simulink models
- Access workspace and results (inculding visualizations)
-
Execution Safety
- Basic safeguards against unsafe commands
- Restricted to current working directory (only manually changeable)
-
Robust Runtime
- Non-blocking execution (asyncronous MATLAB engine calls)
- Automatic installation of MATLAB Engine library if unavailable
Requirements
- MATLAB R2022b or later
- Python 3.10–3.12 (check which version is supported by your MATLAB installation)
Installation
-
Create and activate a Python virtual environment (uv is recommended, automatically installs Python version if missing):
uv venv --python 3.12 # match Python to your MATLAB-supported version source .venv/Scripts/activate # on macOS/Linux: source .venv/bin/activate
Without uv, you will first need to download and install the required Python version manually:
python3.12 -m venv .venv # match Python to your MATLAB-supported version source .venv/Scripts/activate # on macOS/Linux: source .venv/bin/activate
-
Install:
uv pip install matlab-simulink-mcp # or without uv pip install matlab-simulink-mcp
-
On the first run, if MATLAB Engine is not found, the server will open a console window and guide you through installation.
- This requires admin permission and the application will request for it.
- If you prefer to install manually, install a matching PyPI version or from your MATLAB installation.
Configuration
Claude Desktop
-
Open Claude Desktop Settings → Developer → Edit Config.
-
In the
claude_desktop_config.json, add or update:{ "mcpServers": { "MATLAB_Simulink_MCP": { "command": "<absolute-path-to>/.venv/Scripts/python.exe", // absolute path to your Python environment executable "args": [ "-m", "matlab_simulink_mcp" ], "env": { "LOG_DIR": "<absolute-path-to>/logs" // Optional: absolute path to a folder for logs } } } }
-
Save and restart Claude Desktop. (Ensure it is fully closed in Task Manager/Activity Monitor.)
-
Server's status can be checked from Settings → Developer, or the equalizer button in Claude's chat box.
Claude Code / Codex CLI
-
Run the following command in terminal:
claude mcp add MATLAB_Simulink_MCP --env LOG_DIR="<absolute-path-to>/logs" -- "<absolute-path-to>/.venv/bin/python" -m matlab_simulink_mcp
For Codex CLI, use
codexinstead ofclaude. -
Restart by opening a new terminal.
-
To check server status, run
claude mcp listorcodex mcp list.
For more information, see documentation for Claude Code or Codex CLI.
Notes
-
On macOS/Linux, use
<absolute-path-to>/.venv/bin/pythoninstead for the path to Python. -
Only use
/or\\in the paths, not\. -
On first launch, the server may open multiple consoles to install MATLAB Engine. Interact with one, complete installation, then restart the application if needed.
-
Any client is restricted to the current MATLAB working directory, which can only be changed manually for safety reasons.
-
The server logs outputs and errors its own log file as well. To keep a log file tracking console open, add
"--console"to config args. The log file is in the folder specified via environment variableLOG_DIR, or otherwise in the user log directory.
Debugging
FastMCP 2.0 includes an MCP Inspector for manual testing and debugging without an LLM client. It launches a web UI to send dummy requests directly to the server. The inspector finds and runs a server object named mcp itself. So you will need to import matlab_simulink_mcp.server.mcp as mcp in a script and then run it:
fastmcp dev script_name.py
Metadata
Release files for matlab-simulink-mcp 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| matlab_simulink_mcp-0.1.6.tar.gz | 74.5 kB | Without provenance | Details for matlab_simulink_mcp-0.1.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| matlab_simulink_mcp-0.1.6-py3-none-any.whl | Python 3 | none | any | Details for matlab_simulink_mcp-0.1.6-py3-none-any.whl |
Total release size: 150.8 kB
Release files / matlab_simulink_mcp-0.1.6.tar.gz
| Download URL | matlab_simulink_mcp-0.1.6.tar.gz |
|---|---|
| Size | 74.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f890ee2b9be0895c243e90e6090e7c14baa1ad9333e2dc42fd3493f176740879
|
|
BLAKE2b-256 checksum How to use checksums |
9844e7c81bae481f938165df70f7ef737f91169dd9d6aaf2344d8d81242bc69f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.3
|
Release files / matlab_simulink_mcp-0.1.6-py3-none-any.whl
| Download URL | matlab_simulink_mcp-0.1.6-py3-none-any.whl |
|---|---|
| Size | 76.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
322ebd25e71d6e6cbfa6e75987fabc0951920a891ff92d6f3415c82e2b2af610
|
|
BLAKE2b-256 checksum How to use checksums |
4c566b7041ad24cf68fcbcaa7663c13fce03fd84dd6eeee8a1390168179be3bb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.3
|
Security for matlab-simulink-mcp 0.1.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.