Execute MATLAB scripts and functions via MCP clients. Requires a local MATLAB installation.
This Model Context Protocol (MCP) server provides integration with MATLAB, allowing you to create and execute MATLAB scripts and functions through Claude or other MCP clients.
# Pin Python version
uv python pin 3.11
# Create virtual environment
uv venv
# Activate virtual environment
source .venv/bin/activate
# Install MCP
uv add "mcp[cli]"
MATLAB_PATH
environment variable.matlab_server.py
: The main MCP server implementationmatlab_scripts/
: Directory where all MATLAB scripts and functions are saved (created automatically)pyproject.toml
: Python project configuration.python-version
: Specifies Python version for uv# On macOS
code ~/Library/Application\ Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"matlab": {
"command": "uv",
"args": [
"--directory",
"/absolute/path/to/matlab-mcp",
"run",
"matlab_server.py"
],
"env": {
"MATLAB_PATH": "/Applications/MATLAB_R2024a.app"
}
}
}
}
Make sure to:
/absolute/path/to/matlab-mcp
with the actual path to your project directoryMATLAB_PATH
points to your MATLAB installationThe server provides several tools:
create_matlab_script
: Create a new MATLAB script file
matlab_scripts
directorycreate_matlab_function
: Create a new MATLAB function file
matlab_scripts
directoryexecute_matlab_script
: Run a MATLAB script and get results
call_matlab_function
: Call a MATLAB function with arguments
You can test the server using the MCP Inspector:
# Make sure you're in your virtual environment
source .venv/bin/activate
# Run the inspector
MATLAB_PATH=/Applications/MATLAB_R2024a.app mcp dev matlab_server.py
Example test script:
t = 0:0.01:2*pi;
y = sin(t);
plot(t, y);
title('Test Plot');
xlabel('Time');
ylabel('Amplitude');
matlab_scripts
directory<script_name>.m
or <function_name>.m
matlab_server.py
MATLAB_PATH
: Path to your MATLAB installation
/Applications/MATLAB_R2024a.app
MATLAB Engine Installation Fails
cd $MATLAB_PATH/extern/engines/python
python setup.py install
Python Version Issues
python --version
uv python pin 3.11
if neededScript Execution Errors
matlab_scripts
directory existsuv pip install --upgrade mcp[cli]
MCP server for text-to-graphql, integrates with Claude Desktop and Cursor.
An MCP server for managing API test data and resources.
Access and interact with Harness platform data, including pipelines, repositories, logs, and artifact registries.
Interact with the Prefect API for workflow orchestration and management.
MCP server for Autodesk Maya
Create and modify wireframes in the Frame0 app through natural language prompts.
Seamlessly bring real-time production context—logs, metrics, and traces—into your local environment to auto-fix code faster.
A context insertion and search server for Claude Desktop and Cursor IDE, using configurable API endpoints.
An MCP server for the SourceSync.ai API to manage and synchronize source code context.
Provides sarcastic and cynical code reviews from the perspective of a grumpy senior developer.