# mcp_server_ros_2

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.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 95
- Author: wise-vision
- License: MPL-2.0 · policy=link-only · description only; the file stays with the author
- Source: https://github.com/wise-vision/ros2_mcp
- Updated: 2026-10-21
- HTML: https://affpapa.org/en/nevibecode/mcp/mcp-server-ros-2

## What it 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.

## Requirements
- Needs: Docker
- Environment variables: `MCP_CUSTOM_PROMPTS`, `MCP_PROMPTS_LOCAL`, `MCP_PROMPTS_PATH`, `MCP_PROMPTS_MODULE` — keys and tokens: ask the human for the values, never commit them or put them in shared files.

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
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
```
Replace <…> with your own values

### Codex

**Platform CLI**
```bash
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:latest
```
Replace <…> with your own values

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "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

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "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

### Gemini CLI

**Platform CLI**
```bash
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:latest
```
Replace <…> with your own values

## When to use it
- 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
- 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.

## Similar
- [MCP Toolbox for Databases](https://affpapa.org/en/nevibecode/mcp/googleapis-mcp-toolbox-for-databases.md) — MCP server · ★ 16717
- [labelhead-artist-momentum](https://affpapa.org/en/nevibecode/mcp/labelhead-artist-momentum.md) — MCP server · ★ 107423
- [Agent Skills Search Server](https://affpapa.org/en/nevibecode/mcp/agent-skills-search-server.md) — MCP server · ★ 26559
- [Skyvern](https://affpapa.org/en/nevibecode/mcp/skyvern.md) — MCP server · ★ 23263
- [Nhost](https://affpapa.org/en/nevibecode/mcp/nhost.md) — MCP server · ★ 9366
- [PraisonAI](https://affpapa.org/en/nevibecode/mcp/praisonai.md) — MCP server · ★ 9289

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
