# HanSur94/matlab-mcp-server-python [Health: Active]

**Category:** 👨‍💻 Code Execution  
**Repository:** https://github.com/HanSur94/matlab-mcp-server-python  
**GitHub Stars:** 4  
**Views:** 2  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/hansur94-matlab-mcp-server-python

## Description
Connect AI agents to MATLAB — execute code, run async jobs with progress reporting, get interactive Plotly plots, expose custom .m functions as tools, and monitor via live dashboard.

## Tools
Capabilities this server exposes over MCP:

- **execute_code** — Run MATLAB code. Returns inline if fast (<30s), or a job ID if promoted to async
- **check_code** — Run `checkcode`/`mlint`. Returns structured warnings/errors
- **get_workspace** — Show variables in the current MATLAB workspace
- **get_job_status** — Status + progress percentage for running jobs
- **get_job_result** — Full result of a completed job
- **cancel_job** — Cancel a pending or running job
- **list_jobs** — List all jobs in this session
- **list_toolboxes** — List installed MATLAB toolboxes
- **list_functions** — List functions in a toolbox
- **get_help** — Get MATLAB help text for any function
- **upload_data** — Upload data files to the session
- **delete_file** — Delete a session file
- **list_files** — List files in the session directory
- **read_script** — Read a MATLAB `.m` script file as text
- **read_data** — Read data files (`.mat`, `.csv`, `.json`, `.txt`, `.xlsx`). `format`: `summary` or `raw
- **read_image** — Read image files (`.png`, `.jpg`, `.gif`) — renders inline in agent UIs
- **get_pool_status** — Engine pool stats (available/busy/max)
- **get_server_metrics** — Comprehensive server metrics (pool, jobs, sessions, system)
- **get_server_health** — Health status with issue detection (healthy/degraded/unhealthy)
- **get_error_log** — Recent errors and notable events

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `uvx` (confidence: high):

```json
"mcpServers": {
  "matlab-mcp-server-python": {
    "command": "uvx",
    "args": ["matlab-mcp-python"],
    "env": {
      "MATLAB_MCP_POOL_MATLAB_ROOT": ""
    }
  }
}
```

**Requires environment variables:** `MATLAB_MCP_POOL_MATLAB_ROOT` — the values above are empty placeholders; fill in real credentials before running (see the repository for what each one is for).

## Documentation

## What HanSur94/matlab-mcp-server-python MCP server does

HanSur94/matlab-mcp-server-python MCP server gives an MCP client access to a shared MATLAB installation. Agents can submit MATLAB code, inspect the current workspace, discover installed toolboxes and their functions, request MATLAB help text, and run `checkcode`/`mlint` to find warnings or errors before execution.

The server also handles session files and common data formats. Agents can upload and delete files, list the session directory, read MATLAB scripts, and load `.mat`, `.csv`, `.json`, `.txt`, or `.xlsx` content in summary or raw form. PNG, JPG, and GIF files can be read for inline rendering in supported agent interfaces.

MATLAB figures are converted to Plotly JSON, with a static PNG and thumbnail available as a fallback for clients that do not render interactive charts. The documented conversion covers line, scatter, bar, area, subplot or tiled layouts, multiple axes, and linear or logarithmic scales.

## How it works

HanSur94/matlab-mcp-server-python MCP server uses Python and the MATLAB Engine API for Python to communicate with MATLAB R2022b or newer. Fast calls return directly. Work that exceeds the synchronous threshold is represented by a job ID, allowing the agent to check progress, retrieve the completed result, cancel the work, or list jobs in the session.

A MATLAB engine pool tracks available and busy engines and can scale across multiple engines. The server supports single-user stdio mode and HTTP-based operation with streamable HTTP as the preferred transport. SSE remains available as a legacy transport for existing clients, and sessions are isolated in the multi-user mode described by the project.

Custom MATLAB `.m` functions can also be exposed as MCP tools through YAML configuration, allowing existing MATLAB libraries to be used without rewriting them as MCP implementations.

## Setup and configuration

Python 3.10 or newer and MATLAB R2022b or newer are required, along with the MATLAB Engine API for Python. The project supports installation from PyPI or source. Its Pixi tasks can start the server, install an engine package matched to the detected MATLAB release, and run stdio, streamable HTTP, or SSE transports. The repository also provides a Windows installer for supported Windows 10 and 11 systems.

Start a single-user server with `matlab-mcp`. For multi-user HTTP operation, use `matlab-mcp --transport streamablehttp`; use `--transport sse` when an existing SSE client requires it. Docker is supported, but the image does not contain MATLAB, so a local MATLAB installation must be mounted. When using the documented Docker setup, `MATLAB_MCP_POOL_MATLAB_ROOT` points to the mounted MATLAB directory.

Claude Desktop, Claude Code, and Cursor connection examples are provided in the project documentation. Cursor uses a project `.cursor/mcp.json` file, while Claude Code registers the command with `claude mcp add`.

## Tools and capabilities

The exposed tools include:

- `execute_code` for MATLAB commands, with automatic synchronous or asynchronous handling.
- `check_code`, `get_workspace`, `list_toolboxes`, `list_functions`, and `get_help` for inspection and code quality checks.
- `get_job_status`, `get_job_result`, `cancel_job`, and `list_jobs` for asynchronous work.
- `upload_data`, `delete_file`, `list_files`, `read_script`, `read_data`, and `read_image` for session file operations.
- `get_pool_status`, `get_server_metrics`, `get_server_health`, and `get_error_log` for server and engine-pool monitoring.

## Limitations and notes

MATLAB is not bundled with the Docker image or the Python package, and the MATLAB Engine installation must match the local MATLAB release. Interactive plots depend on the client being able to render Plotly JSON; other clients can use the generated static image fallback. The project documents Windows and macOS support in its feature list, while Pixi instructions also describe a cross-platform workflow.

_Full upstream README: https://allmcps.com/mcp/hansur94-matlab-mcp-server-python/readme_

