/ Verzeichnis / Playground / MATLAB
● Offiziell matlab 🔑 Eigener Schlüssel nötig

MATLAB

von matlab · matlab/matlab-mcp-core-server

Run MATLAB code, tests, and toolboxes from your AI agent — official MathWorks MCP.

MathWorks' official MATLAB MCP. Lets an agent evaluate MATLAB expressions, run .m script files, execute unit tests, and detect installed toolboxes. Bridges LLM reasoning with numerical/simulation workloads that live in MATLAB.

Warum nutzen

Hauptfunktionen

Live-Demo

In der Praxis

matlab.replay ▶ bereit
0/0

Installieren

Wählen Sie Ihren Client

~/Library/Application Support/Claude/claude_desktop_config.json  · Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "matlab": {
      "command": "uvx",
      "args": [
        "matlab-mcp-core-server"
      ]
    }
  }
}

Öffne Claude Desktop → Settings → Developer → Edit Config. Nach dem Speichern neu starten.

~/.cursor/mcp.json · .cursor/mcp.json
{
  "mcpServers": {
    "matlab": {
      "command": "uvx",
      "args": [
        "matlab-mcp-core-server"
      ]
    }
  }
}

Cursor nutzt das gleiche mcpServers-Schema wie Claude Desktop. Projektkonfiguration schlägt die globale.

VS Code → Cline → MCP Servers → Edit
{
  "mcpServers": {
    "matlab": {
      "command": "uvx",
      "args": [
        "matlab-mcp-core-server"
      ]
    }
  }
}

Klicken Sie auf das MCP-Servers-Symbol in der Cline-Seitenleiste, dann "Edit Configuration".

~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "matlab": {
      "command": "uvx",
      "args": [
        "matlab-mcp-core-server"
      ]
    }
  }
}

Gleiche Struktur wie Claude Desktop. Windsurf neu starten zum Übernehmen.

~/.continue/config.json
{
  "mcpServers": [
    {
      "name": "matlab",
      "command": "uvx",
      "args": [
        "matlab-mcp-core-server"
      ]
    }
  ]
}

Continue nutzt ein Array von Serverobjekten statt einer Map.

~/.config/zed/settings.json
{
  "context_servers": {
    "matlab": {
      "command": {
        "path": "uvx",
        "args": [
          "matlab-mcp-core-server"
        ]
      }
    }
  }
}

In context_servers hinzufügen. Zed lädt beim Speichern neu.

claude mcp add matlab -- uvx matlab-mcp-core-server

Einzeiler. Prüfen mit claude mcp list. Entfernen mit claude mcp remove.

Anwendungsfälle

Praxisnahe Nutzung: MATLAB

Generate, analyze, and run a MATLAB script

👤 Engineering researchers, controls/DSP engineers ⏱ ~20 min intermediate

Wann einsetzen: You want to prototype a computation in MATLAB conversationally — generate, run, tune, repeat.

Voraussetzungen
  • MATLAB R2020b+ installed and on PATHmatlab -help from a terminal should work
  • MATLAB registered as Personal Automation Servermatlab.engine.shareEngine in MATLAB once — see MCP README
Ablauf
  1. Check capabilities
    Detect installed MATLAB toolboxes. I need Signal Processing and Control System.✓ Kopiert
    → List with versions; agent knows what it can use
  2. Generate the script
    Write a MATLAB script that loads signal.mat, applies a Butterworth lowpass at 50Hz, plots before/after. Save as ./lp_filter.m.✓ Kopiert
    → .m file written
  3. Check then run
    Run check_matlab_code on lp_filter.m. Fix any issues. Then run_matlab_file and return the plot path.✓ Kopiert
    → Static checks pass, script runs, output figure saved

Ergebnis: Working MATLAB prototypes in minutes without switching windows.

