Logo MATLAB MCP 工具

MATLAB MCP 工具

Cộng đồng
neuromechanist

An MCP to develop MATLAB pipelines section by section and read figures one dimension at a time

Nhà phát hànhneuromechanist
Kho mãmatlab-mcp-tools
Ngôn ngữPython
Bản fork
6
Sao
18
Công cụ có sẵn
0
Phương thức truyền tảistdio
Danh mục
Giấy phépBSD-3-Clause
Liên kết
  • Kết nối công cụ với quy trình làm việc AI

    MATLAB MCP 工具 cung cấp các chức năng MCP cho các ứng dụng khách AI và tác nhân AI tương thích.

  • 0 công cụ có sẵn

    Xem các thao tác có thể gọi bên dưới, kèm tên và mô tả nếu máy chủ cung cấp.

  • Mẫu cấu hình có thể sao chép ngay

    Dùng các đoạn cấu hình mẫu để thiết lập máy chủ này trong ứng dụng khách MCP bạn muốn dùng.

  • Mức độ quan tâm của cộng đồng đến kho mã

    18 sao và 6 bản fork từ kho mã được liên kết.

MATLAB MCP Tool

A Model Context Protocol (MCP) server that provides tools for developing and running MATLAB files. Integrates with Claude Code, Cursor, and other MCP-compatible clients.

Prerequisites

  • Python 3.10+
  • MATLAB with Python Engine installed
  • uv package manager (required)

Features

  1. Script Execution - Run complete scripts, individual sections (by index, title, or line range), maintain workspace context between executions, capture plots
  2. Workspace Management - Get full workspace, retrieve specific variables with field/depth/size control, inspect struct metadata, list and filter variables by name pattern or type
  3. Figure Analysis - Extract figure metadata (axes, labels, legends), get raw plot data, prepare figures for LLM-based analysis with custom prompts
  4. Code Quality - Lint MATLAB code via checkcode with severity filtering, supports inline code and file paths
  5. Script Management - Create scripts, list sections with previews, read script content via MCP resource

Installation

Quick Start (Recommended)

One-command installation with auto-detection:

bash
./install-matlab-mcp.sh

That's it! The installer will:

  • ✅ Auto-detect MATLAB installations (including external volumes like /Volumes/S1/)
  • ✅ Auto-install UV package manager if needed
  • ✅ Create optimized virtual environment with MATLAB-compatible Python version
  • ✅ Install all dependencies including MATLAB Python engine
  • ✅ Generate MCP configuration ready for Cursor/Claude Code
  • ✅ Verify installation works correctly
  • ✅ Optionally configure Cursor automatically

Reduces installation time from 15+ minutes to ~2 minutes!

Advanced Installation

If you need custom configuration:

  1. Clone this repository:
bash
git clone [repository-url]
cd matlab-mcp-tools
  1. Set custom MATLAB path (optional - installer auto-detects):
bash
# Only needed if MATLAB is in unusual location
export MATLAB_PATH=/path/to/your/matlab/installation
  1. Run installer:
bash
./install-matlab-mcp.sh

Legacy Installation (Manual)

  1. Install uv package manager:
bash
# Install uv using Homebrew
brew install uv
# OR install using pip
pip install uv
  1. Set MATLAB path environment variable:
bash
# For macOS (auto-detection searches common locations)
export MATLAB_PATH=/Applications/MATLAB_R2024b.app

# For Windows (use Git Bash terminal)
export MATLAB_PATH="C:/Program Files/MATLAB/R2024b"
  1. Run legacy setup script:
bash
./scripts/setup-matlab-mcp.sh
  1. Configure Cursor manually:
bash
cp mcp-pip.json ~/.cursor/mcp.json

Testing Installation

Test your installation:

bash
./scripts/test-matlab-mcp.sh

Installation complete! The MATLAB MCP server is now ready to use with Cursor/Claude Code.

Usage

  1. Start the MCP server:
bash
matlab-mcp-server

This is equivalent to running:

bash
python -m matlab_mcp.server

You should see a startup message confirming the server is running with 15 tools available.

  1. Configure your MCP client. For Claude Code, add to .mcp.json:
