ros2-mcp
Provides tools for inspecting and controlling ROS2 graphs, including topics, nodes, services, parameters, actions, and TF frames, with support for mock and live modes.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@ros2-mcplist topics"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
ros2-mcp
ros2-mcp is an MCP (Model Context Protocol) server so AI agents (Grok, Cursor, Claude, …) can inspect and control ROS2 graphs — topics, nodes, services, TF, actions — without hand-writing every ros2 CLI call.
Product: mergeos-bounties/ros2-mcp
Install (one command)
Grok — recommended
pip install "git+https://github.com/mergeos-bounties/ros2-mcp.git" && grok plugin install mergeos-bounties/ros2-mcp --trustThis installs the Python CLI (ros2-mcp) and the Grok plugin (skill + MCP server from .mcp.json).
Check:
ros2-mcp version
ros2-mcp doctor
ros2-mcp demo
grok plugin list
grok mcp listLocal clone:
git clone https://github.com/mergeos-bounties/ros2-mcp.git
cd ros2-mcp
pip install -e ".[dev]"
grok plugin install . --trustOther agents (stdio MCP)
After pip install "git+https://github.com/mergeos-bounties/ros2-mcp.git", point any MCP host at:
Field | Value |
command |
|
args |
|
env |
|
Claude Desktop — merge examples/claude_desktop_config.json into Claude MCP config.
Cursor — merge examples/cursor_mcp.json.
Grok config.toml (manual, without plugin):
[mcp_servers.ros2_mcp]
command = "ros2-mcp"
args = ["serve"]
env = { ROS2_MCP_MODE = "mock" }Or one-shot:
pip install "git+https://github.com/mergeos-bounties/ros2-mcp.git"
grok mcp add ros2-mcp -- ros2-mcp serveRelated MCP server: ROS 2 MCP Server
Supported AI agents / hosts
Agent / Host | MCP support | Setup |
Grok (CLI / TUI / Build) | Yes |
|
Claude Desktop | Yes | Copy examples/claude_desktop_config.json into Claude MCP settings |
Cursor | Yes | Merge examples/cursor_mcp.json into Cursor MCP config |
Claude Code | Yes | stdio MCP: same |
VS Code (MCP / Continue / Cline) | Yes | Generic stdio server config pointing at |
Windsurf / Cascade | Yes | stdio MCP entry with |
Codex CLI | Yes (stdio) | Register MCP server command |
ChatGPT Desktop | Partial | Only if host supports custom MCP stdio servers |
Gemini CLI | Partial | Only if MCP stdio plugins are enabled |
All packages speak MCP over stdio (ros2-mcp serve). Default mode is mock (offline, no simulator/terminal/GIMP required).
Table of contents
Modes
All packages ship with mock mode as the default.
Parameter names and value: "<redacted-live-value>" so MCP host transcripts
and CI logs do not accidentally capture runtime configuration. Use
ROS2_MCP_MODE=live only when a live ROS2 graph is available.
Feature | Mock | Live |
Topic list | ✅ | ✅ |
Topic echo | ✅ | ✅ |
Topic publish | ✅ | ✅ |
Node list | ✅ | ✅ |
Service list | ✅ | ✅ |
Service call | ✅ | ✅ |
TF tree | ✅ | ✅ |
Actions | ✅ | ✅ |
Requires ROS2 | No | Yes |
Highlights
Capability | Description |
Offline demo |
|
MCP stdio serve | Plug into agent hosts as an MCP server |
One-shot call |
|
Tool list | Discover registered MCP tools |
Quick start
git clone https://github.com/mergeos-bounties/ros2-mcp.git
cd ros2-mcp
pip install -e ".[dev]"
ros2-mcp version
ros2-mcp demo
ros2-mcp tools listDocker image
Build a ROS2 Humble image with ros2-mcp installed into an isolated Python
environment:
docker build -t ros2-mcp:humble .
docker run --rm ros2-mcp:humble demoServe MCP over stdio from the container:
docker run --rm -i ros2-mcp:humble serveCLI reference
Command | Description |
| Version + mode |
| Offline smoke of core backend APIs |
| MCP server over stdio (for hosts) |
| Same, plus structured JSON tool-call logs on stderr |
| One-shot tool call (mock/live) |
| List MCP tools |
| Parsed mock topic publish-rate sample |
| Read Lappa |
| Send Lappa |
Lappa HTTP bridge tools
Issue #33 adds optional Lappa simulator HTTP bridge helpers while keeping the package safe for offline CI and MCP hosts. Configure a live bridge with:
export ROS2_MCP_LAPPA_URL=http://127.0.0.1:8765Available tools:
Tool | HTTP path | Fallback |
|
| returns deterministic mock pose when Lappa is down |
|
| echoes a mock-safe cmd_vel + synthetic pose when Lappa is down |
CLI examples:
ros2-mcp call lappa_pose
ros2-mcp call lappa_cmd_vel linear_x=0.3 angular_z=0.1Both commands avoid secrets and only use a local/user-configured base URL.
MCP resources
In addition to tools, the server exposes an MCP resource template so hosts can inspect the ROS2 graph structure.
Note: the MCP SDK's URI-template matcher binds a single path segment, so a
ros2-mcp serveemits structured JSON logs to stderr only. The MCP stdio transport uses stdout for the JSON-RPC protocol stream, so any log written to stdout would corrupt the protocol and break the host connection. All logging goes to stderr, leaving stdout clean for MCP.
Command | Level | Description |
| INFO | Lifecycle only: one |
| DEBUG | Per-tool-call records: |
{"ts": 1712345678.9, "level": "DEBUG", "logger": "ros2_mcp", "msg": "tool_call", "tool": "ros2_list_topics", "duration_ms": 1.42, "status": "ok"}To capture logs to a file:
ros2-mcp serve --verbose 2> ros2-mcp.logMCP host config
{
"mcpServers": {
"ros2-mcp": {
"command": "ros2-mcp",
"args": ["serve"],
"env": {
"ROS2_MCP_MODE": "mock"
}
}
}
}Set ROS2_MCP_MODE=live only on machines with a working ROS2 environment.
Diagrams
Architecture
Workflow
Repository layout
ros2-mcp/
├── src/ros2_mcp/
│ ├── __init__.py
│ ├── server.py # FastMCP tools
│ ├── mock_backend.py # Mock ROS2 graph
│ └── live_backend.py # Live ROS2 graph
├── tests/
├── docs/
├── examples/
├── scripts/
├── .mcp.json
└── pyproject.tomlDevelopment
git clone https://github.com/mergeos-bounties/ros2-mcp.git
cd ros2-mcp
pip install -e ".[dev]"
pytest -q
ruff check src/
ros2-mcp demoMergeOS bounties
Star → claim → PR master → MRG 25–200. Evidence: CLI logs / MCP host config snippets (redact secrets).
License
MIT
Configuration
See MCP_HOST_CONFIG.md for Claude/Cursor setup.
IDE Configuration
Cursor MCP Config — Copy-paste configuration for Cursor IDE with mock/live modes
Live vs Mock Safety Matrix — Safety considerations for live vs mock modes
This server cannot be deployed
Maintenance
Related MCP Connectors
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
MCP server for building and testing AI agents with multi-model experimentation and insights.
MCP Server for an Agent Task Marketplace
MCP server for secureFlows: token-free URL builders and integration-linting tools for AI agents.
Related MCP Servers
- AlicenseNot gradedqualityAmaintenancePublic implementation of MCP for ROS 2 enabling to interact with system visible various robots, capable of: List available topics List available services Call service Subscribe topic to get messages Publish message on topic and more87Mozilla Public 2.0
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server for ROS 2, enabling AI assistants to introspect and interact with ROS 2 systems.2MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server for ROS 2 environments that connects via rosbridge WebSocket, enabling topic/service introspection, publish/subscribe, service calls, robot connectivity checks, and polishing pipeline operations.Apache 2.0
- AlicenseNot gradedqualityBmaintenanceMCP server enabling AI agents to control RViz2 displays, fixed frames, and views, with offline mock support for CI and demos.6MIT