mcp_server_ros_2 — Claude Code MCP server: features and setup
This MCP server lets an AI agent inspect ROS 2 topics and interact with services and actions. Use it to work with a live ROS 2 graph from an MCP client.
claude mcp add --env MCP_CUSTOM_PROMPTS=<MCP_CUSTOM_PROMPTS> --env MCP_PROMPTS_LOCAL=<MCP_PROMPTS_LOCAL> --env MCP_PROMPTS_PATH=<MCP_PROMPTS_PATH> --env MCP_PROMPTS_MODULE=<MCP_PROMPTS_MODULE> --transport stdio mcp-server-ros-2 -- docker run -i --rm -e MCP_CUSTOM_PROMPTS -e MCP_PROMPTS_LOCAL -e MCP_PROMPTS_PATH -e MCP_PROMPTS_MODULE docker.io/mcp/ros2:latestWhat mcp_server_ros_2 does
The server connects to ROS 2 through rclpy. An agent can discover nodes, topics, services, and actions, read topic messages, publish data, or send action goals. Other tools turn occupancy maps and point clouds into images, and a viewer supports clients with Apps.
Docker and an MCP client are enough to run the container; ROS 2 need not be installed on the host. The supported ROS 2 distributions are Humble and Jazzy. ROS 1 is unsupported, so this server won’t work with a ROS 1 system. Read-only mode removes tools that can change robot state.
What it helps with
- discover ROS 2 topics and services
- read messages from a topic
- publish data to a topic
- call a service or send an action goal
- render a map or point cloud as an image
Example prompts for the agent
- List the available ROS 2 topics and read messages from the one I name.
- Publish a message to this topic, then tell me which service to call.
- Turn the ROS 2 map into an image and show me the result.
How to install mcp_server_ros_2
Platform CLI
claude mcp add --env MCP_CUSTOM_PROMPTS=<MCP_CUSTOM_PROMPTS> --env MCP_PROMPTS_LOCAL=<MCP_PROMPTS_LOCAL> --env MCP_PROMPTS_PATH=<MCP_PROMPTS_PATH> --env MCP_PROMPTS_MODULE=<MCP_PROMPTS_MODULE> --transport stdio mcp-server-ros-2 -- docker run -i --rm -e MCP_CUSTOM_PROMPTS -e MCP_PROMPTS_LOCAL -e MCP_PROMPTS_PATH -e MCP_PROMPTS_MODULE docker.io/mcp/ros2:latestReplace <…> with your own values
Platform CLI
codex mcp add mcp-server-ros-2 --env MCP_CUSTOM_PROMPTS=<MCP_CUSTOM_PROMPTS> --env MCP_PROMPTS_LOCAL=<MCP_PROMPTS_LOCAL> --env MCP_PROMPTS_PATH=<MCP_PROMPTS_PATH> --env MCP_PROMPTS_MODULE=<MCP_PROMPTS_MODULE> -- docker run -i --rm -e MCP_CUSTOM_PROMPTS -e MCP_PROMPTS_LOCAL -e MCP_PROMPTS_PATH -e MCP_PROMPTS_MODULE docker.io/mcp/ros2:latestReplace <…> with your own values
Config file
{
"mcpServers": {
"mcp-server-ros-2": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"MCP_CUSTOM_PROMPTS",
"-e",
"MCP_PROMPTS_LOCAL",
"-e",
"MCP_PROMPTS_PATH",
"-e",
"MCP_PROMPTS_MODULE",
"docker.io/mcp/ros2:latest"
],
"env": {
"MCP_CUSTOM_PROMPTS": "<MCP_CUSTOM_PROMPTS>",
"MCP_PROMPTS_LOCAL": "<MCP_PROMPTS_LOCAL>",
"MCP_PROMPTS_PATH": "<MCP_PROMPTS_PATH>",
"MCP_PROMPTS_MODULE": "<MCP_PROMPTS_MODULE>"
}
}
}
}Replace <…> with your own values
Config file
{
"servers": {
"mcp-server-ros-2": {
"type": "stdio",
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"MCP_CUSTOM_PROMPTS",
"-e",
"MCP_PROMPTS_LOCAL",
"-e",
"MCP_PROMPTS_PATH",
"-e",
"MCP_PROMPTS_MODULE",
"docker.io/mcp/ros2:latest"
],
"env": {
"MCP_CUSTOM_PROMPTS": "<MCP_CUSTOM_PROMPTS>",
"MCP_PROMPTS_LOCAL": "<MCP_PROMPTS_LOCAL>",
"MCP_PROMPTS_PATH": "<MCP_PROMPTS_PATH>",
"MCP_PROMPTS_MODULE": "<MCP_PROMPTS_MODULE>"
}
}
}
}Replace <…> with your own values
Platform CLI
gemini mcp add -e MCP_CUSTOM_PROMPTS=<MCP_CUSTOM_PROMPTS> -e MCP_PROMPTS_LOCAL=<MCP_PROMPTS_LOCAL> -e MCP_PROMPTS_PATH=<MCP_PROMPTS_PATH> -e MCP_PROMPTS_MODULE=<MCP_PROMPTS_MODULE> mcp-server-ros-2 docker run -i --rm -e MCP_CUSTOM_PROMPTS -e MCP_PROMPTS_LOCAL -e MCP_PROMPTS_PATH -e MCP_PROMPTS_MODULE docker.io/mcp/ros2:latestReplace <…> with your own values
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about mcp_server_ros_2
How do I install mcp_server_ros_2 in Claude Code?
Add the server with `claude mcp add --env MCP_CUSTOM_PROMPTS=<MCP_CUSTOM_PROMPTS> --env MCP_PROMPTS_LOCAL=<MCP_PROMPTS_LOCAL> --env MCP_PROMPTS_PATH=<MCP_PROMPTS_PATH> --env MCP_PROMPTS_MODULE=<MCP_PROMPTS_MODULE> --transport stdio mcp-server-ros-2 -- docker run -i --rm -e MCP_CUSTOM_PROMPTS -e MCP_PROMPTS_LOCAL -e MCP_PROMPTS_PATH -e MCP_PROMPTS_MODULE docker.io/mcp/ros2:latest`. Docker is required to run the container.
What does mcp_server_ros_2 do?
It connects an MCP client to a ROS 2 graph, letting an agent inspect topics and interact with services and actions. It can also render maps and point clouds as images.
Which ROS 2 distributions does mcp_server_ros_2 support?
It supports ROS 2 Humble and Jazzy. ROS 1 is not supported.