MATLAB MCP Integration MCP Server

MCP server to run MATLAB code from LLM via the Matlab Engine API.

Local serverstdioPython

What is the MATLAB MCP Integration MCP Server?

MCP server to run MATLAB code from LLM via the Matlab Engine API.

What you get

This is an implementation of a Model Context Protocol (MCP) server for MATLAB. It allows MCP clients (like LLM agents or Claude Desktop) to interact with a shared MATLAB session using the MATLAB Engine API for Python.

  • Execute MATLAB Code: — Run arbitrary MATLAB code snippets via the runMatlabCode tool
  • Retrieve Variables: — Get the value of variables from the MATLAB workspace using the getVariable tool
  • Structured Communication: — Tools return results and errors as structured JSON for easier programmatic use by clients
  • Non-Blocking Execution: — MATLAB engine calls are run asynchronously using asyncio.to_thread to prevent blocking the server
  • Standard Logging: — Uses Python's standard logging module, outputting to stderr for visibility in client logs
  • Shared Session: — Connects to an existing shared MATLAB session

Configuration and credentials

  • Python 3.12 or higher * MATLAB (R2023a or higher recommended - check MATLAB Engine API for Python compatibility) with the MATLAB Engine API for Python installed. * numpy Python package.

More MCP options

Compare MCP servers by category, or browse hosted MCP servers if you prefer an endpoint over a local process.

Maintainer setup documentation.

Configuration

  • Python 3.12 or higher * MATLAB (R2023a or higher recommended - check MATLAB Engine API for Python compatibility) with the MATLAB Engine API for Python installed. * numpy Python package.
VariableDescriptionRequired
MY_VARConfiguration value read at startup.Optional

Example prompts to try

  • “Use MATLAB MCP Integration to Non.”

Frequently asked questions

Python 3.12 or higher, MATLAB (**R2023a or higher recommended**) with the MATLAB Engine API for Python installed, and the `numpy` Python package.