TM

tsuchijo/matlab-mcp

Developer tools

이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기

40 stars 4 forks 품질 56 트렌드 12

Model Context Protocol 서버는 LLM을 작성하고 matlab 스크립트를 실행합니다

개요

이 모델 Context Protocol (MCP) 서버는 MATLAB와 통합되어 Claude 또는 기타 MCP 클라이언트를 통해 MATLAB 스크립트 및 기능을 만들고 실행할 수 있습니다. - Python 3.11 (Python 3.13 및 3.12는 현재 MATLAB 엔진에 의해 지원되지 않습니다) - MATLAB R2024a (또는 호환 버전) - uv 패키지 관리자 1. Python 환경 설정: 2. MATLAB 엔진 설치 MATLAB 엔진은 MATLAB PATH 환경변수에 지정된 MATLAB 설치를 사용하여 서버가 처음 실행될 때 자동으로 설치됩니다. - matlab server.py: 주요 MCP 서버 구현 - matlab scripts/: 모든 MATLAB 스크립트 및 기능이 저장되는 디렉토리 (자동 생성) - pyproject.toml : Python 프로젝트 구성 - .python-version : uv에 대한 파이썬 버전을 지정 1. 명세.

개요(AI 번역)

이 모델 Context Protocol (MCP) 서버는 MATLAB와 통합되어 Claude 또는 기타 MCP 클라이언트를 통해 MATLAB 스크립트 및 기능을 만들고 실행할 수 있습니다.

설치 요건

  • Python 3.11 (Python 3.13 및 3.12는 현재 MATLAB 엔진에 의해 지원되지 않습니다)
  • MATLAB R2024a (또는 호환 버전)
  • uv 패키지 관리자

설치

  1. Python 환경 설정:

  2. MATLAB 엔진 설치 MATLAB 엔진은 서버가 먼저 실행될 때 자동으로 설치됩니다. MATLAB 설치는 MATLAB_PATH 환경변수에 지정됩니다.

디렉토리 구조

  • matlab_server.py: MCP 서버 구현
  • matlab_scripts/: 모든 MATLAB 스크립트와 함수가 저장되는 디렉토리 (자동 생성)
  • pyproject.toml: Python 프로젝트 구성
  • .python-version: uv를 위한 Python 버전을 지정합니다.

Claude 데스크탑 통합

  1. Claude 데스크탑 구성을 엽니다:

  2. MATLAB 서버 구성 추가:

확인하기:

  • /absolute/path/to/matlab-mcp]를 프로젝트 디렉토리에 실제 경로로 바꾸기
  • MATLAB_PATH] MATLAB 설치 지점 확인
  • 절대 경로 사용 (필수)

이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요.

README

원문 README의 일부입니다. 원문 보기.

MATLAB MCP Server

This Model Context Protocol (MCP) server provides integration with MATLAB, allowing you to create and execute MATLAB scripts and functions through Claude or other MCP clients.

Setup Requirements

  • Python 3.11 (Python 3.13 and 3.12 are not currently supported by MATLAB Engine)
  • MATLAB R2024a (or compatible version)
  • uv package manager

Installation

  1. Create and set up the Python environment:
# Pin Python version
uv python pin 3.11

# Create virtual environment
uv venv

# Activate virtual environment
source .venv/bin/activate

# Install MCP
uv add "mcp[cli]"
  1. Install MATLAB Engine The MATLAB Engine will be installed automatically when the server first runs, using the MATLAB installation specified in the MATLAB_PATH environment variable.

Directory Structure

  • matlab_server.py: The main MCP server implementation
  • matlab_scripts/: Directory where all MATLAB scripts and functions are saved (created automatically)
  • pyproject.toml: Python project configuration
  • .python-version: Specifies Python version for uv

Claude Desktop Integration

  1. Open your Claude Desktop configuration:
# On macOS
code ~/Library/Application\ Support/Claude/claude_desktop_config.json
  1. Add the MATLAB server configuration:
{
    "mcpServers": {
        "matlab": {
            "command": "uv",
            "args": [
                "--directory",
                "/absolute/path/to/matlab-mcp",
                "run",
                "matlab_server.py"
            ],
            "env": {
                "MATLAB_PATH": "/Applications/MATLAB_R2024a.app"
            }
        }
    }
}

Make sure to:

  • Replace /absolute/path/to/matlab-mcp with the actual path to your project directory
  • Verify the MATLAB_PATH points to your MATLAB installation
  • Use absolute paths (not relative)

Features

The server provides several tools:

  1. create_matlab_script: Create a new MATLAB script file

    • Scripts are saved in the matlab_scripts directory
    • File names must be valid MATLAB identifiers
  2. create_matlab_function: Create a new MATLAB function file

    • Functions are saved in the matlab_scripts directory
    • Must include valid function definition
  3. execute_matlab_script: Run a MATLAB script and get results

    • Returns output text, generated figures, and workspace variables
    • Can pass arguments to scripts
  4. call_matlab_function: Call a MATLAB function with arguments

    • Returns function output and any generated figures

Testing

You can test the server using the MCP Inspector:

# Make sure you're in your virtual environment
source .venv/bin/activate

# Run the inspector
MATLAB_PATH=/Applications/MATLAB_R2024a.app mcp dev matlab_server.py

Example test script:

t = 0:0.01:2*pi;
y = sin(t);
plot(t, y);
title('Test Plot');
xlabel('Time');
ylabel('Amplitude');

Script Storage

GitHub에서 전체 README 보기

설치

This server does not publish a one-line install command.

Open the repository installation guide MCP 초보자라면? mcpskill.org 가이드부터 시작하세요 →

설정

{ "mcpServers": { "matlab": { "command": "uv", "args": [ "--directory", "/absolute/path/to/matlab-mcp", "run", "matlab_server.py" ], "env": { "MATLAB_PATH": "/Applications/MATLAB_R2024a.app" } } } }