
jigarbhoye04/matlabmcp
Developer toolsЭта страница переведена автоматически. Технические детали смотрите в оригинале. Открыть оригинал
MCP-сервер для запуска MATLAB-кода от LLM через API Matlab Engine.
Обзор
Это реализация сервера Model Context Protocol (MCP) для MATLAB. Это позволяет MCP-клиентам (например, агентам LLM или Claude Desktop) взаимодействовать с общим сеансом MATLAB с помощью API MATLAB Engine для Python. Запустите произвольные фрагменты кода MATLAB через инструмент RunMatlabCode. * Получить значение переменных из рабочего пространства MATLAB с помощью инструмента getVariable. Инструменты возвращают результаты и ошибки в виде структурированного JSON для более простого программного использования клиентами. Звонки движка MATLAB выполняются асинхронно с использованием asyncio.to thread для предотвращения блокировки сервера. * Использует стандартный модуль регистрации Python, выводящий на stderr для видимости в журналах клиентов. * Подключается к существующей совместной сессии MATLAB. Википедия MatlabMCP от DEVIN. Проверьте DeepWiki для получения более подробной и иллюстративной информации об архитектуре. * Python 3.12 или выше * MATLAB (проверьте MATLAB Engine API для совместимости с Python) с установленным MATLAB Engine API для Python. Пакет Numpy Python. 2.
Обзор (машинный перевод)
Это реализация сервера Model Context Protocol (MCP) для MATLAB. Это позволяет MCP-клиентам (например, агентам LLM или Claude Desktop) взаимодействовать с общим сеансом MATLAB с помощью API MATLAB Engine для Python.
Особенности
** Исполните MATLAB-код: ** Запустите произвольные фрагменты кода MATLAB через инструмент runMatlabCode.
-
-
-
- Переменные восстановления: * * Получите значение переменных из рабочего пространства MATLAB с помощью инструмента
getVariable. ** Структурная коммуникация:** Инструменты возвращают результаты и ошибки в виде структурированного JSON для более простого программного использования клиентами. ** Неблокирующее исполнение: ** Звонки движка MATLAB выполняются асинхронно с использованиемasyncio.to_threadдля предотвращения блокировки сервера. ** Стандартная регистрация: ** Использует стандартный модуль Pythonlogging, выводящий наstderrдля видимости в журналах клиентов. ** Разделенная сессия: ** Подключается к существующей совместной сессии MATLAB.
- Переменные восстановления: * * Получите значение переменных из рабочего пространства MATLAB с помощью инструмента
-
-
[!TIP] Википедия MatlabMCP от DEVIN. Проверьте DeepWiki для получения более подробной и иллюстративной информации об архитектуре.
Требования
Python 3.12 или выше
- MATLAB (R2023a или выше рекомендовано - проверить MATLAB Engine API на совместимость с Python) с установленным MATLAB Engine API на Python.
Эта страница переведена автоматически. Технические детали смотрите в оригинале.
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
}
}