json
{
  "mcpServers": {
    "matlab": {
      "command": "/path/to/matlab-mcp-tools/.venv/bin/matlab-mcp-server",
      "env": {
        "MATLAB_PATH": "/Applications/MATLAB_R2024b.app"
      }
    }
  }
}

For Cursor, use the auto-generated mcp-pip.json or add to ~/.cursor/mcp.json.

Hint: Find the MATLAB engine path with python -c "import matlab; print(matlab.__file__)".

  1. Available Tools (15):
CategoryToolDescription
Scriptsexecute_scriptRun MATLAB code or script file
execute_sectionExecute by line range
execute_section_by_indexExecute by section index (0-based)
execute_section_by_titleExecute by section title (partial match)
get_script_sectionsList sections with titles and previews
create_matlab_scriptCreate a new .m file
Workspaceget_workspaceGet all workspace variables
get_variableGet specific variable (with field/depth/size control)
get_struct_infoGet struct field metadata without data transfer
list_workspace_variablesList/filter variables by name pattern or type
Figuresget_figure_metadataExtract axes, labels, legends, subplot info
get_plot_dataGet raw x/y/z data from plot lines
analyze_figurePrepare figure image + metadata for LLM analysis
get_analysis_promptGet/customize the figure analysis prompt
Qualitymatlab_lintRun checkcode on code or files

Resource: matlab://scripts/{script_name} - Read script content

Examples

1. Simple Script Execution with Plot

This example demonstrates running a complete MATLAB script that generates a plot:

matlab
% test_plot.m
x = linspace(0, 2*pi, 100);
y = sin(x);

% Create a figure with some styling
figure;
plot(x, y, 'LineWidth', 2);
title('Sine Wave');
xlabel('x');
ylabel('sin(x)');
grid on;

% Add some annotations
text(pi, 0, '\leftarrow \pi', 'FontSize', 12);

To execute this script using the execute_script tool:

json
{
    "script": "test_plot.m",
    "is_file": true
}

The tool will execute the script and capture the generated plot, saving it to the output directory.

2. Section-Based Execution

This example shows how to execute specific sections of a MATLAB script:

matlab
%% Section 1: Data Generation
% Generate sample data
x = linspace(0, 10, 100);
y = sin(x);

fprintf('Generated %d data points\n', length(x));

%% Section 2: Basic Statistics
% Calculate basic statistics
mean_y = mean(y);
std_y = std(y);
max_y = max(y);
min_y = min(y);

fprintf('Statistics:\n');
fprintf('Mean: %.4f\n', mean_y);
fprintf('Std Dev: %.4f\n', std_y);
fprintf('Max: %.4f\n', max_y);
fprintf('Min: %.4f\n', min_y);

%% Section 3: Plotting
% Create visualization
figure('Position', [100, 100, 800, 400]);

subplot(1, 2, 1);
plot(x, y, 'b-', 'LineWidth', 2);
title('Signal');
xlabel('x');
ylabel('y');
grid on;

subplot(1, 2, 2);
histogram(y, 20);
title('Distribution');
xlabel('Value');
ylabel('Count');
grid on;

sgtitle('Signal Analysis');

To execute specific sections using execute_section_by_index:

json
{
    "file_path": "section_test.m",
    "section_index": 0
}

Or by title using execute_section_by_title:

json
{
    "file_path": "section_test.m",
    "section_title": "Data Generation"
}

The output will include:

Generated 100 data points
Statistics:
Mean: 0.0000
Std Dev: 0.7071
Max: 1.0000
Min: -1.0000

Output Directory

The tool creates matlab_output and test_output directories to store:

  • Plot images generated during script execution
  • Other temporary files

Error Handling

  • Script execution errors are captured and returned with detailed error messages
  • Workspace state is preserved even after errors

Installation Troubleshooting

The new install-matlab-mcp.sh installer handles most common issues automatically. If you encounter problems:

Common Issues and Solutions

1. MATLAB not found:

  • The installer auto-detects MATLAB in common locations
  • If you have MATLAB in unusual location: export MATLAB_PATH=/your/matlab/path
  • Supported locations include external volumes (e.g., /Volumes/S1/Applications/)

