-
Notifications
You must be signed in to change notification settings - Fork 0
Installation
- Python 3.10, 3.11, or 3.12
- MATLAB 2020b+ installed locally
- MATLAB Engine API for Python — comes with MATLAB, needs separate install
The MATLAB Engine API lets Python call MATLAB. Install it from your MATLAB installation:
cd /Applications/MATLAB_R2024a.app/extern/engines/python
pip install .Adjust the path for your MATLAB version (e.g.,
R2023b,R2024b).
cd /usr/local/MATLAB/R2024a/extern/engines/python
pip install .cd "C:\Program Files\MATLAB\R2024a\extern\engines\python"
pip install .import matlab.engine
eng = matlab.engine.start_matlab()
result = eng.eval("2 + 2", nargout=1)
print(result) # Should print 4
eng.quit()pip install matlab-mcp-pythongit clone https://github.com/HanSur94/matlab-mcp-server-python.git
cd matlab-mcp-server-python
pip install -e ".[dev]"Installation variants:
-
Minimal install (no dev/monitoring):
pip install -e . -
With dev tools (testing, linting):
pip install -e ".[dev]" -
With monitoring (dashboard, health endpoint):
pip install -e ".[monitoring]" -
Full (everything):
pip install -e ".[dev]"
# Single user (stdio transport) — simplest setup
matlab-mcp
# Multi-user (SSE transport) — shared server
matlab-mcp --transport sse
# With custom config
matlab-mcp --config my_config.yamlAdd to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"matlab": {
"command": "matlab-mcp"
}
}
}claude mcp add matlab -- matlab-mcpAdd to .cursor/mcp.json in your project:
{
"mcpServers": {
"matlab": {
"command": "matlab-mcp"
}
}
}Start the server:
matlab-mcp --transport sseThen point your client to http://localhost:8765/sse.
Access the web dashboard at http://localhost:8766/dashboard.
docker build -t matlab-mcp .# Run with your MATLAB mounted
docker run -p 8765:8765 -p 8766:8766 \
-v /path/to/MATLAB:/opt/matlab:ro \
-e MATLAB_MCP_POOL_MATLAB_ROOT=/opt/matlab \
matlab-mcp --transport ssePlatform-specific MATLAB paths:
-
Linux:
-v /usr/local/MATLAB/R2024b:/opt/matlab:ro -
macOS:
-v /Applications/MATLAB_R2024b.app:/opt/matlab:ro -
Windows:
-v "C:\Program Files\MATLAB\R2024b:/opt/matlab:ro"
Edit docker-compose.yml to set your MATLAB installation path in the volumes section:
volumes:
# Uncomment and adjust for your system:
# - /usr/local/MATLAB/R2024b:/opt/matlab:ro # Linux
# - /Applications/MATLAB_R2024b.app:/opt/matlab:ro # macOS
# - C:\Program Files\MATLAB\R2024b:/opt/matlab:ro # WindowsThen start the stack:
docker compose upAccess the server at http://localhost:8765 and the dashboard at http://localhost:8766/dashboard.
Note: The Docker image does not include MATLAB. You must mount your own MATLAB installation and set the
MATLAB_MCP_POOL_MATLAB_ROOTenvironment variable or uncomment the volume mount indocker-compose.yml.
python -m venv .venv
source .venv/bin/activate # macOS/Linux
# .venv\Scripts\activate # Windows
# Install MATLAB Engine API into the venv
cd /Applications/MATLAB_R2024a.app/extern/engines/python
pip install .
# Install server
cd /path/to/matlab-mcp-server-python
pip install -e ".[dev]"If you previously installed as matlab-mcp-server, uninstall and reinstall:
pip uninstall matlab-mcp-server
pip install matlab-mcp-pythonAll settings live in config.yaml with sensible defaults. Override any setting via environment variables:
# Override pool size
export MATLAB_MCP_POOL_MIN_ENGINES=4
export MATLAB_MCP_POOL_MAX_ENGINES=16
# Override sync timeout (promote to async after 60s instead of 30s)
export MATLAB_MCP_EXECUTION_SYNC_TIMEOUT=60
# Override transport
export MATLAB_MCP_SERVER_TRANSPORT=sseSee the Configuration documentation for all available settings.