Get the FREE Ultimate OpenClaw Setup Guide →

matlab

The MATLAB MCP server provides AI users with powerful scientific computing and data analysis capabilities. It allows users to execute MATLAB code directly in conversations, generate MATLAB scripts from natural language descriptions, and access MATLAB documentation.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio williamcloudqi-matlab-mcp-server node /path/to/matlab-server/build/index.js \
  --env MATLAB_PATH="/path/to/matlab/executable"

How to use

This MATLAB MCP Server lets you run MATLAB commands and generate MATLAB code directly from your AI assistant. You can use the execute_matlab_code tool to run MATLAB code or scripts and receive results, and the generate_matlab_code tool to convert natural language descriptions into executable MATLAB code. For example, you could ask the assistant to run a quick MATLAB calculation, plot data, or save results to a file, or you could describe a task in plain language and receive ready-to-run MATLAB code. You can also access MATLAB documentation through the server via the matlab:// documentation pathways described in the features, enabling quick reference while chatting.

To use the tools, interact with the MATLAB MCP server through your client interface (e.g., Claude Desktop integration or your configured cline/CLI). The execute_matlab_code tool executes commands in MATLAB and returns outputs such as variables, figures, or text results. The generate_matlab_code tool analyzes your description and outputs MATLAB code you can run immediately or modify for your needs. Both tools can optionally save generated or executed scripts for future reference if configured by your environment.

How to install

Prerequisites:

  • MATLAB installed on your system
  • Node.js v14 or higher
  • npm installed
  1. Install the package globally (recommended):
npm install -g matlab-mcp-server
  1. Build from source (if cloning the repo):
git clone https://github.com/WilliamCloudQi/matlab-mcp-server.git
cd matlab-mcp-server
npm install
npm run build
  1. Install via Smithery (optional but convenient):
npx -y @smithery/cli install @WilliamCloudQi/matlab-mcp-server --client claude
  1. Configure Claude (or your MCPI client) to use the server: add an MCP server entry with the following structure. Adjust paths to your environment:
{
  "mcpServers": {
    "matlab-server": {
      "command": "node",
      "args": ["/path/to/matlab-server/build/index.js"],
      "env": {
        "MATLAB_PATH": "/path/to/matlab/executable"
      },
      "disabled": false,
      "autoApprove": []
    }
  }
}
  1. Run the server locally (example):
node /path/to/matlab-server/build/index.js
  1. Debugging tips:
  • Since MCP servers communicate over stdio, use the MCP Inspector to help inspect messages:
npm run inspector
  • Ensure MATLAB_PATH points to your MATLAB executable and that MATLAB is accessible from your environment.

Additional notes

Tips and common issues:

  • Make sure MATLAB is installed and accessible via MATLAB_PATH; incorrect paths are a common error.
  • The server communicates over stdio; if you don’t see responses, check console logs from the Node process and verify the index.js path.
  • When using Smithery, you can simplify client integration; ensure you’re using a compatible Claude Desktop version and that the client config points to the correct build output.
  • If you encounter permission issues on macOS or Windows, ensure the executable has executable permissions and proper access rights.
  • You can customize environment variables beyond MATLAB_PATH as needed for your MATLAB toolboxes or runtime configurations.

Related MCP Servers

Sponsor this space

Reach thousands of developers