Fallstricke
  • Relative paths break — MATLAB starts in its own working dir — Always use absolute paths in script_path and inside the script itself; or cd to your dir as the first line
  • Script hangs on uiopen/plot windows in non-interactive mode — Use figure('Visible','off') and saveas() to file instead of displaying
Kombinieren mit: filesystem

Run MATLAB unit tests and iterate on failures

👤 Engineers maintaining MATLAB codebases ⏱ ~20 min intermediate

Wann einsetzen: You have a test suite (matlab.unittest) and want the agent to run it and help fix regressions.

Voraussetzungen
  • Test file using matlab.unittest — Classes inheriting from matlab.unittest.TestCase
Ablauf
  1. Run the suite
    Run tests in ./tests/MyAlgorithmTest.m. Return per-method pass/fail plus any error text.✓ Kopiert
    → Structured test report
  2. Diagnose
    For each failure, read the assertion, read the implementation, explain the gap.✓ Kopiert
    → Per-failure root cause
  3. Fix and re-run
    Apply minimal fixes to the implementation (not tests). Re-run until green.✓ Kopiert
    → All tests pass

Ergebnis: TDD loop over MATLAB code driven by the agent.

Fallstricke
  • Tests depend on files not on the MATLAB path — Add addpath(genpath(pwd)) at test start, or pass project_path explicitly

Kombinationen

Mit anderen MCPs für 10-fache Wirkung

matlab + filesystem

Read data files → run MATLAB computation → save result files

Read ./data/*.csv, write a MATLAB script that processes each, save outputs to ./processed/. Run and confirm.✓ Kopiert
matlab + git

Version-control the scripts the agent generates

Generate the MATLAB analysis script, run it, verify results look good, then commit the script with a descriptive message.✓ Kopiert

Werkzeuge

Was dieses MCP bereitstellt

WerkzeugEingabenWann aufrufenKosten
detect_matlab_toolboxes First step — know what you can use free
check_matlab_code script_path (absolute) Lint before running — catches obvious issues fast free
evaluate_matlab_code code: str, project_path (absolute) One-off expression or inline code free
run_matlab_file script_path (absolute) Execute a saved .m file free
run_matlab_test_file script_path (absolute) Structured test execution free

Kosten & Limits

Was der Betrieb kostet

API-Kontingent
None — local MATLAB execution
Tokens pro Aufruf
Script outputs can be large (plots, tables). Cap returned data.
Kosten in €
MATLAB license required (not free); MCP itself is free
Tipp
Have the agent write plots to files instead of returning big numeric matrices in responses

Sicherheit

Rechte, Secrets, Reichweite

Credential-Speicherung: None — local execution
Datenabfluss: None — MATLAB runs locally

Fehlerbehebung

Häufige Fehler und Lösungen

'MATLAB engine not found' on first call

Register MATLAB as a Personal Automation Server: in MATLAB run matlab.engine.shareEngine. Restart the MCP after.

Prüfen: From terminal: `python -c 'import matlab.engine; matlab.engine.find_matlab()'` — should list engines
Scripts error with 'Undefined function'

The function is in a toolbox that isn't installed, or not on the MATLAB path. Run detect_matlab_toolboxes and confirm.

check_matlab_code reports nothing but runtime fails

mlint catches syntax not semantics. Use evaluate_matlab_code with a small test input to validate logic.

Long-running script times out

MCP clients have per-call timeouts. Break the script into stages, saving intermediate results to disk; run stage-by-stage.

Alternativen

MATLAB vs. andere

AlternativeWann stattdessenKompromiss
Octave via shell MCPYou don't have a MATLAB license and need open-sourceSyntax-compatible for core, but toolboxes often differ significantly
Python (numpy/scipy) via a Python-exec MCPYou're willing to translate the workflowFree, huge ecosystem, but you give up MATLAB-specific toolboxes (Simulink, etc.)

Mehr

Ressourcen

📖 Offizielle README auf GitHub lesen

🐙 Offene Issues ansehen

🔍 Alle 400+ MCP-Server und Skills durchsuchen