An MCP server for allowing LLMs to interact with MATLAB and Simulink
This project has been archived.
The maintainers of this project have marked this project as archived. No new releases are expected.
Project description
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 } } } }
On macOS/Linux, use
<absolute-path-to>/.venv/bin/pythonincommand.Note: Only use
/or\\in the paths, not\. -
Save and restart Claude Desktop. (Ensure it is fully closed in Task Manager/Activity Monitor.)
-
On first launch, the server may open multiple consoles to install MATLAB Engine. Interact with one, complete installation, then restart Claude if needed.
-
Server's status can be checked from Settings → Developer, or the equalizer button in Claude's chat box.
-
Prompt Claude to write, run or read MATLAB code, scripts or Simulink models. Claude (and 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 to both Claude's and its own log file. To keep a log file tracking console open, add
"--console"to Claude config args.- Claude logs:
/logs/mcp-server-MatlabMCP.login the same folder asclaude_desktop_config.json. - Server logs: In the folder specified via environment variable
LOG_DIR, user log directory otherwise.
- Claude logs:
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 it using from matlab_simulink_mcp.server import mcp in a script and then run the script:
fastmcp dev script_name.py
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file matlab_simulink_mcp-0.1.5.tar.gz.
File metadata
- Download URL: matlab_simulink_mcp-0.1.5.tar.gz
- Upload date:
- Size: 74.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
15a77edd6634ae346196db4fbb0b73c9d946b507ba55e4f99edd441d4ab0df1c
|
|
| MD5 |
2150ccf409e732e830c492444410ecf4
|
|
| BLAKE2b-256 |
cb352f5c64dd0e560ce6d1703c425b2c0b57bb0ec64ebe8a545e3de855ac10a4
|
File details
Details for the file matlab_simulink_mcp-0.1.5-py3-none-any.whl.
File metadata
- Download URL: matlab_simulink_mcp-0.1.5-py3-none-any.whl
- Upload date:
- Size: 75.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1d79d3cdec0c691606ff83ca33b52fa9f30d9d5a82c4774af1d4dc49623aff56
|
|
| MD5 |
cc7e9f1333fb72473a4d6e6f8a22b15c
|
|
| BLAKE2b-256 |
741328a76c6065cf6783443349b8abd3f3bff5e53e823f20452aadb8faeb4b15
|