MATLAB MCP Server

MATLAB MCP Server

A Model Context Protocol (MCP) server that enables seamless integration between MATLAB and MCP-compatible applications like Claude Code. Execute MATLAB code, manage workspace variables, create plots, handle data I/O, and more - all through a token-efficient MCP interface.

Category
访问服务器

README

MATLAB MCP Server

Ask DeepWiki

A Model Context Protocol (MCP) server that enables seamless integration between MATLAB and MCP-compatible applications like Claude Code. Execute MATLAB code, manage workspace variables, create plots, handle data I/O, and more - all through a token-efficient MCP interface.

Features

  • Execute MATLAB Code: Run MATLAB commands and scripts with persistent session
  • Workspace Management: Get, set, list, and clear workspace variables
  • Figure Operations: Save, export, and close MATLAB figures (PNG, SVG, PDF, etc.)
  • Data I/O: Import/export data (CSV, JSON, XLSX) and load/save MAT files
  • Environment Info: Check MATLAB version and installed toolboxes
  • Documentation Access: Get MATLAB help, search functions, and find toolbox locations
  • Token-Efficient Design: Multi-operation tools minimize API calls
  • JSON Resources: Structured access to workspace, toolboxes, and session info

Quick Start

Prerequisites:

  • MATLAB installed on your system
  • uv package manager installed (install uv)

Installation

Choose your MCP client below for setup instructions:

<details> <summary><b>Claude Code</b> (CLI)</summary>

Using CLI (Recommended):

# macOS (Apple Silicon)
claude mcp add --transport stdio matlab \
  --env DYLD_LIBRARY_PATH=/Applications/MATLAB_R2025b.app/bin/maca64 \
  -- uvx matlab-mcp-server

# macOS (Intel)
claude mcp add --transport stdio matlab \
  --env DYLD_LIBRARY_PATH=/Applications/MATLAB_R2025b.app/bin/maci64 \
  -- uvx matlab-mcp-server

# Linux
claude mcp add --transport stdio matlab \
  --env LD_LIBRARY_PATH=/usr/local/MATLAB/R2024b/bin/glnxa64 \
  -- uvx matlab-mcp-server

Scope options:

  • Default (local): Private to you, only this project
  • --scope project: Share with team (stores in .mcp.json, can be committed to git)
  • --scope user: Available across all your projects

Manual configuration (.mcp.json in project root):

{
  "mcpServers": {
    "matlab": {
      "command": "uvx",
      "args": ["matlab-mcp-server"],
      "env": {
        "DYLD_LIBRARY_PATH": "/Applications/MATLAB_R2025b.app/bin/maca64"
      }
    }
  }
}

Replace with your MATLAB path. Use LD_LIBRARY_PATH for Linux.

Verify:

claude mcp list
claude mcp info matlab

</details>

<details> <summary><b>Claude Desktop</b></summary>

Configuration File Location:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

Configuration:

{
  "mcpServers": {
    "matlab": {
      "command": "uvx",
      "args": ["matlab-mcp-server"],
      "env": {
        "DYLD_LIBRARY_PATH": "/Applications/MATLAB_R2025b.app/bin/maca64"
      }
    }
  }
}

Platform-specific environment variables:

  • macOS (Apple Silicon): "DYLD_LIBRARY_PATH": "/Applications/MATLAB_R2025b.app/bin/maca64"
  • macOS (Intel): "DYLD_LIBRARY_PATH": "/Applications/MATLAB_R2025b.app/bin/maci64"
  • Linux: "LD_LIBRARY_PATH": "/usr/local/MATLAB/R2024b/bin/glnxa64"
  • Windows: Usually not needed (installer handles library paths)

Steps:

  1. Create or edit the config file at the location above
  2. Add your MCP server configuration with correct MATLAB path
  3. Restart Claude Desktop completely (quit and reopen)
  4. Look for the MCP server icon (🔨) in Claude Desktop interface

</details>

<details> <summary><b>Cursor</b></summary>

UI Configuration:

Go to Cursor SettingsMCPAdd new MCP Server:

  • Name: matlab
  • Command: uvx matlab-mcp-server
  • Click Edit to add environment variables

Configuration File Location:

  • macOS: ~/Library/Application Support/Cursor/mcp_config.json
  • Windows: %APPDATA%\Cursor\mcp_config.json
  • Linux: ~/.config/Cursor/mcp_config.json

Configuration:

{
  "mcpServers": {
    "matlab": {
      "command": "uvx",
      "args": ["matlab-mcp-server"],
      "env": {
        "DYLD_LIBRARY_PATH": "/Applications/MATLAB_R2025b.app/bin/maca64"
      }
    }
  }
}

Replace with your MATLAB path (see Claude Desktop section for platform-specific paths).

Steps:

  1. Create mcp_config.json if it doesn't exist
  2. Add MCP server configuration
  3. Restart Cursor completely

</details>

<details> <summary><b>VS Code</b> (GitHub Copilot)</summary>

VS Code Settings (User or Workspace):

{
  "github.copilot.chat.mcp.servers": {
    "matlab": {
      "command": "uvx",
      "args": ["matlab-mcp-server"],
      "env": {
        "DYLD_LIBRARY_PATH": "/Applications/MATLAB_R2025b.app/bin/maca64"
      }
    }
  }
}