2. UV package manager issues:

  • The installer automatically installs UV if needed
  • For manual installation: curl -LsSf https://astral.sh/uv/install.sh | sh

3. Python version compatibility:

  • Installer automatically selects MATLAB-compatible Python version
  • MATLAB R2024b: Python 3.11, R2024a: Python 3.10, R2023x: Python 3.9

4. Permission errors:

  • Run installer with appropriate permissions
  • On Windows: use Git Bash with Admin privileges

5. Configuration issues:

  • Use the auto-generated mcp-pip.json configuration
  • Installer offers automatic Cursor configuration

Legacy Issues (if using manual installation)

  1. Make sure uv is installed before running legacy scripts
  2. For ENONET errors, ensure Python executable consistency:
json
{
    "command": "bash",
    "args": ["-c", "source ~/.zshrc && /path/to/matlab-mcp-install/.venv/bin/matlab-mcp-server"]
}
  1. MATLAB Python Engine compatibility: See MATLAB Engine docs

Still Having Issues?

  1. Check installer output for specific error messages
  2. Verify MATLAB license is valid and active
  3. Test manually: .venv/bin/matlab-mcp-server --help
  4. Open an issue with installer output if problem persists

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Submit a pull request

License

This project is licensed under the BSD-3-Clause License. See the LICENSE file for details.

Cài đặt

TypingMind
Yêu cầu:

Node.js 18+

{
  "mcpServers": {
    "neuromechanist-matlab-mcp-tools": {
      "command": "",
      "args": []
    }
  }
}

Dùng MCP MATLAB MCP 工具 với nhiều mô hình AI

TypingMind kết nối các công cụ MCP ở cấp không gian làm việc, nên sau khi kết nối MATLAB MCP 工具, bạn có thể dùng với nhiều mô hình AI khác nhau trong TypingMind thay vì phải thiết lập riêng cho từng mô hình. MCP này chạy cục bộ thông qua trình kết nối MCP của TypingMind trên thiết bị của bạn.

Hướng dẫn thiết lập để dùng trình kết nối cục bộ

Dùng cách này khi máy chủ MCP cần truy cập các tệp, ứng dụng hoặc tài nguyên riêng tư trên máy tính của bạn.

1

Mở cài đặt MCP

Trong TypingMind, vào Cài đặt, Cài đặt nâng cao, rồi đến Giao thức ngữ cảnh mô hình và chọn Thiết lập trình kết nối.

  1. Mở TypingMind trong trình duyệt của bạn.
  2. Nhấp vào biểu tượng Cài đặt.
  3. Vào Cài đặt nâng cao.
  4. Mở mục Giao thức ngữ cảnh mô hình.
  5. Nhấp vào Thiết lập trình kết nối rồi chọn Thiết bị này.
Màn hình thiết lập trình kết nối MCP của TypingMind với tùy chọn Thiết bị này được chọn
2

Chạy lệnh thiết lập trình kết nối

Chọn Thiết bị này, sao chép lệnh từ TypingMind và chạy trong Terminal. Để tiến trình tiếp tục chạy trong khi bạn dùng MCP.

  1. Sao chép lệnh thiết lập hiển thị trong TypingMind.
  2. Mở Terminal trên macOS hoặc Windows Terminal trên Windows.
  3. Dán và chạy lệnh.
  4. Xác nhận cài đặt gói nếu Terminal hỏi bạn có muốn tiếp tục không.
  5. Để tiến trình tiếp tục chạy trong cửa sổ Terminal khi bạn dùng các công cụ MCP.
3

Thêm MATLAB MCP 工具 làm máy chủ

Khi trạng thái trình kết nối là Sẵn sàng, nhấp vào Sửa máy chủ và dán cấu hình máy chủ MCP.

  1. Đợi đến khi trạng thái trình kết nối hiển thị Sẵn sàng.
  2. Nhấp vào Sửa máy chủ.
  3. Dán cấu hình máy chủ MCP của MATLAB MCP 工具.
  4. Lưu danh sách máy chủ.
  5. Làm mới nếu bạn muốn xác nhận trình kết nối vẫn sẵn sàng.
