MATLAB MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MATLAB MCP ServerWrite and run MATLAB code to plot sin(x) for x from 0 to 2π."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MATLAB MCP Server
Run MATLAB® using AI applications with the official MATLAB MCP Server from MathWorks®. The MATLAB MCP Server allows your AI applications to:
Start and quit MATLAB.
Write and run MATLAB code.
Assess your MATLAB code for style and correctness.
To assist your agent in using MATLAB and Simulink, you can use skills from MATLAB Agentic Toolkit (GitHub) and Simulink Agentic Toolkit (GitHub), which can also install this MCP server for you.
Table of Contents
Related MCP server: MATLAB MCP Server
Setup
Install MATLAB (MathWorks) R2021a or later and add it to the system PATH.
The server supports any AI application that uses Model Context Protocol. To set up the MATLAB MCP Server for Claude Desktop, skip to the instructions for Claude Desktop. To set up the server for other applications, follow these instructions:
For Windows or Linux, Download the Latest Release. (Alternatively, you can build from source: install Go and build the binary using
go install github.com/matlab/matlab-mcp-server/cmd/matlab-mcp-server@latest).For macOS, first download the latest release by running the following command in your terminal:
For Apple silicon processors, run:
curl -L -o ~/Downloads/matlab-mcp-server https://github.com/matlab/matlab-mcp-server/releases/latest/download/matlab-mcp-server-macos-arm64For Intel processors, run:
curl -L -o ~/Downloads/matlab-mcp-server https://github.com/matlab/matlab-mcp-server/releases/latest/download/matlab-mcp-server-macos-x64
Then grant executable permissions to the downloaded binary so you can run the MATLAB MCP Server:
chmod +x ~/Downloads/matlab-mcp-server
Add the MATLAB MCP Server to your AI application. You can find instructions for adding MCP servers in the documentation of your AI application. For example instructions on using Claude Code®, Claude Desktop®, and GitHub Copilot in Visual Studio® Code, see below. Note that you can customize the server by specifying optional Arguments.
Claude Code
In your terminal, run the following, remembering to insert the full path to the server binary you acquired in the setup:
claude mcp add --transport stdio matlab -- /fullpath/to/matlab-mcp-server-binaryYou can customize the server by specifying optional Arguments. Note the -- separator between Claude Code's options and the server arguments:
claude mcp add --transport stdio matlab -- /fullpath/to/matlab-mcp-server-binary --initial-working-folder=/home/username/myprojectFor details on adding MCP servers in Claude Code, see Add a local stdio server (Claude Code). To remove the server later, run:
claude mcp remove matlabClaude Desktop
You install the MATLAB MCP Server in Claude Desktop using the MATLAB MCP Server bundle.
Install the Filesystem extension in Claude Desktop to allow Claude to read and write files on your system. In Claude Desktop, click Settings > Extensions > Browse extensions. Search for the Filesystem extension developed by Anthropic and click Install. Specify the folders you want to allow the MCP server to access, then toggle the Disabled button to Enable the Filesystem extension.
Download the MATLAB MCP Server bundle
matlab-mcp-server.mcpbfrom the Latest Release page.To install the MATLAB MCP Server bundle as a desktop extension, double click the downloaded
matlab-mcp-server.mcpbfile and click Install in Claude Desktop. (Alternatively, navigate in Claude to File menu > Settings > Extensions > Advanced Settings > Install Extension and select thematlab-mcp-server.mcpbfile. Click Install).
To customize the behaviour of the MATLAB MCP Server, navigate to Settings > Extensions > Configure, where you can modify the server's Arguments.
GitHub Copilot in Visual Studio Code
In your VS Code workspace, create a file named .vscode/mcp.json. Insert the following JSON, remembering to specify the full path to the server binary you acquired in the setup, as well as any Arguments. Then save the file. (Note that on Windows, your paths require extra slashes as escape characters).
{
"servers": {
"matlab": {
"type": "stdio",
"command": "C:\\fullpath\\to\\matlab-mcp-server-windows-x64.exe",
"args": []
}
}
}For more information about using MCP servers in VS Code, see Add and Manage MCP servers in VS Code (VS Code).
Codex
In your terminal, run the following, remembering to insert the full path to the server binary you acquired in the setup:
codex mcp add matlab -- /fullpath/to/matlab-mcp-server-binaryYou can customize the server by specifying optional Arguments. For example:
codex mcp add matlab -- /fullpath/to/matlab-mcp-server-binary --initial-working-folder=/home/username/myprojectWindows users: Codex does not forward the WINDIR environment variable, which you need to run MATLAB and Simulink (see #32).
To add the variable, open your Codex config file at C:\Users\<username>\.codex\config.toml, and add env_vars = ["WINDIR"] to the [mcp_servers.matlab] section:
[mcp_servers.matlab]
command = 'C:\fullpath\to\matlab-mcp-server-windows-x64.exe'
args = []
env_vars = ["WINDIR"]Arguments
Customize the behavior of the server by specifying arguments in one of these ways:
Insert the arguments in the configuration settings of your AI application (usually a
.jsonfile).Enter the arguments as command-line interface (CLI) flags when you start the server.
Use environment variables, specified either in your CLI or application's configuration settings. To derive the environment variable name from a CLI flag, add the prefix
MW_MCP_SERVER_, convert to uppercase, and replace hyphens (-) with underscores (_). For example, the argument--matlab-rootbecomes the environment variableMW_MCP_SERVER_MATLAB_ROOT. CLI flags take precedence over environment variables, if you use both.
Argument | Description | Example |
help | Displays help information for all arguments. |
|
version | Displays the version of the MATLAB MCP Server. |
|
matlab-root | Full path specifying which MATLAB to start. Do not include | Windows: |
initialize-matlab-on-startup | To initialize MATLAB as soon as you start the server, set this argument to |
|
initial-working-folder | Specify the folder where MATLAB starts. If you do not specify a value, MATLAB starts at the path of your AI application's first Root (MCP). If you have not defined a root, MATLAB starts in these locations: Linux: | Windows: |
matlab-display-mode | Specify whether to show the MATLAB desktop. Use |
|
matlab-session-mode | Specify whether the MCP server starts a new MATLAB or connects to an existing MATLAB session (supported for MATLAB R2023a onwards). The default is |
|
extension-file | To use custom MCP tools, provide a path to a JSON file that defines your tools. You can also use multiple extension files. For details on using custom tools, see Use Custom Tools with the MATLAB MCP Server. | Windows: |
log-folder | Specify the folder where the MCP server stores log files. If not specified, the server uses the default temporary folder of your operating system. | Windows: |
log-level | The log levels of the MCP server. Valid values, in order of decreasing verbosity, are |
|
disable-telemetry | To disable anonymized data collection, set this argument to |
|
Tools
detect_matlab_toolboxesReturns information about installed MATLAB and toolboxes, including version numbers.
check_matlab_codePerforms static code analysis on a MATLAB script. Returns warnings about coding style, potential errors, deprecated functions, performance issues, and best practice violations. This is a non-destructive, read-only operation that helps identify code quality issues without executing the script.
Inputs:
script_path(string): Absolute path to the MATLAB script file to analyze. Must be a valid.mfile. The file is not modified during analysis. Example:C:\Users\username\matlab\myFunction.mor/home/user/scripts/analysis.m.
evaluate_matlab_codeEvaluates a string of MATLAB code and returns the output.
Inputs:
code(string): MATLAB code to evaluate.project_path(string): Absolute path to your project directory. MATLAB sets this directory as the current working folder. Example:C:\Users\username\matlab-projector/home/user/research.
run_matlab_fileExecutes a MATLAB script and returns the output. The script must be a valid
.m file.Inputs:
script_path(string): Absolute path to the MATLAB script file to execute. Must be a valid.mfile. Example:C:\Users\username\projects\analysis.mor/home/user/matlab/simulation.m.
run_matlab_test_fileExecutes a MATLAB test script and returns comprehensive test results. Designed specifically for MATLAB unit test files that follow MATLAB testing framework conventions.
Inputs:
script_path(string): Absolute path to the MATLAB test script file. Must be a valid.mfile containing MATLAB unit tests. Example:C:\Users\username\tests\testMyFunction.mor/home/user/matlab/tests/test_analysis.m.
Resources
The MCP server provides Resources (MCP) to help your AI application write MATLAB code. To see instructions for using this resource, refer to the documentation of your AI application that explains how to use resources.
matlab_coding_guidelinesProvides comprehensive MATLAB coding standards for improving code readability, maintainability, and collaboration. The guidelines encompass naming conventions, formatting, commenting, performance optimization, and error handling.
URI:
guidelines://codingMIME Type:
text/markdownSource: MATLAB Coding Standards (GitHub)
plain_text_live_code_guidelinesProvides rules and guidelines for generating live scripts using the plain text Live Code
.mfile format, suitable for version control and AI-assisted development. Note that to run plain text live scripts you need MATLAB R2025a or newer. For details, see Live Code File Format (MathWorks).URI:
guidelines://plain-text-live-codeMIME Type:
text/markdown
Data Collection
The MATLAB MCP Server may collect fully anonymized information about your usage of the server and send it to MathWorks. This data collection helps MathWorks improve products and is on by default. To opt out of data collection, set the argument --disable-telemetry to true.
Security Considerations
When using the MATLAB MCP Server, you should thoroughly review and validate all tool calls before you run them. Always keep a human in the loop for important actions and only proceed once you are confident the call will do exactly what you expect. For more information, see User Interaction Model (MCP) and Security Considerations (MCP).
Licensing and Usage
The license is available in the LICENSE.md file in this GitHub repository.
MCP servers are only permitted to be used with MATLAB in accordance with the MathWorks Software License Agreement, and must not be shared by multiple users. Contact MathWorks if you need to support shared or centralized server use.
Contact Support
MathWorks encourages you to use this repository and provide feedback. To request technical support or submit an enhancement request, create a GitHub issue or contact MathWorks Technical Support.
Copyright 2025-2026 The MathWorks, Inc.
This server cannot be deployed
Maintenance
Related MCP Connectors
Build, validate, and deploy multi-agent AI solutions from any AI environment.
- mcp-serverOAuthcom.make
Give your AI agents the tools to build, manage, and run automation workflows.
- mcp-serverOAuthai.cdbx
Build Apps and run code in 30 languages — sandboxed, with persistent sessions for agent loops.
Connect AI assistants to GitHub - manage repos, issues, PRs, and workflows through natural language.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceAllows interaction with MATLAB by creating and executing scripts and functions through Claude or other MCP clients, supporting script management and execution result retrieval with environment configuration capabilities.40-
- AlicenseBqualityFmaintenanceIntegrates MATLAB with AI to execute code, generate scripts from natural language, and access MATLAB documentation seamlessly.255Apache 2.0
- AlicenseAqualityBmaintenanceMCP server that connects any AI agent to MATLAB — execute code, async jobs, interactive Plotly plots, custom tools, and monitoring dashboard205MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to control MATLAB Simulink models through natural language, providing tools for model creation, block management, wiring, simulation, and more via a local MCP backend.3MIT