matlab/matlab-mcp-server

Run MATLAB® using AI applications with the official MATLAB MCP Server from MathWorks®. This MCP server for MATLAB supports a wide range of coding agents like Claude Code® and Visual Studio® Code.

What it is

MATLAB MCP Server is a small Go‑based service that lets AI‑powered tools (Claude, GitHub Copilot, Codex, etc.) start MATLAB, run code, and query information about the environment. It implements the Model Context Protocol (MCP), a standard way for an AI model to call external “tools”.

Why it matters

Many modern AI assistants want to execute real‑world scientific or engineering code. MATLAB is a dominant platform for numerical computing, signal processing, control systems, and simulation. By exposing MATLAB as an MCP server, developers can embed MATLAB capabilities directly inside an LLM‑driven workflow – for example, a chatbot that can:

  • launch MATLAB on demand,
  • run a script the user asks for,
  • check the script for style or errors, and
  • return the results back to the chat. This bridges the gap between large language models and a mature, proprietary engineering environment.

Core features (as described in the README)

Feature What it does
Start / quit MATLAB The server can launch a fresh MATLAB session or attach to an existing one (via --matlab-session-mode).
Run arbitrary MATLAB code evaluate_matlab_code evaluates a code string; run_matlab_file executes a .m script; run_matlab_test_file runs MATLAB unit‑test files.
Static analysis check_matlab_code performs read‑only lint‑style checks, reporting style, deprecated functions, performance hints, etc.
Tool discovery detect_matlab_toolboxes reports installed toolboxes and their versions.
Resources Provides coding‑guideline documents (e.g., MATLAB coding standards) as MCP resources that an AI can read to generate better code.
Custom extensions Users can supply JSON files (--extension-file) that define additional MCP tools.
Configurable startup Options for initial working folder, display mode (desktop vs nodesktop), log location/level, and telemetry control.
Cross‑platform binaries Pre‑built binaries for Windows, Linux, macOS (Intel & Apple‑silicon) and a Go‑install command for building from source.

Who would use it

  • AI‑assistant developers who want to add MATLAB capabilities to Claude, Copilot, or other LLM‑based products.
  • Researchers building autonomous agents that need to run simulations or data‑analysis pipelines in MATLAB.
  • Teams that already own MATLAB licenses and wish to expose its functionality programmatically without writing their own wrappers.

How to get started (quick‑start)

  1. Install MATLAB R2021a or newer and ensure matlab is on your system PATH.
  2. Download the appropriate binary for your OS (or go install … to build it).
  3. Register the server with your AI tool:
    • Claude Codeclaude mcp add --transport stdio matlab -- /path/to/matlab-mcp-server
    • Claude Desktop – install the provided .mcpb bundle.
    • VS Code (Copilot) – add a matlab entry to .vscode/mcp.json pointing at the binary.
    • Codexcodex mcp add matlab -- /path/to/matlab-mcp-server.
  4. (Optional) Pass arguments like --initial-working-folder or --matlab-display-mode=nodesktop to tailor behaviour.
  5. Use the exposed tools (run_matlab_file, check_matlab_code, etc.) from your AI‑driven workflow.

Limitations & considerations

  • License‑bound – The server may only be used under a valid MathWorks license and is not intended for multi‑user sharing.
  • Telemetry – Anonymous usage data is sent to MathWorks by default; can be disabled with --disable-telemetry=true.
  • Graphical commands – Even in nodesktop mode, commands that open GUI windows (e.g., uifigure) will still pop up on the host machine.
  • Existing‑session mode requires a running MATLAB instance that has executed shareMATLABSession().

All information above is taken directly from the repository’s README.

Related

  • Project
  • Project
  • Project
  • Project
  • Project