Cài đặt MCP của TypingMind hiển thị máy chủ đang hoạt động và nút Sửa máy chủ
{
  "mcpServers": {
    "neuromechanist-matlab-mcp-tools": {
      "command": "npx",
      "args": [
        "-y",
        "matlab-mcp-tools"
      ]
    }
  }
}
4

Dùng kết nối với nhiều mô hình

Lưu danh sách máy chủ, mở Plugin, bật các công cụ MCP của MATLAB MCP 工具, sau đó chọn bất kỳ mô hình AI nào được hỗ trợ trong TypingMind và dùng các công cụ trong cuộc trò chuyện hoặc gán chúng cho một tác nhân AI.

  1. Mở trang Plugin trong TypingMind.
  2. Bật các công cụ MCP của MATLAB MCP 工具.
  3. Bắt đầu cuộc trò chuyện và chọn mô hình AI bạn muốn dùng.
  4. Dùng các công cụ MCP trong cuộc trò chuyện hoặc gán chúng cho một tác nhân AI.
  5. Chuyển sang mô hình AI khác bất cứ khi nào cần mà không phải kết nối lại MCP.
Cuộc trò chuyện trên TypingMind dùng các công cụ MCP đã bật với mô hình AI đã chọn
Bạn có thể dùng MATLAB MCP 工具 giúp tôi làm việc này không?
MATLAB MCP 工具
Được. Tôi đọc rồi.
Đây là kết quả tôi tìm được bằng MATLAB MCP 工具.

Câu hỏi thường gặp

Máy chủ MCP MATLAB MCP 工具 dùng để làm gì?

MATLAB MCP 工具 là máy chủ MCP cho phép các ứng dụng AI tương thích kết nối với công cụ và ngữ cảnh bên ngoài. Trong TypingMind, bạn chỉ cần thêm máy chủ MCP này một lần để các công cụ của nó có sẵn trong không gian làm việc AI của bạn.

Bạn có thể dùng MCP MATLAB MCP 工具 với nhiều mô hình AI trong TypingMind không?

Có. TypingMind kết nối các công cụ MCP ở cấp không gian làm việc, nên bạn có thể dùng MATLAB MCP 工具 với nhiều mô hình AI như Claude, ChatGPT, Gemini hoặc các mô hình khác đã cấu hình trong TypingMind mà không cần thiết lập máy chủ MCP riêng cho từng mô hình.

Vì sao nên dùng MCP MATLAB MCP 工具 với TypingMind?

TypingMind là một trong những giao diện trò chuyện với LLM tốt nhất vì tập hợp nhiều mô hình AI, prompt, plugin, tác nhân AI, khóa API và công cụ MCP vào một không gian làm việc. Khi kết nối MATLAB MCP 工具, bạn có thể dùng các công cụ MCP của dịch vụ này với những mô hình ưa thích, đồng thời giữ quy trình trò chuyện gọn gàng trong TypingMind.

Làm cách nào để kết nối MCP MATLAB MCP 工具 với TypingMind?

MATLAB MCP 工具 hoạt động thông qua trình kết nối MCP cục bộ của TypingMind. Đây là lựa chọn phù hợp nhất khi máy chủ MCP cần truy cập tệp cục bộ, ứng dụng máy tính, công cụ dòng lệnh hoặc tài nguyên riêng trên máy tính của bạn.

MCP MATLAB MCP 工具 cung cấp những công cụ nào trong TypingMind?

MATLAB MCP 工具 cung cấp các chức năng MCP mà bạn có thể bật từ trang Plugin của TypingMind để dùng trong trò chuyện hoặc gán cho tác nhân AI.

Bạn có cần chia sẻ khóa API với TypingMind để dùng MCP MATLAB MCP 工具 không?

Không. TypingMind ưu tiên xử lý cục bộ và cho phép bạn kiểm soát nhà cung cấp mô hình, khóa API, prompt và cấu hình MCP. Nếu MATLAB MCP 工具 yêu cầu xác thực, hãy thêm các header, cài đặt OAuth hoặc cấu hình cục bộ cần thiết cho máy chủ MCP đó khi tạo kết nối.

Máy chủ MCP liên quan

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