
MATLAB MCP Server
io.github.matlab由 GitHub 账号 matlab 发布v0.16.0更新于 Nov 3, 2026
将 AI 编码代理连接到 MATLAB。通过 MCP 运行代码、测试和分析。
AI 翻译由 AI 模型根据下方的原文描述翻译,可能有误。
原文描述
Connect AI coding agents to MATLAB. Run code, tests, and analysis via MCP.
概览
MATLAB 的本地 MCP 服务;无需登录;STDIO。
暂无 AI 概览:以下信息来自注册中心条目和服务本身。
安装
在 SourceWeft 中
- 打开 控制台中的 MATLAB MCP Server,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
MATLAB MCP Server
English • Español • 日本語 • 한국어 • 简体中文
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.
If you use Claude Code®, GitHub® Copilot CLI, or OpenAI® Codex, MathWorks recommends you install this MCP server using the Agentic Toolkit Installer (GitHub), which is the easiest way to configure these AI coding agents to use MATLAB and Simulink.
Otherwise, you can install this MCP server manually using the instructions for Manual Setup.
Table of Contents
- Manual Setup
- Arguments
- Tools
- Resources
- Data Collection
- Security Considerations
- Licensing and Usage
- Contact Support
Manual Setup
To set up the MATLAB MCP Server manually, rather than using the Agentic Toolkit Installer (GitHub), follow these instructions:
-
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:
- For Intel processors, run:
Then grant executable permissions to the downloaded binary so you can run the 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:
You can customize the server by specifying optional Arguments. Note the -- separator between Claude Code's options and the server arguments:
For details on adding MCP servers in Claude Code, see Add a local stdio server (Claude Code). To remove the server later, run:
Claude 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).
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:
You can customize the server by specifying optional Arguments. For example:
[!NOTE] Windows users: Codex does not forward the
WINDIRenvironment 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 addenv_vars = ["WINDIR"]to the[mcp_servers.matlab]section:
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.
Tools
-
detect_matlab_toolboxes- Returns information about installed MATLAB and toolboxes, including version numbers.
-
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.mfile. 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 your 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 MATLAB source file (
.m) or P-code file (.p). If a MATLAB source file (.m) and a P-code file (.p) have the same name and are in the same folder, MATLAB runs the.pfile. - Inputs:
script_path(string): Absolute path to the MATLAB script file to execute. Must be a valid MATLAB source file (.m) or P-code file (.p). 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 MATLAB source file (
-
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 MATLAB source file (.m) or P-code file (.p) 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_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
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.
来源:README.md,提交 3c06d3e
工具
0版本历史
2- v0.16.0最新Nov 3, 2026
- v0.13.1Sep 18, 2026
评分
已满足适用检查项的 40%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分
请在仓库或注册中心条目中声明许可证。