CLI Installation:

# macOS (Apple Silicon)
code --add-mcp '{"name":"matlab","command":"uvx","args":["matlab-mcp-server"],"env":{"DYLD_LIBRARY_PATH":"/Applications/MATLAB_R2025b.app/bin/maca64"}}'

# Linux
code --add-mcp '{"name":"matlab","command":"uvx","args":["matlab-mcp-server"],"env":{"LD_LIBRARY_PATH":"/usr/local/MATLAB/R2024b/bin/glnxa64"}}'

Replace with your MATLAB path (see Claude Desktop section for platform-specific paths).

Resources:

</details>

<details> <summary><b>Codex</b></summary>

CLI:

codex mcp add matlab uvx "matlab-mcp-server"

Then manually edit ~/.codex/config.toml to add environment variables:

Edit ~/.codex/config.toml:

[mcp_servers.matlab]
command = "uvx"
args = ["matlab-mcp-server"]

[mcp_servers.matlab.env]
DYLD_LIBRARY_PATH = "/Applications/MATLAB_R2025b.app/bin/maca64"

Platform-specific environment variables:

  • macOS (Apple Silicon): DYLD_LIBRARY_PATH = "/Applications/MATLAB_R2025b.app/bin/maca64"
  • macOS (Intel): DYLD_LIBRARY_PATH = "/Applications/MATLAB_R2025b.app/bin/maci64"
  • Linux: LD_LIBRARY_PATH = "/usr/local/MATLAB/R2024b/bin/glnxa64"

Resources:

</details>

For 11 additional clients (Windsurf, Continue, Amp, Cline, Gemini CLI, Goose, Kiro, LM Studio, opencode, Qodo Gen, Warp), see Complete Setup Guide →

Finding Your MATLAB Library Path

If you don't know your MATLAB library path, use the configuration helper:

curl -fsSL https://raw.githubusercontent.com/subspace-lab/matlab-mcp-server/main/install-matlab-mcp.sh | bash

The script will:

  • Auto-detect your MATLAB installation
  • Display the config with the correct paths
  • You copy and paste it into your MCP client's config file

That's it! When your MCP client starts, uvx will automatically:

  • Download matlab-mcp-server from PyPI
  • Install matlabengine and all dependencies
  • Start the MATLAB MCP server

Manual Installation

If you prefer to install manually or the automated installer doesn't work:

1. Install matlabengine

# Navigate to your MATLAB Python engine directory
cd /Applications/MATLAB_R20XXx.app/extern/engines/python  # macOS
# OR
cd /usr/local/MATLAB/R20XXx/extern/engines/python  # Linux

# Install using uv
uv pip install .

Replace R20XXx with your MATLAB version (e.g., R2024a, R2024b, R2025a).

2. Install matlab-mcp-server

uv pip install matlab-mcp-server

3. Configure MCP server

Follow the configuration instructions for your MCP client in the sections above. Use matlab-mcp as the command instead of uvx matlab-mcp-server.

Example for Claude Code (.mcp.json in project root):

{
  "mcpServers": {
    "matlab": {
      "command": "matlab-mcp",
      "env": {
        "DYLD_LIBRARY_PATH": "/Applications/MATLAB_R2025b.app/bin/maca64"
      }
    }
  }
}

Replace with your MATLAB path:

  • macOS (Apple Silicon): DYLD_LIBRARY_PATH/Applications/MATLAB_R20XXx.app/bin/maca64
  • macOS (Intel): DYLD_LIBRARY_PATH/Applications/MATLAB_R20XXx.app/bin/maci64
  • Linux: LD_LIBRARY_PATH/usr/local/MATLAB/R20XXx/bin/glnxa64
  • Windows: Usually not needed

For other MCP clients, see configuration sections above or MCP_CLIENT_SETUP.md

Available Tools

The server provides 8 MCP tools for interacting with MATLAB:

  • execute_matlab - Execute MATLAB code and get results
  • workspace - Manage workspace variables (get, set, list, clear)
  • figure - Save, export, and manage MATLAB figures (PNG, SVG, PDF, etc.)
  • data_io - Import/export data in various formats (CSV, JSON, XLSX, MAT files)
  • env - Get MATLAB version and check installed toolboxes
  • get_help - Access MATLAB documentation and search functions
  • route_intent - Suggest appropriate tool mode (meta-tool)
  • select_mode - Enable optional tool groups (meta-tool)

For detailed documentation on each tool, see TOOLS.md or MATLAB_MCP_GUIDE.md.

Troubleshooting

MATLAB Engine Not Found

If you get an error about MATLAB engine not being found:

  1. Ensure MATLAB is properly installed
  2. Verify MATLAB Engine API for Python is installed
  3. Check Python version matches MATLAB compatibility
  4. Verify library path is correctly set in config

Library Path Issues

Default MATLAB locations:

  • macOS: /Applications/MATLAB_R20XXx.app
  • Linux: /usr/local/MATLAB/R20XXx
  • Windows: C:\Program Files\MATLAB\R20XXx

If MATLAB is in a non-standard location, update the library path in your config.

Documentation

License

MIT License

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for development setup and guidelines.

Star History

Star History Chart

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选