matlab-mcp-python
v2.1.0MCP server exposing MATLAB capabilities to AI agents
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
execute_code
Execute MATLAB code. Runs the given MATLAB code string in the session's engine. Returns a result dict with status, job_id, output, variables, etc. Note: the ``ExecuteResult`` return annotation drives FastMCP's F6 output-schema generation. At runtime this returns a plain dict matching that schema, or — on MATLAB execution errors — a ``ToolResult(is_error=True)``. FastMCP passes ``ToolResult`` instances through untouched regardless of the declared return type (see ``fastmcp.tools.base.Tool.convert_result``); annotating the return type as a bare union with ``ToolResult`` breaks schema gener…
| Parameter | Type | Description |
|---|---|---|
code * | string |
check_code
Lint MATLAB code using checkcode/mlint. Writes the code to a temporary file and runs mcp_checkcode() on it, returning a list of issues (line, column, message, severity). Note: see ``execute_code`` above for why the return annotation is ``CheckResult`` (not a union with ``ToolResult``).
| Parameter | Type | Description |
|---|---|---|
code * | string |
get_workspace
Get workspace variables for the current session. Runs 'whos' in MATLAB and returns the result.
get_job_status
Get the status of a MATLAB execution job. Returns status, timing info, and optional progress (from .progress file) for running jobs.
| Parameter | Type | Description |
|---|---|---|
job_id * | string |
get_job_result
Get the full result of a completed MATLAB execution job. Returns the result dict for completed jobs, or the error dict for failed jobs.
| Parameter | Type | Description |
|---|---|---|
job_id * | string |
cancel_job
Cancel a pending or running MATLAB execution job. Attempts to cancel the underlying MATLAB future and marks the job as cancelled in the tracker.
| Parameter | Type | Description |
|---|---|---|
job_id * | string |
list_jobs
List all jobs for the current session. Returns a list of job summaries including status and timing.
list_toolboxes
List available MATLAB toolboxes. Runs 'ver' in MATLAB and returns the output along with toolbox configuration info.
list_functions
List functions in a MATLAB toolbox. Runs 'help <toolbox_name>' in MATLAB and returns the output.
| Parameter | Type | Description |
|---|---|---|
toolbox_name * | string |
get_help
Get help text for a MATLAB function. Runs 'help <function_name>' in MATLAB and returns the documentation.
| Parameter | Type | Description |
|---|---|---|
function_name * | string |
upload_data
Upload a data file to the session's temporary directory. The file content should be base64-encoded. The file is written to the session temp dir and can be accessed from MATLAB code.
| Parameter | Type | Description |
|---|---|---|
content_base64 * | string | |
filename * | string |
delete_file
Delete a file from the session's temporary directory. Only files in the session temp directory can be deleted.
| Parameter | Type | Description |
|---|---|---|
filename * | string |
list_files
List files in the session's temporary directory. Returns names, sizes, and paths for all files in the session temp dir.
read_script
Read a MATLAB .m script file from the session's temporary directory. Returns the file content as text. Use list_files to see available files.
| Parameter | Type | Description |
|---|---|---|
filename * | string |
read_data
Read a data file (.mat, .csv, .json, .txt, .xlsx) from the session temp directory. For .mat files, 'summary' mode shows variable names/sizes/types via MATLAB, 'raw' mode returns base64-encoded content. Text files return inline content.
| Parameter | Type | Description |
|---|---|---|
filename * | string | |
format | string |
read_image
Read an image file (.png, .jpg, .gif) from the session temp directory. Returns the image as an inline content block that renders in agent UIs.
| Parameter | Type | Description |
|---|---|---|
filename * | string |
get_pool_status
Get the current status of the MATLAB engine pool. Returns the total, available, busy, and max engine counts.
get_server_metrics
Get comprehensive server metrics including pool, jobs, sessions, and system stats.
get_server_health
Get server health status with issue detection. Returns healthy/degraded/unhealthy.
get_error_log
Get recent server errors and notable events for diagnosing issues.
| Parameter | Type | Description |
|---|---|---|
limit | integer |