matlab/matlab-mcp-core-server
GitHub: matlab/matlab-mcp-core-server
MathWorks官方推出的MCP服务器,让Claude、VS Code Copilot等AI应用能够直接调用本地MATLAB执行代码、分析代码质量和运行测试。
Stars: 216 | Forks: 28
# MATLAB MCP Core Server
使用 MathWorks® 官方的 MATLAB MCP Server,通过 AI 应用程序运行 MATLAB®。MATLAB MCP Core Server 允许您的 AI 应用程序:
- 启动和退出 MATLAB。
- 编写并运行 MATLAB 代码。
- 评估 MATLAB 代码的风格和正确性。
## 目录
- [设置](#setup)
- [Claude Code](#claude-code)
- [Claude Desktop](#claude-desktop)
- [Visual Studio Code 中的 GitHub Copilot](#github-copilot-in-visual-studio-code)
- [参数](#arguments)
- [工具](#tools)
- [资源](#resources)
- [数据收集](#data-collection)
## 设置
1. 安装 [MATLAB (MathWorks)](https://www.mathworks.com/help/install/ug/install-products-with-internet-connection.html) 2020b 或更高版本,并将其添加到系统 PATH 中。
2. 对于 Windows 或 Linux,[**下载最新版本**](https://github.com/matlab/matlab-mcp-core-server/releases/latest)。(或者,您可以**从源代码构建**:安装 [Go](https://go.dev/doc/install) 并使用 `go install github.com/matlab/matlab-mcp-core-server/cmd/matlab-mcp-core-server@latest` 构建二进制文件)。
对于 macOS,首先在终端中运行以下命令下载最新版本:
- 对于 Apple silicon 处理器,运行:
curl -L -o ~/Downloads/matlab-mcp-core-server https://github.com/matlab/matlab-mcp-core-server/releases/latest/download/matlab-mcp-core-server-maca64
- 对于 Intel 处理器,运行:
curl -L -o ~/Downloads/matlab-mcp-core-server https://github.com/matlab/matlab-mcp-core-server/releases/latest/download/matlab-mcp-core-server-maci64
然后授予下载的二进制文件可执行权限,以便您可以运行 MATLAB MCP Core Server:
chmod +x ~/Downloads/matlab-mcp-core-server
3. 将 MATLAB MCP Core Server 添加到您的 AI 应用程序中。您可以在 AI 应用程序的文档中找到添加 MCP server 的说明。例如,关于使用 Claude Code®、Claude Desktop® 和 Visual Studio® Code 中的 GitHub Copilot 的说明,请参见下文。请注意,您可以通过指定可选的 [参数](#arguments) 来自定义服务器。
### Claude Code
在终端中运行以下命令,记得插入您在设置中获取的服务器二进制文件的完整路径:
```
claude mcp add --transport stdio matlab -- /fullpath/to/matlab-mcp-core-server-binary
```
您可以通过指定可选的 [参数](#arguments) 来自定义服务器。注意 Claude Code 的选项与服务器参数之间的 `--` 分隔符:
```
claude mcp add --transport stdio matlab -- /fullpath/to/matlab-mcp-core-server-binary --initial-working-folder=/home/username/myproject
```
有关在 Claude Code 中添加 MCP server 的详细信息,请参阅 [Add a local stdio server (Claude Code)](https://docs.claude.com/en/docs/claude-code/mcp#option-3%3A-add-a-local-stdio-server)。若要稍后移除服务器,请运行:
```
claude mcp remove matlab
```
### Claude Desktop
您使用 MATLAB MCP Core Server 包在 Claude Desktop 中安装 MATLAB MCP Core Server。
1. 在 Claude Desktop 中安装 Filesystem 扩展,以允许 Claude 读取和写入您系统上的文件。在 Claude Desktop 中,点击 **Settings > Extensions> Browse extensions**。搜索由 Anthropic 开发的 Filesystem 扩展并点击 **Install**。指定您希望允许 MCP server 访问的文件夹,然后将 **Disable** 按钮切换为 **Enable** 以启用 Filesystem 扩展。
2. 从 [Latest Release](https://github.com/matlab/matlab-mcp-core-server/releases/latest) 页面下载 MATLAB MCP Core Server 包 `matlab-mcp-core-server.mcpb`。
3. 要将 MATLAB MCP Core Server 包作为桌面扩展安装,请双击下载的 `matlab-mcp-core-server.mcpb` 文件,然后在 Claude Desktop 中点击 **Install**。(或者,在 Claude 中导航至 **File menu > Settings > Extensions > Advanced Settings > Install Extension** 并选择 `matlab-mcp-core-server.mcpb` 文件。点击 **Install**)。
要自定义 MATLAB MCP Core Server 的行为和 [参数](#arguments),请点击 **Configure**,然后点击 **Close Preview**。您可以通过导航至 **Settings > Extensions > Configure** 返回此页面。 ### Visual Studio Code 中的 GitHub Copilot VS Code 提供了不同的方法来 [Add an MCP Server (VS Code)](https://code.visualstudio.com/docs/copilot/customization/mcp-servers?wt.md_id=AZ-MVP-5004796#_add-an-mcp-server)。MathWorks 建议您按照 **"Add an MCP server to a workspace `mcp.json` file"** 部分中的步骤操作。在您的 `mcp.json` 配置文件中,添加以下内容,记得插入您在设置中获取的服务器二进制文件的完整路径,以及任何 [参数](#arguments): ``` { "servers": { "matlab": { "type": "stdio", "command": "/fullpath/to/matlab-mcp-core-server-binary", "args": [] } } } ``` ## 参数 在配置 AI 应用程序时,通过在 `args` 数组中提供参数来自定义服务器的行为。 | Argument | Description | Example | | ------------- | ------------- | ------------- | | matlab-root | 指定要启动哪个 MATLAB 的完整路径。不要在路径中包含 `/bin`。默认情况下,服务器会尝试在系统 PATH 中找到第一个 MATLAB。 | `"--matlab-root=/home/usr/MATLAB/R2025a"` | | initialize-matlab-on-startup | 要在启动服务器时立即初始化 MATLAB,请将此参数设置为 `true`。默认情况下,MATLAB 仅在调用第一个工具时启动。 | `"--initialize-matlab-on-startup=true"` | | initial-working-folder | 指定 MATLAB 启动的文件夹。如果您不提供此参数,MATLAB 将在以下位置启动:
要自定义 MATLAB MCP Core Server 的行为和 [参数](#arguments),请点击 **Configure**,然后点击 **Close Preview**。您可以通过导航至 **Settings > Extensions > Configure** 返回此页面。 ### Visual Studio Code 中的 GitHub Copilot VS Code 提供了不同的方法来 [Add an MCP Server (VS Code)](https://code.visualstudio.com/docs/copilot/customization/mcp-servers?wt.md_id=AZ-MVP-5004796#_add-an-mcp-server)。MathWorks 建议您按照 **"Add an MCP server to a workspace `mcp.json` file"** 部分中的步骤操作。在您的 `mcp.json` 配置文件中,添加以下内容,记得插入您在设置中获取的服务器二进制文件的完整路径,以及任何 [参数](#arguments): ``` { "servers": { "matlab": { "type": "stdio", "command": "/fullpath/to/matlab-mcp-core-server-binary", "args": [] } } } ``` ## 参数 在配置 AI 应用程序时,通过在 `args` 数组中提供参数来自定义服务器的行为。 | Argument | Description | Example | | ------------- | ------------- | ------------- | | matlab-root | 指定要启动哪个 MATLAB 的完整路径。不要在路径中包含 `/bin`。默认情况下,服务器会尝试在系统 PATH 中找到第一个 MATLAB。 | `"--matlab-root=/home/usr/MATLAB/R2025a"` | | initialize-matlab-on-startup | 要在启动服务器时立即初始化 MATLAB,请将此参数设置为 `true`。默认情况下,MATLAB 仅在调用第一个工具时启动。 | `"--initialize-matlab-on-startup=true"` | | initial-working-folder | 指定 MATLAB 启动的文件夹。如果您不提供此参数,MATLAB 将在以下位置启动:
- Linux: `/home/username`
- Windows: `C:\Users\username\Documents`
- Mac: `/Users/username/Documents`
标签:AI应用, Claude, CVE检测, EVTX分析, GitHub Copilot, Go语言, MathWorks, MATLAB, MCP Server, Subfinder, Visual Studio Code, 代码助手, 代码审查, 代码示例, 代码运行, 数据分析, 日志审计, 模型上下文协议, 科学计算, 程序破解, 编程工具, 脚本执行, 自动化执行, 远程代码执行, 集成开发环境