MATLAB MCP Server — Claude Code MCP server: run MATLAB from your agent
MathWorks' official MCP server lets an AI agent start MATLAB, write and run code, and check it for style and correctness.
Open on GitHubWhat MATLAB MCP Server does
The server wires an AI agent into MATLAB. Through it the agent starts and quits a MATLAB session, writes and runs code, and reviews what it wrote for style and correctness. Any application that speaks Model Context Protocol works, and Claude takes it with one terminal command.
You need MATLAB R2021a or later installed and on the system PATH before anything else. Grab the server binary from the latest GitHub release: a ready file for Windows and Linux, separate macOS builds for Apple silicon and Intel. On macOS you then run chmod +x on the downloaded file so it can execute. Prefer building it yourself? Install Go and compile from source instead.
Windows users running Codex hit a snag: Codex does not forward the WINDIR environment variable, and MATLAB and Simulink need it. Add it by hand to C:\Users\<username>\.codex\config.toml under [mcp_servers.matlab]. Server behaviour is tuned with arguments, and --initial-working-folder sets the folder the session opens in.
What it helps with
- run a MATLAB script without leaving the agent chat
- check MATLAB code for style and correctness
- run MATLAB tests from inside a Claude session
- open MATLAB in a specific project folder with
--initial-working-folder - hook MATLAB into an agent in VS Code or Cursor via
mcp.json
Example prompts for the agent
- Add the MATLAB MCP Server and run my
analysis.mscript - Review this MATLAB code for style and correctness
- Start MATLAB in
/home/username/myprojectand run the tests
How to install MATLAB MCP Server
Install
The MCP registry has no launch command for it: see the repository README
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about MATLAB MCP Server
How do I install the MATLAB MCP Server in Claude?
Install MATLAB R2021a or later and put it on your PATH, then download the server binary from the latest release. In your terminal run claude mcp add --transport stdio matlab -- /fullpath/to/matlab-mcp-server-binary with the full path to that file.
What does the MATLAB MCP Server do?
It gives an agent access to MATLAB: starting and quitting a session, writing and running code, and assessing code for style and correctness.
Why does the server fail to find MATLAB in Codex on Windows?
Codex does not forward WINDIR, which MATLAB and Simulink need to run. Add env_vars = ["WINDIR"] to the [mcp_servers.matlab] section of C:\Users\<username>\.codex\config.toml.