Skip to content
github-actions[bot] edited this page Mar 22, 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).

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 interactive Plotly JSON
  • Use custom libraries — expose your .m functions as first-class MCP tools
  • Scale elastically — automatic engine pool (2–10+) for multiple concurrent users

Key Features

Feature Details
Sync + Async Execution Fast commands run immediately; long jobs (>30s) auto-promote to async
Elastic Engine Pool Scales 2–10+ MATLAB engines based on demand
Interactive Plots MATLAB figures auto-convert to Plotly JSON with full style fidelity
Multi-User (SSE) Session isolation with per-user workspaces
Progress Reporting Long jobs report percentage back to the agent in real-time
Toolbox Discovery Browse installed toolboxes, functions, and help text
Custom Tools Expose your .m functions via YAML with zero code changes
Code Checker Built-in checkcode/mlint before execution
One-Click Windows Install Offline install.bat — no admin rights needed

Supported Platforms

Platform MATLAB Version Transport
macOS R2022b+ stdio, SSE
Windows R2022b+ stdio, SSE
Docker R2022b+ stdio, SSE
Linux R2022b+ stdio, SSE

Quick Start

Install

# macOS / Linux
pip install matlab-mcp-python

# Windows (one-click, offline)
git clone https://github.com/HanSur94/matlab-mcp-server-python.git
cd matlab-mcp-server-python
install.bat

Run

# Single user (stdio)
matlab-mcp

# Multi-user (SSE)
matlab-mcp --transport sse

Connect to Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "matlab": {
      "command": "matlab-mcp"
    }
  }
}

Example: Ask Your AI Agent

"Calculate eigenvalues of a 3×3 magic square and plot them"

A = magic(3);
eigenvalues = eig(A);
plot(eigenvalues, 'ro', 'MarkerSize', 8);
title('Eigenvalues of Magic Square');

Returns: Interactive Plotly chart + inline results.

Getting Help

Clone this wiki locally