
jigarbhoye04/matlabmcp
Developer toolsこのページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る
MCP サーバーは、Matlab Engine API 経由で LLM から MATLAB コードを実行します.
概要
MATLABのモデルコンテキストプロトコル(MCP)サーバの実装です。 MCP クライアント (LM エージェントや Claude デスクトップなど) は、MATLAB Engine API を使用して、共有 MATLAB セッションと Python 用の MATLAB Engine API とのやり取りができます。 * RunMatlabCodeツールを使用して任意のMATLABコードスニペットを実行します。 * getVariable ツールを使用して、MATLAB のワークスペースから変数の値を取得します。 * ツールは、クライアントによるプログラムの使用を容易にするために、JSON を構造化した結果とエラーを返します。 * MATLABエンジン呼び出しは、サーバーのブロックを防止するために、asyncio.to thread を使用して非同期的に実行されます。 * クライアントログの可視性のために、Python の標準的なロギング モジュールを使用して、stderr に出力します。 ※既存のMATLABセッションに接続します。 DEVIN による MatlabMCP wikipedia 。 アーキテクチャに関する詳細情報とイラストの詳細情報については、DeepWikiをチェックしてください。 * Python 3.12 以上 * MATLAB ( - Python の互換性の MATLAB Engine API をチェック) は、Python 用の MATLAB Engine API をインストールします。 * numpy Python パッケージ。 2.
概要(AI 翻訳)
MATLABのモデルコンテキストプロトコル(MCP)サーバの実装です。 MCP クライアント (LM エージェントや Claude デスクトップなど) は、MATLAB Engine API を使用して、共有 MATLAB セッションと Python 用の MATLAB Engine API とのやり取りができます。
##特徴
***[runMatlabCode]ツールを介して任意のMATLABコードスニペットを実行します。
*変数の取得: getVariable ツールを使用して、MATLAB のワークスペースから変数の値を取得する。
-
- Structuredコミュニケーション:* クライアントによるプログラムの使用を容易にするために、結果とエラーを構造化したJSONとしてツールします。
*非ブロック実行: MATLABエンジン呼び出しは、サーバーのブロックを防止するために[
asyncio.to_threadを使用して非同期的に実行されます。 *標準ログ: クライアントログの可視性のために、Pythonの標準[logging]モジュールを使用します。 *共有セッション: 既存のMATLABセッションに接続します。
- Structuredコミュニケーション:* クライアントによるプログラムの使用を容易にするために、結果とエラーを構造化したJSONとしてツールします。
*非ブロック実行: MATLABエンジン呼び出しは、サーバーのブロックを防止するために[
[!TIP] DEVINによるMatlabMCP wikipedia。 アーキテクチャに関する詳細情報とイラストの詳細情報については、DeepWikiをチェックしてください。
要件
- Python 3.12以上
- MATLAB(R2023a以上推奨 - MATLAB Engine API for Pythonの互換性をチェック).
このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。
README
以下は原文 README の抜粋です。原文を見る。
MATLAB MCP Integration
This is an implementation of a Model Context Protocol (MCP) server for MATLAB. It allows MCP clients (like LLM agents or Claude Desktop) to interact with a shared MATLAB session using the MATLAB Engine API for Python.
Features
- Execute MATLAB Code: Run arbitrary MATLAB code snippets via the
runMatlabCodetool. - Retrieve Variables: Get the value of variables from the MATLAB workspace using the
getVariabletool. - Structured Communication: Tools return results and errors as structured JSON for easier programmatic use by clients.
- Non-Blocking Execution: MATLAB engine calls are run asynchronously using
asyncio.to_threadto prevent blocking the server. - Standard Logging: Uses Python’s standard
loggingmodule, outputting tostderrfor visibility in client logs. - Shared Session: Connects to an existing shared MATLAB session.
[!TIP] MatlabMCP wikipedia by DEVIN. Checkout DeepWiki for more detailed and illustrative information about architecture.
Requirements
- Python 3.12 or higher
- MATLAB (R2023a or higher recommended - check MATLAB Engine API for Python compatibility) with the MATLAB Engine API for Python installed.
numpyPython package.
Installation
-
Clone this repository:
git clone https://github.com/jigarbhoye04/MatlabMCP.git cd MatlabMCP -
Set up a Python virtual environment (recommended):
# 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 -
Install dependencies:
uv pip sync -
Ensure MATLAB is installed and the MATLAB Engine API for Python is configured for your Python environment. See MATLAB Documentation.
-
Start MATLAB and share its engine: Run the following command in the MATLAB Command Window:
matlab.engine.shareEngineYou can verify it’s shared by running
matlab.engine.isEngineSharedin MATLAB (it should returntrueor1). The MCP server needs this shared engine to connect.
Configuration (for Claude Desktop)
To use this server with Claude Desktop:
-
Go to Claude Desktop -> Settings -> Developer -> Edit Config.
-
This will open
claude_desktop_config.json. Add or modify themcpServerssection to include theMatlabMCPconfiguration:{ "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" ]
インストール
This server does not publish a one-line install command.
Open the repository installation guide MCP 初心者?mcpskill.org のガイドから始めましょう →設定
{
"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
}
}