MATLAB Executor MCP Tool
This Model Context Protocol (MCP) tool allows secure execution of MATLAB code through Claude, with security prompts for user approval.
Features
- Execute any MATLAB function, script, or command
- Security prompts with options: Allow Once, Always Allow, or Deny
- Remembers allowed commands during a session
- Path management for MATLAB projects
- Detailed logging of all operations
Installation
Install with uvx:
uvx mcp-matlab-executor
Or install directly from the directory:
cd matlab-executor
uv venv
.venv/Scripts/activate # On Windows
source .venv/bin/activate # On Linux/Mac
pip install -e .
Configuration
Set the MATLAB path using environment variables:
- Set the
MATLAB_PATHenvironment variable to your MATLAB installation's bin directory - Or create a
.envfile with:MATLAB_PATH=C:/Program Files/MATLAB/R2022b/bin
Usage with Claude Desktop
Add to Claude Desktop configuration file:
{
"mcpServers": {
"matlab-executor": {
"command": "uvx",
"args": [
"run", "git+https://github.com/JSFrouws/mcp-matlab-executor.git"
],
"env": {
"MATLAB_PATH": "C:/Program Files/MATLAB/R2022b/bin"
}
}
}
}
Usage Examples
Execute a MATLAB function:
execute_matlab_function("C:/path/to/matlab/project", "result = my_function(10, 'test')")
Run arbitrary MATLAB code:
execute_matlab_function("", "x = 1:10; y = x.^2; plot(x, y); disp('Plotted x^2')")
Execute multiple commands:
execute_matlab_function("", "a = 5; b = 10; c = a + b; disp(['Result: ' num2str(c)])")
Security
A permission dialog appears with each execution request:
- Allow Once: Permit this execution one time
- Always Allow: Remember and allow for the current session
- Deny: Block execution
The tool clearly shows what MATLAB code will be executed and lets you know which option was selected.
Recommend MCP Servers 💡
office-visio-mcp-server
A MCP server for creating and editing Microsoft Visio diagrams programmatically via API
ph0ryn/Discord-webhook-MCP
A MCP server that enables sending messages to Discord via webhook using the Model Context Protocol.
code-sandbox-mcp
A secure sandbox environment for executing code within Docker containers, providing AI applications with isolated code execution.
awslabs.nova-canvas-mcp-server
An MCP server that enables text-based and color-guided image generation using Amazon Nova Canvas, supporting customizable dimensions, quality, and multiple image outputs, with secure AWS authentication and workspace integration.
java-mcp
A Model Context Protocol (MCP) server implemented in Java, configurable for use with clients like Claude Desktop.
MetasploitMCP
A Model Context Protocol (MCP) server that provides a bridge between large language models and the Metasploit Framework penetration testing platform.