شعار MATLAB MCP 工具

MATLAB MCP 工具

المجتمع
neuromechanist

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

الناشرneuromechanist
المستودعmatlab-mcp-tools
اللغةPython
التفريعات
6
النجوم
18
الأدوات المتاحة
0
نوع نقل البياناتstdio
الفئات
الترخيصBSD-3-Clause
الروابط
  • اربط الأدوات بمسارات عمل الذكاء الاصطناعي

    يتيح MATLAB MCP 工具 إمكانات MCP لتطبيقات الذكاء الاصطناعي العميلة المتوافقة معه، وكذلك لوكلاء الذكاء الاصطناعي المتوافقين معه.

  • الأدوات المتاحة: 0

    تصفّح الإجراءات القابلة للاستدعاء أدناه، بما في ذلك أسماؤها وأوصافها عندما يوفّرها الخادم.

  • إعدادات جاهزة للنسخ

    استخدم مقتطفات التثبيت لتهيئة هذا الخادم في تطبيق MCP العميل المفضّل لديك.

  • مؤشرات اهتمام المجتمع بالمستودع مفتوح المصدر

    إحصاءات المستودع المرتبط: النجوم: 18، والتفريعات: 6.

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.

التثبيت

TypingMind
المتطلبات المسبقة:

Node.js 18+

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

استخدم MCP الخاص بـ MATLAB MCP 工具 مع نماذج ذكاء اصطناعي متعددة

يربط TypingMind أدوات MCP على مستوى مساحة العمل، لذا بمجرد توصيل MATLAB MCP 工具، يمكنك استخدامه مع نماذج ذكاء اصطناعي مختلفة في TypingMind بدلًا من إعداده لكل نموذج على حدة. يعمل تكامل MCP هذا محليًا عبر موصل MCP الخاص بـ TypingMind على جهازك.

دليل الإعداد لاستخدام الموصل المحلي

استخدم هذا الخيار عندما يحتاج خادم MCP إلى الوصول إلى ملفات محلية أو تطبيقات أو موارد خاصة على جهاز الكمبيوتر لديك.

1

فتح إعدادات MCP

في TypingMind، انتقل إلى «الإعدادات»، ثم «الإعدادات المتقدمة»، ثم «بروتوكول سياق النموذج»، واختر «إعداد الموصل».

  1. افتح TypingMind في متصفحك.
  2. انقر على أيقونة الإعدادات.
  3. انتقل إلى الإعدادات المتقدمة.
  4. افتح قسم بروتوكول سياق النموذج.
  5. انقر على «إعداد الموصل» واختر «هذا الجهاز».
شاشة إعداد موصل MCP في TypingMind مع تحديد «هذا الجهاز»
2

تنفيذ أمر الموصل

اختر «هذا الجهاز»، وانسخ الأمر من TypingMind وشغّله في Terminal. أبقِ العملية قيد التشغيل أثناء استخدام MCP.

  1. انسخ أمر الإعداد الذي يعرضه TypingMind.
  2. افتح Terminal على macOS أو Windows Terminal على Windows.
  3. الصق الأمر ونفّذه.
  4. وافق على تثبيت الحزمة إذا طلب منك Terminal تأكيد المتابعة.
  5. أبقِ نافذة Terminal مفتوحة واترك العملية قيد التشغيل أثناء استخدام أدوات MCP.
3

إضافة MATLAB MCP 工具 كخادم

عندما تظهر حالة الموصل «جاهز»، انقر على «تعديل الخوادم» والصق إعدادات خادم MCP.

  1. انتظر حتى تظهر حالة الموصل «جاهز».
  2. انقر على «تعديل الخوادم».
  3. الصق إعدادات خادم MCP الخاص بـ MATLAB MCP 工具.
  4. احفظ قائمة الخوادم.
  5. حدّث الحالة إذا أردت التأكد من أن الموصل لا يزال جاهزًا.
إعدادات MCP في TypingMind تعرض خادمًا نشطًا وزر «تعديل الخوادم»
{
  "mcpServers": {
    "neuromechanist-matlab-mcp-tools": {
      "command": "npx",
      "args": [
        "-y",
        "matlab-mcp-tools"
      ]
    }
  }
}
4

استخدام الاتصال مع نماذج مختلفة

