mcp-framework-matlab-production
Publish MATLAB functions as MCP tools for AI agents using MATLAB Production Server
claude mcp add --transport stdio matlab-mcp-framework-matlab-production-server matlab -batch prodserver.mcp.start() \ --env MCP_ROOT="path to MCP Framework for MATLAB Production Server root" \ --env MATLAB_PATH="path to MATLAB installation" \ --env MATLAB_PORT="port where MATLAB Production Server is listening" \ --env LD_LIBRARY_PATH="optional: additional libraries" \ --env MCP_CONFIG_PATH="path to MCP configuration files"
How to use
This MCP server package enables MATLAB functions to be exposed as MCP tools that can be invoked by large language models and other clients via HTTP. The tools are built from MATLAB functions using the MATLAB Production Server in combination with the MCP Framework, which provides a standard HTTP-based interface, a simple ping endpoint, and utility functions to deploy and call tools. Once deployed, you can call a tool by its name through the MCP HTTP endpoints, test it with curl or an HTTP client, and integrate it into your LLM prompts to leverage domain-specific computations. The repository documents public functions under prodserver.mcp (build, deploy, call, list, ping, exist) and includes example MCP tools such as Primes, Periodic Noise, Earthquake, and Multiple Tools.
To use the server, ensure MATLAB Production Server is running and accessible from the host running the MCP client. Build an MCP tool from a MATLAB function, deploy it to the server, and then use the provided MCP client code or a generic HTTP client to ping and call the tool. The STDIO-to-HTTP bridge is included for development and testing, enabling STDIO-based workflows to be used alongside HTTP calls.
How to install
Prerequisites
- MATLAB R2025b or later
- MATLAB Compiler SDK compatible with your MATLAB version
- Access to MATLAB Production Server (R2022a or later)
- An MCP client that supports HTTP-based MCP servers (no streamable HTTP or SSE required)
Installation steps
-
Install MATLAB and required toolboxes
- Install MATLAB R2025b or later from MathWorks.
- Install MATLAB Compiler SDK (compatible with your MATLAB version).
- Ensure MATLAB Production Server is installed and accessible.
-
Obtain the MCP Framework package
- Clone or download this MCP Framework for MATLAB Production Server repository to a location visible to MATLAB.
- Add the top-level folder to MATLAB’s path or install the add-on via MATLAB Add-Ons if available.
-
Prepare the server configuration
- Ensure MATLAB Production Server is configured to allow HTTP-based MCP tooling.
- Verify that the prodserver.mcp package can be reached by MATLAB Production Server (e.g., add the path to MATLAB so the server can discover prodserver.mcp).
-
Build and deploy an MCP tool
- In MATLAB, call the documented commands to build and deploy a tool, e.g., prodserver.mcp.build, prodserver.mcp.deploy, and then verify with prodserver.mcp.ping.
-
Run the MCP server interface
- Start MATLAB (or the Production Server environment) so the MCP HTTP endpoints are reachable from your MCP clients.
- Use curl or an MCP client to ping and call tools at the given endpoint (e.g., /primeSequence/ping and /primeSequence/call).
Additional notes
Notes and tips:
- This MCP framework targets MATLAB Production Server and does not support streamable HTTP or SSE; ensure your client is compatible with pure HTTP-based MCP endpoints.
- The mcp_config is intended to launch MATLAB in a batch mode suitable for MPS integration; adjust environment variables to match your deployment environment (MATLAB_PORT, MCP_ROOT, MATLAB_PATH, MCP_CONFIG_PATH).
- The Examples folder contains multiple demonstrations (Primes, Periodic Noise, Earthquake, Multiple Tools) to help you validate deployment and usage.
- If you encounter issues with tool deployment, verify that the MATLAB Production Server user has appropriate permissions and that network routing allows HTTP traffic to the server.
- For troubleshooting, use the ping endpoint (e.g., curl http://host:port/<tool>/ping) to confirm availability before calling a tool.
Related MCP Servers
matlab -core
Run MATLAB® using AI applications with the official MATLAB MCP Server from MathWorks®. This MCP server for MATLAB supports a wide range of coding agents like Claude Code® and Visual Studio® Code.
matlab
Matlab MCP Server in python
MatlabMCP
MCP server to run MATLAB code from LLM via the Matlab Engine API.