Skip to main content
Glama

MATLAB MCP Server

MATLAB MCP 통합

MATLAB용 모델 컨텍스트 프로토콜(MCP) 서버 구현입니다. MCP 클라이언트(LLM 에이전트 또는 Claude Desktop 등)가 Python용 MATLAB Engine API를 사용하여 공유 MATLAB 세션과 상호 작용할 수 있도록 합니다.

특징

  • MATLAB 코드 실행: runMatlabCode 도구를 통해 임의의 MATLAB 코드 조각을 실행합니다.
  • 변수 검색: getVariable 도구를 사용하여 MATLAB 작업 공간에서 변수 값을 가져옵니다.
  • 구조화된 커뮤니케이션: 도구는 클라이언트가 프로그래밍 방식으로 더 쉽게 사용할 수 있도록 결과와 오류를 구조화된 JSON으로 반환합니다.
  • 비차단 실행: MATLAB 엔진 호출은 asyncio.to_thread 사용하여 비동기적으로 실행되어 서버 차단을 방지합니다.
  • 표준 로깅: Python의 표준 logging 모듈을 사용하여 클라이언트 로그에서 볼 수 있도록 stderr 로 출력합니다.
  • 공유 세션: 기존 공유 MATLAB 세션에 연결합니다.

할 일:

  • MATLAB 작업 공간에 데이터를 쓰기 위해 setVariable 도구를 추가합니다.
  • .m 파일을 직접 실행하기 위해 runScript 도구를 추가합니다.
  • 작업 공간 관리를 위한 도구를 추가합니다(예: clearWorkspace , getWorkspaceVariables ).
  • 더욱 복잡한 데이터 유형(구조체, 셀형 배열, 객체)을 처리하기 위해 matlab_to_python 도우미를 확장합니다.
  • Simulink 모델과의 상호작용에 대한 지원을 추가합니다.

요구 사항

  • Python 3.12 이상
  • Python용 MATLAB Engine API가 설치된 MATLAB( R2023a 이상 권장 - Python 호환성을 위해 MATLAB Engine API 확인)
  • numpy Python 패키지.

설치

  1. 이 저장소를 복제하세요:지엑스피1
  2. Python 가상 환경 설정(권장):
    # Install uv if you haven't already: https://github.com/astral-sh/uv uv init uv venv source .venv/bin/activate # On Windows use: .venv\Scripts\activate
  3. 종속성 설치:
    uv pip sync
  4. MATLAB가 설치되어 있고 Python용 MATLAB Engine API가 Python 환경에 맞게 구성되어 있는지 확인하세요. MATLAB 설명서를 참조하세요.
  5. MATLAB를 시작하고 엔진을 공유하세요. MATLAB 명령 창에서 다음 명령을 실행하세요.
    matlab.engine.shareEngine
    MATLAB에서 matlab.engine.isEngineShared 실행하여 공유되었는지 확인할 수 있습니다( true 또는 1 반환해야 함). MCP 서버는 이 공유 엔진을 통해 연결해야 합니다.

구성(Claude Desktop용)

Claude Desktop과 함께 이 서버를 사용하려면:

  1. Claude Desktop -> 설정 -> 개발자 -> 구성 편집으로 이동합니다.
  2. claude_desktop_config.json 파일이 열립니다. MatlabMCP 구성을 포함하도록 mcpServers 섹션을 추가하거나 수정하세요.
    { "mcpServers": { "MatlabMCP": { "command": "C:\\Users\\username\\.local\\bin\\uv.exe", // Path to your uv executable "args": [ "--directory", "C:\\Users\\username\\Desktop\\MatlabMCP\\", // ABSOLUTE path to the cloned repository directory "run", "main.py" ] // Optional: Add environment variables if needed // "env": { // "MY_VAR": "value" // } } // Add other MCP servers here if you have them } }
  3. 중요: C:\\Users\\username\\... 경로를 시스템에 맞는 올바른 절대 경로 로 바꾸세요.
  4. 파일을 저장하고 Claude Desktop을 다시 시작하세요 .
  5. 로깅: 서버 로그(Python logging 모듈에서 생성)는 Claude Desktop의 MCP 로그 파일에 나타납니다(macOS에서는 tail -f ~/Library/Logs/Claude/mcp-server-MatlabMCP.log 를 통해 접근 가능하고, Windows에서는 %APPDATA%\Claude\logs\ 통해 접근 가능).

개발

프로젝트 구조:

MatlabMCP/ ├── .venv/ # Virtual environment created by uv ├── Docs/ │ └── Images/ │ └── Updates.md # Documentation for updates and changes ├── main.py # The MCP server script ├── pyproject.toml # Project metadata and dependencies ├── README.md # This file └── uv.lock # Lock file for dependencies

선적 서류 비치

서버의 기능, 사용법, 개발 참고 사항에 대한 자세한 내용은 업데이트를 확인하세요.

기여하다

기여를 환영합니다! 제안이나 개선 사항이 있으시면 이슈를 개설하거나 풀 리퀘스트를 제출해 주세요.

함께 이 상황을 더욱 좋게 만들어 봅시다!

-
security - not tested
A
license - permissive license
-
quality - not tested

local-only server

The server can only run on the client's local machine because it depends on local resources.

MATLAB Engine API를 사용하여 Python에서 MATLAB 코드를 실행할 수 있으므로 Claude Desktop과의 원활한 통합을 위해 여러 요청에서 공유 MATLAB 세션이 가능합니다.

  1. 특징
    1. 할 일:
  2. 요구 사항
    1. 설치
      1. 구성(Claude Desktop용)
        1. 개발
          1. 선적 서류 비치
            1. 기여하다

              Related MCP Servers

              • -
                security
                F
                license
                -
                quality
                Allows interaction with MATLAB by creating and executing scripts and functions through Claude or other MCP clients, supporting script management and execution result retrieval with environment configuration capabilities.
                Last updated -
                19
                Python
                • Apple
              • A
                security
                A
                license
                A
                quality
                Facilitates running Python code in a sandbox and generating images using the FLUX model via an MCP server compatible with clients like Goose and the Claude Desktop App.
                Last updated -
                2
                21
                Python
                MIT License
              • A
                security
                A
                license
                A
                quality
                Integrates MATLAB with AI to execute code, generate scripts from natural language, and access MATLAB documentation seamlessly.
                Last updated -
                2
                33
                JavaScript
                Apache 2.0
                • Apple
                • Linux
              • -
                security
                A
                license
                -
                quality
                A Python-based MCP server that allows Claude and other LLMs to execute arbitrary Python code directly through your desktop Claude app, enabling data scientists to connect LLMs to APIs and executable code.
                Last updated -
                26
                MIT License
                • Apple
                • Linux

              View all related MCP servers

              MCP directory API

              We provide all the information about MCP servers via our MCP API.

              curl -X GET 'https://glama.ai/api/mcp/v1/servers/jigarbhoye04/MatlabMCP'

              If you have feedback or need assistance with the MCP directory API, please join our Discord server