create_matlab_scriptLABSCO SUMMARY
Figures and workspace variables come back, not just stdout.
That is what makes it usable for real analysis: a plot is the answer to most MATLAB questions, and here it lands in the conversation instead of in a window you have to go look at. The Python version is the constraint to check first — 3.11, because the MATLAB Engine does not support anything newer.
What it is
A server that talks to a local MATLAB install through the MATLAB Engine, saving scripts to disk and executing them.
What you get
- create_matlab_script writes a new .m script into the matlab_scripts directory
- create_matlab_function writes a function file, with the definition validated
- execute_matlab_script runs a script and returns its output text, the figures it generated, and the workspace variables — arguments can be passed in
- call_matlab_function calls a function with arguments and returns its output and any figures
- Scripts persist on disk under matlab_scripts, so a script written in one session is still there in the next
Requirements
A local MATLAB install — MATLAB R2024a or a compatible version — and Python 3.11, since the MATLAB Engine does not support 3.12 or 3.13. uv manages the environment; MATLAB_PATH points at the installation and defaults to /Applications/MATLAB_R2024a.app. The Engine installs itself on first run from that path.
Setup effort
One command — uvx matlab-mcp
USE CASES
Getting a plot out of some data
Have the script written and run in one step; the figure comes back with the output.
Testing a function you are writing
Write the function file, then call it with arguments and read the result and figures.
Checking what a computation left in the workspace
Execution returns the workspace variables alongside the printed output.
Building up an analysis over several sessions
Scripts are saved as .m files under matlab_scripts, so yesterday's work is still on disk.
4 tools
Listed in project docs. Your client may show a different list.
create_matlab_functionexecute_matlab_scriptcall_matlab_functionBEFORE YOU INSTALL
What to know first
Tools you get
4 tools named in the project's documentation.
Requires
- uvx on PATH
- Python 3.11
Where it runs
The documented client runs the server on your machine.
INSTALLATION
Connect your client
Server setup
uvx matlab-mcpMCP Clients
Claude Desktop
{
"mcpServers": {
"matlab": {
"command": "uv",
"args": [
"--directory",
"<YOUR_PATH_TO_MATLAB_MCP>",
"run",
"matlab_server.py"
],
"env": {
"MATLAB_PATH": "/Applications/MATLAB_R2024a.app"
}
}
}
}