احفظ قائمة الخوادم، وافتح «الإضافات»، وفعّل أدوات MCP الخاصة بـ MATLAB MCP 工具، ثم اختر أي نموذج ذكاء اصطناعي مدعوم في TypingMind واستخدم الأدوات في المحادثة أو أسندها إلى وكيل ذكاء اصطناعي.

  1. افتح صفحة الإضافات في TypingMind.
  2. فعّل أدوات MCP الخاصة بـ MATLAB MCP 工具.
  3. ابدأ محادثة واختر نموذج الذكاء الاصطناعي الذي تريد استخدامه.
  4. استخدم أدوات MCP في المحادثة أو عيّنها لوكيل ذكاء اصطناعي.
  5. انتقل إلى نموذج ذكاء اصطناعي آخر عند الحاجة دون إعادة الاتصال بـ MCP.
محادثة في TypingMind تستخدم أدوات MCP المفعّلة مع نموذج ذكاء اصطناعي محدّد
هل يمكنك استخدام MATLAB MCP 工具 لمساعدتي في هذه المهمة؟
MATLAB MCP 工具
بالتأكيد. قرأته.
إليك ما وجدته باستخدام MATLAB MCP 工具.

الأسئلة الشائعة

ما استخدامات خادم MCP MATLAB MCP 工具؟

MATLAB MCP 工具 هو خادم MCP يتيح لتطبيقات الذكاء الاصطناعي المتوافقة الاتصال بأدوات ومصادر سياق خارجية. في TypingMind، يمكنك إضافة خادم MCP هذا مرة واحدة وإتاحة أدواته في مساحة عملك للذكاء الاصطناعي.

هل يمكنني استخدام خادم MCP MATLAB MCP 工具 مع نماذج ذكاء اصطناعي متعددة في TypingMind؟

نعم. يربط TypingMind أدوات MCP على مستوى مساحة العمل، لذا يمكنك استخدام MATLAB MCP 工具 مع نماذج ذكاء اصطناعي مختلفة مثل Claude أو ChatGPT أو Gemini أو غيرها من النماذج التي أعددتها في TypingMind، دون إعداد خادم MCP لكل نموذج على حدة.

لماذا تستخدم خادم MCP MATLAB MCP 工具 مع TypingMind؟

يُعد TypingMind من أفضل واجهات المحادثة مع النماذج اللغوية الكبيرة، إذ يجمع نماذج ذكاء اصطناعي متعددة ومطالبات وإضافات ووكلاء ذكاء اصطناعي ومفاتيح API وأدوات MCP في مساحة عمل واحدة. بعد توصيل MATLAB MCP 工具، يمكنك استخدام أدوات MCP الخاصة به عبر نماذجك المفضلة مع الحفاظ على سير عمل محادثاتك منظمًا في TypingMind.

كيف أوصّل خادم MCP MATLAB MCP 工具 بـ TypingMind؟

يعمل MATLAB MCP 工具 عبر موصل MCP المحلي في TypingMind. هذا هو الخيار الأنسب عندما يحتاج خادم MCP إلى الوصول إلى ملفات محلية أو تطبيقات سطح المكتب أو أدوات سطر الأوامر أو موارد خاصة على حاسوبك.

ما الأدوات التي يوفّرها خادم MCP MATLAB MCP 工具 في TypingMind؟

يتيح MATLAB MCP 工具 إمكانات MCP يمكنك تفعيلها من صفحة الإضافات في TypingMind واستخدامها في المحادثات أو تعيينها لوكلاء ذكاء اصطناعي.

هل أحتاج إلى مشاركة مفاتيح API الخاصة بي مع TypingMind لاستخدام خادم MCP MATLAB MCP 工具؟

لا. يعطي TypingMind الأولوية للعمل المحلي ويتيح لك التحكم بنفسك في مزوّدي النماذج ومفاتيح API والمطالبات وإعدادات MCP. إذا كان MATLAB MCP 工具 يتطلب مصادقة، فأضف الترويسات أو إعدادات OAuth أو الإعدادات المحلية المطلوبة لخادم MCP هذا عند إنشاء الاتصال.

خوادم MCP ذات صلة

عرض الكل

أنشئ مساحة عملك للذكاء الاصطناعي الآن

اشترك في نشرتنا الإخبارية لتصلك أخبار الميزات الجديدة والهدايا القادمة 👇