-
Notifications
You must be signed in to change notification settings - Fork 0
Home
github-actions[bot] edited this page Mar 18, 2026
·
21 revisions
# MATLAB MCP Server Wiki
Welcome to the **MATLAB MCP Server** wiki! This server connects any AI agent to a shared MATLAB installation via the [Model Context Protocol (MCP)](https://modelcontextprotocol.io/).
## Quick Navigation
- **[[Installation]]** — Prerequisites, MATLAB Engine API, server setup
- **[[Configuration]]** — Full YAML config reference with all options
- **[[MCP Tools Reference]]** — All built-in tools with parameters and examples
- **[[Custom Tools]]** — Expose your own `.m` functions as AI-callable tools
- **[[Examples]]** — Ready-to-run MATLAB examples for common tasks
- **[[Architecture]]** — System design, engine pool, async jobs, session model
- **[[Async Jobs]]** — Long-running jobs, progress reporting, job lifecycle
- **[[Security]]** — Function blocklist, workspace isolation, upload limits
- **[[Troubleshooting]]** — Common issues and solutions
- **[[FAQ]]** — Frequently asked questions
## What is this?
A Python MCP server that gives AI agents (Claude, Cursor, Copilot, custom agents) the ability to:
- **Execute MATLAB code** — sync for fast commands, async for long-running jobs
- **Discover toolboxes** — browse installed toolboxes, functions, and help text
- **Check code quality** — run `checkcode`/`mlint` before execution
- **Get interactive plots** — figures auto-converted to Plotly JSON with full style fidelity
- **Use custom libraries** — expose your `.m`/`.mex` functions as first-class MCP tools
- **Monitor jobs** — progress reporting, scaling metrics, server health
## Supported Platforms
| Platform | MATLAB Version | Transport |
|----------|---------------|-----------|
| macOS | 2020b+ | stdio, SSE |
| Windows | 2020b+ | stdio, SSE |
| Docker | 2020b+ | stdio, SSE |
## Key Features
| Feature | Description |
|---------|-------------|
| **Elastic engine pool** | Scales 2-10+ engines based on demand; auto-scales down when idle |
| **Async job execution** | Hours-long simulations run without blocking; agent polls progress |
| **Interactive Plotly plots** | MATLAB figures auto-converted to interactive JSON with line styles, markers, legends, subplots |
| **Code quality checking** | `checkcode`/`mlint` validation before execution |
| **Multi-user support (SSE)** | Session isolation with per-user workspaces |
| **Custom MATLAB tools** | Expose proprietary `.m` functions via YAML — zero code changes |
| **File management** | Upload data, read `.mat`/`.csv`/`.json`/`.xlsx`, view images inline |
| **Cross-platform Docker** | Pre-configured container (mount your own MATLAB) |
## Quick Start
### Prerequisites
- **Python 3.10+**
- **MATLAB 2020b+** with [MATLAB Engine API for Python](https://www.mathworks.com/help/matlab/matlab-engine-for-python.html)
```bash
# Install MATLAB Engine API
cd /Applications/MATLAB_R2024a.app/extern/engines/python # macOS
# cd "C:\Program Files\MATLAB\R2024a\extern\engines\python" # Windows
pip install .# Install
pip install matlab-mcp-python
# Run (stdio — simplest)
matlab-mcp
# Or multi-user (SSE)
matlab-mcp --transport sseAdd to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"matlab": {
"command": "matlab-mcp"
}
}
}Ask your agent:
"Calculate eigenvalues of a 3×3 magic square and plot them"
Agent calls execute_code:
A = magic(3);
eigenvalues = eig(A);
scatter(1:3, eigenvalues); title('Eigenvalues'); xlabel('Index'); ylabel('Value');You get:
-
Inline results:
15.0000, 4.8990, -4.8990 - Interactive Plotly chart with scatter plot, title, axis labels
- Static PNG as fallback