Labsco
matlab logo

MATLAB MCP Core Server

1,100

from matlab

Run MATLAB® using AI applications with the official MATLAB MCP Server from MathWorks®.

🔥🔥🔥🔥✓ VerifiedFreeAdvanced setup

MATLAB MCP Server

<p align="center"> English • <a href="l10n/README.es.md">Español</a> • <a href="l10n/README.ja.md">日本語</a> • <a href="l10n/README.ko.md">한국어</a> • <a href="l10n/README.zh-cn.md">简体中文</a> </p>

[!WARNING] As of v0.11.0, MATLAB MCP Core Server has been renamed to MATLAB MCP Server. To use the latest version of the server after this change, you must update your settings.

ChangesAction Required
Binary names<br>New format: matlab-mcp-server-<os>-<arch>[.exe]<br>Example: matlab-mcp-server-windows-x64.exeUpdate the binary name in the configuration settings of your AI application, usually a .json file.
Toolbox<br> Updated and renamed: MATLAB MCP Core Server ToolboxMATLAB MCP Server ToolboxInstall the latest version of the toolbox by running ./matlab-mcp-server --setup-matlab. You require the toolbox to connect to existing MATLAB sessions. For details, see matlab-session-mode in the Arguments section.
Repository URL<br>github.com/matlab/matlab-mcp-core-servergithub.com/matlab/matlab-mcp-serverNone. GitHub redirects automatically.
MCP Bundle<br>Updated and renamed: matlab-mcp-core-server.mcpbmatlab-mcp-server.mcpbIf you used the MATLAB MCP bundle to install the MCP server in Claude Desktop prior to v0.11.0, first uninstall the server, then download the new matlab-mcp-server.mcpb bundle from the Latest Release page and use it re-install the server. For details, see the section on Claude Desktop.
Go module<br>github.com/matlab/matlab-mcp-core-servergithub.com/matlab/matlab-mcp-serverIf you are using the MATLAB MCP Core Server module in a Go project, update the module name in go.mod and your import declarations.

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

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 .json file).
  • 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-root becomes the environment variable MW_MCP_SERVER_MATLAB_ROOT. CLI flags take precedence over environment variables, if you use both.
ArgumentDescriptionExample
helpDisplays help information for all arguments.--help
versionDisplays the version of the MATLAB MCP Server.--version
matlab-rootFull 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.Windows: --matlab-root=C:\\Program Files\\MATLAB\\R2026a <br><br> Linux/macOS: --matlab-root=/home/usr/MATLAB/R2026a<br><br>As an environment variable: MW_MCP_SERVER_MATLAB_ROOT=/home/usr/MATLAB/R2026a
initialize-matlab-on-startupTo 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-folderSpecify 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: <br> <ul><li>Linux: /home/username </li><li> Windows: C:\Users\username\Documents</li><li>Mac: /Users/username/Documents</li></ul>Windows: --initial-working-folder=C:\\Users\\username\\MyProject <br><br> Linux/macOS: --initial-working-folder=/Users/username/MyProject
matlab-display-modeSpecify whether to show the MATLAB desktop. Use desktop mode (default) to show the MATLAB desktop. Use nodesktop mode to use MATLAB only from your AI application, without the MATLAB desktop. Note that in nodesktop mode, commands requiring a graphical interface (such as edit, open, open_system, uifigure, and appdesigner) will still open MATLAB windows on your desktop.--matlab-display-mode=nodesktop
matlab-session-modeSpecify whether the MCP server starts a new MATLAB or connects to an existing MATLAB session (supported for MATLAB R2023a onwards). The default is auto mode.<br><br> new mode: The MCP server starts a new MATLAB session. <br><br>auto mode (default): The server tries to connect to an existing MATLAB session, which you must have configured for existing mode using the instructions below. If the server is unable to find an existing MATLAB session, it starts a new one. <br><br>existing mode: The server tries to connect to an existing MATLAB session. You must have configured your MATLAB session beforehand to use this mode, with these steps:<br><br><ol><li>If you are using existing mode for the first time, run ./matlab-mcp-server --setup-matlab.<br><br>This command installs an add-on named MATLAB MCP Server Toolbox in MATLAB. You can customize the command with other arguments from this table. For example, to specify which MATLAB to use to install the toolbox, you can use ./matlab-mcp-server --setup-matlab --matlab-root=/home/usr/MATLAB/R2026a.<br><br>For Claude Desktop, you must download the MATLAB MCP Server binary using the instructions in Setup before you run ./matlab-mcp-server --setup-matlab.<br><br></li><li>In the command window of a running MATLAB session, run shareMATLABSession(). The MCP server will connect to this MATLAB when you start the server with --matlab-session-mode=existing or --matlab-session-mode=auto. If you are running multiple MATLAB sessions, the server connects to the MATLAB session where you most recently ran the command shareMATLABSession().<br><br>As an alternative to running shareMATLABSession() manually, you can add the command to your MATLAB Startup Script (MathWorks).</li></ol>--matlab-session-mode=existing
extension-fileTo 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.<br><br>Windows: --extension-file=C:\\Users\\name\\my-tools.json <br><br> Linux/macOS: --extension-file=/path/to/my-tools.json <br><br> Using multiple extension files:<br><br>Windows:--extension-file=C:\\path\\to\\tools-1.json --extension-file=C:\\path\\to\\tools-2.json<br><br>Linux/macOS:--extension-file=/path/to/tools1.json --extension-file=/path/to/tools2.json <br><br> Using environment variables: <br><br> Windows: MW_MCP_SERVER_EXTENSION_FILE=C:\Users\name\tools1.json;C:\Users\name\tools2.json <br><br> Linux/macOS: MW_MCP_SERVER_EXTENSION_FILE=/path/to/tools1.json:/path/to/tools2.json
log-folderSpecify 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-folder=C:\\Users\\name\\AppData\\Local\\Temp <br><br> Linux/macOS: --log-folder=/tmp/my-logs
log-levelThe log levels of the MCP server. Valid values, in order of decreasing verbosity, are debug, info, warn, and error.--log-level=debug
disable-telemetryTo disable anonymized data collection, set this argument to true. For details, see Data Collection.--disable-telemetry=true

Tools

  1. detect_matlab_toolboxes

    • Returns information about installed MATLAB and toolboxes, including version numbers.
  2. 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 valid .m file. The file is not modified during analysis. Example: C:\Users\username\matlab\myFunction.m or /home/user/scripts/analysis.m.
  3. 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 your project directory. MATLAB sets this directory as the current working folder. Example: C:\Users\username\matlab-project or /home/user/research.
  4. 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 .m file. Example: C:\Users\username\projects\analysis.m or /home/user/matlab/simulation.m.
  5. 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 .m file containing MATLAB unit tests. Example: C:\Users\username\tests\testMyFunction.m or /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.

  1. 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)
  2. plain_text_live_code_guidelines

    • Provides rules and guidelines for generating live scripts using the plain text Live Code .m file 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)

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).

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.