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]
Generate mermaid diagram and chart with AI MCP dynamically.
A collection of reference implementations for the Model Context Protocol (MCP), showcasing various MCP servers implemented with TypeScript and Python SDKs.
Analyze images using OpenRouter's vision models. Requires an OpenRouter API key.
Analyzes Unreal Engine source code to provide context for AI assistants.
Captures and manages stdout logs from multiple processes via a named pipe system for real-time debugging and analysis.
Provides interactive user feedback and command execution for AI-assisted development.
An agentic communication framework for multi-agent collaboration using MCP.
A gateway server that intelligently routes MCP requests to multiple backend servers based on external configuration.
Monitors shadow-cljs builds and provides real-time build status updates.
A Ruby gem for integrating Large Language Models (LLMs) via the Model Context Protocol (MCP) into development workflows.