/ Каталог / Песочница / MATLAB
● Официальный matlab 🔑 Нужен свой ключ

MATLAB

автор 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.

Зачем использовать

Ключевые функции

Живое демо

Как выглядит на практике

matlab.replay ▶ готово
0/0

Установка

Выберите клиент

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

Откройте Claude Desktop → Settings → Developer → Edit Config. Перезапустите после сохранения.

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

Cursor использует ту же схему mcpServers, что и Claude Desktop. Конфиг проекта приоритетнее глобального.

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

Щёлкните значок MCP Servers на боковой панели Cline, затем "Edit Configuration".

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

Тот же формат, что и Claude Desktop. Перезапустите Windsurf для применения.

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

Continue использует массив объектов серверов, а не map.

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

Добавьте в context_servers. Zed перезагружается автоматически.

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

Однострочная команда. Проверить: claude mcp list. Удалить: claude mcp remove.

Сценарии использования

Реальные сценарии: MATLAB

Generate, analyze, and run a MATLAB script

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

Когда использовать: You want to prototype a computation in MATLAB conversationally — generate, run, tune, repeat.

Предварительные требования
  • 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
Поток
  1. Check capabilities
    Detect installed MATLAB toolboxes. I need Signal Processing and Control System.✓ Скопировано
    → 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.✓ Скопировано
    → .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.✓ Скопировано
    → Static checks pass, script runs, output figure saved

Итог: Working MATLAB prototypes in minutes without switching windows.

Подводные камни
  • 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
Сочетать с: filesystem

Run MATLAB unit tests and iterate on failures

👤 Engineers maintaining MATLAB codebases ⏱ ~20 min intermediate

Когда использовать: You have a test suite (matlab.unittest) and want the agent to run it and help fix regressions.

Предварительные требования
  • Test file using matlab.unittest — Classes inheriting from matlab.unittest.TestCase
Поток
  1. Run the suite
    Run tests in ./tests/MyAlgorithmTest.m. Return per-method pass/fail plus any error text.✓ Скопировано
    → Structured test report
  2. Diagnose
    For each failure, read the assertion, read the implementation, explain the gap.✓ Скопировано
    → Per-failure root cause
  3. Fix and re-run
    Apply minimal fixes to the implementation (not tests). Re-run until green.✓ Скопировано
    → All tests pass

Итог: TDD loop over MATLAB code driven by the agent.

Подводные камни
  • Tests depend on files not on the MATLAB path — Add addpath(genpath(pwd)) at test start, or pass project_path explicitly

Комбинации

Сочетайте с другими MCP — эффект x10

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.✓ Скопировано
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.✓ Скопировано

Инструменты

Что предоставляет этот MCP

ИнструментВходные данныеКогда вызыватьСтоимость
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

Стоимость и лимиты

Во что обходится

Квота API
None — local MATLAB execution
Токенов на вызов
Script outputs can be large (plots, tables). Cap returned data.
Деньги
MATLAB license required (not free); MCP itself is free
Совет
Have the agent write plots to files instead of returning big numeric matrices in responses

Безопасность

Права, секреты, радиус поражения

Хранение учётных данных: None — local execution
Исходящий трафик: None — MATLAB runs locally

Устранение неполадок

Частые ошибки и исправления

'MATLAB engine not found' on first call

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

Проверить: 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.

Альтернативы

MATLAB в сравнении

АльтернативаКогда использоватьКомпромисс
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.)

Ещё

Ресурсы

📖 Читать официальный README на GitHub

🐙 Открытые задачи

🔍 Все 400+ MCP-серверов и Skills