MCP Server for LLM Integration
ros2_medkit_mcp provides MCP (Model Context Protocol) tools for connecting Large Language Models to your ROS 2 system via the ros2_medkit gateway.
Overview
The MCP server enables:
Natural language queries about robot state
LLM-assisted diagnostics and troubleshooting
Autonomous agents for robot monitoring and control
The server wraps the gateway’s HTTP API, making it accessible to LLMs through standardized MCP tools.
Quick Start
Prerequisites
Python 3.11+
Poetry
A running ros2_medkit gateway
Installation
git clone https://github.com/selfpatch/ros2_medkit_mcp.git
cd ros2_medkit_mcp
poetry install
Running the Server
stdio transport (for Claude Desktop, VS Code):
poetry run ros2-medkit-mcp-stdio
HTTP transport (for remote access):
poetry run ros2-medkit-mcp-http --host 0.0.0.0 --port 8765
Configuration
The server is configured via environment variables:
Variable |
Default |
Description |
|---|---|---|
|
|
Base URL of the gateway API |
|
(none) |
Optional JWT token for authentication |
|
|
HTTP request timeout in seconds |
Claude Desktop Integration
Add to your claude_desktop_config.json:
{
"mcpServers": {
"ros2_medkit": {
"command": "poetry",
"args": ["run", "ros2-medkit-mcp-stdio"],
"cwd": "/path/to/ros2_medkit_mcp",
"env": {
"ROS2_MEDKIT_BASE_URL": "http://localhost:8080/api/v1"
}
}
}
}
VS Code Integration
Create .vscode/mcp.json in your workspace:
Option 1: stdio transport (local)
{
"servers": {
"ros2_medkit": {
"type": "stdio",
"command": "poetry",
"args": ["run", "ros2-medkit-mcp-stdio"],
"cwd": "/path/to/ros2_medkit_mcp",
"env": {
"ROS2_MEDKIT_BASE_URL": "http://localhost:8080/api/v1"
}
}
}
}
Option 2: HTTP transport (Docker/remote)
{
"servers": {
"ros2_medkit": {
"type": "sse",
"url": "http://localhost:8765/mcp"
}
}
}
Docker Usage
# Run HTTP server
docker run -p 8765:8765 \
-e ROS2_MEDKIT_BASE_URL=http://host.docker.internal:8080/api/v1 \
ghcr.io/selfpatch/ros2_medkit_mcp:latest
# Run with stdio transport
docker run -i ghcr.io/selfpatch/ros2_medkit_mcp:latest stdio
MCP Tools Reference
Discovery Tools
Tool |
Description |
|---|---|
|
Get SOVD API version information |
|
List all entities (areas, components, apps, functions) |
|
Get a specific entity by ID |
|
List components within an area |
Faults Tools
Tool |
Description |
|---|---|
|
List faults for a component |
|
Get specific fault details |
|
Clear/acknowledge a fault |
Data Tools
Tool |
Description |
|---|---|
|
Read all topic data from an entity |
|
Read data from a specific topic |
|
Publish data to a topic |
Operations Tools
Tool |
Description |
|---|---|
|
List operations (services/actions) for a component |
|
Call a service or send an action goal |
|
Get action execution status |
|
List all executions for an operation |
|
Cancel a running action |
Configurations Tools
Tool |
Description |
|---|---|
|
List parameters for a component |
|
Get a parameter value |
|
Set a parameter value |
|
Reset parameter to default |
|
Reset all parameters |
Example Prompts
Once configured, try these prompts with your LLM:
“List all components in the system”
“What faults are reported by the lidar sensor?”
“Show me the current temperature reading”
“Call the calibrate service on the camera component”
“What parameters does the sensor node have?”
Repository
See Also
Getting Started — Basic gateway setup
Configuring Authentication — Configure JWT authentication
REST API Reference — REST API reference