MATLAB MCP Server
Provides MATLAB integration for Amp, allowing code execution, workspace management, plotting, and data handling.
Enables MATLAB operations such as running scripts, managing variables, handling figures, and data import/export within VS Code's Copilot chat.
Integrates MATLAB capabilities into Warp terminal, enabling scientific computing and data analysis tasks.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MATLAB MCP Serverplot sin(x) and save as sine.png"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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.
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
uvpackage manager installed (install uv)
Installation
Choose your MCP client below for setup instructions:
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-serverScope 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 matlabConfiguration File Location:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.jsonLinux:
~/.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:
Create or edit the config file at the location above
Add your MCP server configuration with correct MATLAB path
Restart Claude Desktop completely (quit and reopen)
Look for the MCP server icon (🔨) in Claude Desktop interface
UI Configuration:
Go to Cursor Settings → MCP → Add new MCP Server:
Name:
matlabCommand:
uvx matlab-mcp-serverClick
Editto add environment variables
Configuration File Location:
macOS:
~/Library/Application Support/Cursor/mcp_config.jsonWindows:
%APPDATA%\Cursor\mcp_config.jsonLinux:
~/.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:
Create
mcp_config.jsonif it doesn't existAdd MCP server configuration
Restart Cursor completely
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:
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:
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 | bashThe 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-serverfrom PyPIInstall
matlabengineand all dependenciesStart 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-server3. 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/maca64macOS (Intel):
DYLD_LIBRARY_PATH→/Applications/MATLAB_R20XXx.app/bin/maci64Linux:
LD_LIBRARY_PATH→/usr/local/MATLAB/R20XXx/bin/glnxa64Windows: 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 resultsworkspace- 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 toolboxesget_help- Access MATLAB documentation and search functionsroute_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:
Ensure MATLAB is properly installed
Verify MATLAB Engine API for Python is installed
Check Python version matches MATLAB compatibility
Verify library path is correctly set in config
Library Path Issues
Default MATLAB locations:
macOS:
/Applications/MATLAB_R20XXx.appLinux:
/usr/local/MATLAB/R20XXxWindows:
C:\Program Files\MATLAB\R20XXx
If MATLAB is in a non-standard location, update the library path in your config.
Documentation
CONTRIBUTING.md - Development setup and guidelines
PLANNING.md - Roadmap and architecture
MATLAB_MCP_GUIDE.md - Detailed usage guide
TOOLS.md - Tool catalog
License
MIT License
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for development setup and guidelines.
Star History
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/iflow-mcp/subspace-lab-matlab-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server