Run MATLAB® using AI applications with the official MATLAB MCP Server from MathWorks®. The MATLAB MCP Core Server allows your AI applications to:
- Start and quit MATLAB.
- Write and run MATLAB code.
- Assess your MATLAB code for style and correctness.
-
Install MATLAB (MathWorks) 2020b or later and add it to the system PATH.
-
For Windows or Linux, download the Latest Release from GitHub®. Alternatively, you can install Go and build the binary from source:
Building from Source:
# Clone the repository git clone https://github.com/matlab/matlab-mcp-core-server.git cd matlab-mcp-core-server # Download resources (including VMC block help for Vitis Model Composer support) make update-resources # Build for all platforms make build # Or install directly with go install (without VMC support) go install github.com/matlab/matlab-mcp-core-server/cmd/matlab-mcp-core-server@latest
Note: If you plan to use Vitis Model Composer features, you must run
make update-resourcesbefore building to download the VMC block help documentation (260+ markdown files, ~2MB).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-core-server https://github.com/matlab/matlab-mcp-core-server/releases/latest/download/matlab-mcp-core-server-maca64 - For Intel processors, run:
curl -L -o ~/Downloads/matlab-mcp-core-server https://github.com/matlab/matlab-mcp-core-server/releases/latest/download/matlab-mcp-core-server-maci64
Then grant executable permissions to the downloaded binary so you can run the MATLAB MCP Core Server:
chmod +x ~/Downloads/matlab-mcp-core-server - For Apple silicon processors, run:
-
Add the MATLAB MCP Core 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.
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-core-server-binary [arguments...]You can customize the server by specifying optional Arguments:
claude mcp add --transport stdio matlab /fullpath/to/matlab-mcp-core-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 matlabFollow the instructions on the page Connect to local MCP servers (MCP) to install Node.js and the Filesystem Server. These are required to allow Claude to create files on your filesystem that MATLAB can access. In your Claude Desktop configuration file, you need to add the configuration for the MATLAB MCP Core Server as well as the Filesystem Server. You can use the combined JSON below. In the Filesystem args, remember to specify which paths the server can access. In the MATLAB args, remember to insert the full path to the server binary you acquired, as well as any other Arguments. (Note that on Windows, your paths require extra backslashes as escape characters).
{ "mcpServers": { "filesystem": { "command": "npx", "args": [ "-y", "@modelcontextprotocol/server-filesystem", "C:\\Users\\username" ] }, "matlab": { "command": "C:\\fullpath\\to\\matlab-mcp-core-server-binary", "args": [ "--initial-working-folder=C:\\Users\\username\\Documents" ] } } }After saving the configuration file, quit Claude Desktop by clicking File > Exit, then restart Claude Desktop.
VS Code provides different methods to Add an MCP Server (VS Code). MathWorks recommends you follow the steps in the section "Add an MCP server to a workspace mcp.json file". In your mcp.json configuration file, add the following, remembering to insert the full path to the server binary you acquired in the setup, as well as any Arguments:
{ "servers": { "matlab": { "type": "stdio", "command": "/fullpath/to/matlab-mcp-core-server-binary", "args": [] } } }Customize the behavior of the server by providing arguments in the args array when configuring your AI application.
| Argument | Description | Example |
|---|---|---|
| matlab-root | Full path specifying which MATLAB to start. Do not include /bin in the path. By default, the server tries to find the first MATLAB on the system PATH. | "--matlab-root=/home/usr/MATLAB/R2025a" |
| vmc-root | Full path to Vitis Model Composer installation. When specified, launches Model Composer instead of standard MATLAB. Enables FPGA/SoC development with VMC toolchain. | "--vmc-root=/tools/Xilinx/Vitis_Model_Composer/2024.2" |
| initialize-matlab-on-startup | To initialize MATLAB as soon as you start the server, set this argument to true. By default, MATLAB only starts when the first tool is called. | "--initialize-matlab-on-startup=true" |
| initial-working-folder | Specify the folder where MATLAB starts and where the server generates any MATLAB scripts. If you do not provide the argument, MATLAB starts in these locations:
| "--initial-working-folder=C:\\Users\\name\\MyProject" |
| disable-telemetry | To disable anonymized data collection, set this argument to true. For details, see Data Collection. | "--disable-telemetry=true" |
-
detect_matlab_toolboxes- Lists installed MATLAB toolboxes with version information.
-
check_matlab_code- Performs 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.mfile within an allowed directory. The file is not modified during analysis. Example:C:\Users\username\matlab\myFunction.mor/home/user/scripts/analysis.m.
-
evaluate_matlab_code- Evaluates a string of MATLAB code and returns the output.
- Inputs:
code(string): MATLAB code to evaluate.project_path(string): Absolute path to an allowed project directory. MATLAB sets this directory as the current working folder. Example:C:\Users\username\matlab-projector/home/user/research.
-
run_matlab_file- Executes 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 within an allowed directory. Example:C:\Users\username\projects\analysis.mor/home/user/matlab/simulation.m.
- Executes a MATLAB script and returns the output. The script must be a valid
-
run_matlab_test_file- Executes 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, within an allowed directory. Example:C:\Users\username\tests\testMyFunction.mor/home/user/matlab/tests/test_analysis.m.
-
query_vmc_block_help- Searches and retrieves documentation for Vitis Model Composer (VMC) blocks by name. Returns detailed information including block parameters, usage examples, and Simulink library locations. Supports fuzzy matching across AIE, HDL, HLS, and utility domains.
- Inputs:
block_name(string): Name of the VMC block to search for (e.g., 'FFT', 'FIR_Compiler', 'AIE_DDS'). Supports partial names and fuzzy matching.
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_guidelines- Provides 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://coding - MIME Type:
text/markdown - Source: MATLAB Coding Standards (GitHub)
-
plain_text_live_code_guidelines- Provides 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-code - MIME Type:
text/markdown - Source: Plain Text Live Code Generation (GitHub)
- Provides rules and guidelines for generating live scripts using the plain text Live Code
-
vmc_block_help- Comprehensive documentation for 260+ Vitis Model Composer blocks across AIE, HDL, HLS, and utility domains. Includes block parameters, usage examples, and Simulink library locations for AI-assisted VMC model development.
- URI:
vmc-help://blocks - MIME Type:
text/markdown
-
vmc_hub_api- Complete reference for vmchub_get_param/vmchub_set_param APIs with all 38 Hub block parameters, data type handling, and usage examples. Essential for VMC model configuration and automation.
- URI:
vmc-hub://api-examples - MIME Type:
text/markdown
The MATLAB MCP Core 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.
When using the MATLAB MCP Core 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).
Copyright 2025 The MathWorks, Inc.