Skip to main content
Glama
README.md

# ROS2 MCP Server

![ROS 2 Humble](https://img.shields.io/badge/ROS2-Humble-blue)
![ROS 2 Jazzy](https://img.shields.io/badge/ROS2-Jazzy-purple)

![Flow graph](docs/assets/flow-graph.gif)

A **Python** implementation of the **Model Context Protocol (MCP)** for **ROS2**. This server enables AI tooling to connect with **ROS2** nodes, topics, and services using the **MCP** standard over **stdio**. It is designed to be **the easiest** **ROS2** server to configure **in the world**.
## 🎯 Why Choose This MCP Server?

**Save hours of development time** with native AI integration for your ROS2 projects:

- **⚑ 1-minute setup** - World's easiest ROS2 MCP configuration
- **0️⃣ Zero-friction setup** - stdio transport, no brokers, no webserver.
- **πŸ”Œ Auto-discovery** - a built-in β€œlist interfaces” tool dynamically enumerates available topics and services together with their message/service definitions (fields, types, schema) β€” so the client always knows exactly what data can be published or called. 
- **πŸ€– AI-powered debugging** - Let AI help you troubleshoot ROS2 issues in real-time
- **πŸ“Š Smart data analysis** - Query your robot's sensor data using natural language
- **πŸš€ Boost productivity** - Control robots, analyze logs, and debug issues through AI chat
- **πŸ’‘ No ROS2 expertise required** - AI translates your requests into proper ROS2 commands

**Perfect for:** Robotics developers, researchers, students, and anyone working with ROS2 who wants to leverage AI for faster development and debugging.

# 🌍 Real-world examples:
![Demo](docs/assets/mcp-ros2-server.gif)

# ✨ Features
- List available topics 
- List available services 
- Call service
- Get messages from data storage systems (influxDB alternative to Rosbag2)
- Subscribe topic to get messages
- Publish message on topic
- Echo message on topic
- Get fields from message type


**Note:** To call service with custom service source it before start server.


# βš™οΈ Installation

Follow the [installation guide](installation/README.md) for step-by-step instructions:
- [🧩 Install in Visual Studio Code Copilot](installation/README.md#configure-visual-studio-code-copilot)
- [πŸ€– Install in Claude Desktop](installation/README.md#configure-claude-desktop)
- [πŸ’» Install in Warp](installation/README.md#configure-warp)
- [🐳 Build Docker Image locally](installation/README.md#build-docker-image-locally)



### πŸ”§ ROS 2 Tools

#### πŸ“‹ **Topics**
| Tool | Description | Inputs | Outputs |
|------|-------------|--------|---------|
| **`ros2_topic_list`** | Returns list of available topics | – | `topic_name` (string): Topic name <br> `topic_type` (string): Message type |
| **`ros2_topic_subscribe`** | Subscribes to a ROS 2 topic and collects messages for a duration or message limit | `topic_name` (string) <br> `duration` (float) <br> `message_limit` (int) <br> *(defaults: first msg, 5s)* | `messages` <br> `count` <br> `duration` |
| **`ros2_get_messages`** | Retrieves past messages from a topic (data black box) | `topic_name` (string) <br> `message_type` (string) <br> `number_of_msg` (int) <br> `time_start` (str) <br> `time_end` (str) | `timestamps` <br> `messages` |
| **`ros2_get_message_fields`** | Gets field names and types for a message type | `message_type` (string) | Field names + types |
| **`ros2_topic_publish`** | Publishes message to a topic | `topic_name` (string) <br> `message_type` (string) <br> `data` (dict) | `status` |

---

#### πŸ›  **Services**
| Tool | Description | Inputs | Outputs |
|------|-------------|--------|---------|
| **`ros2_service_list`** | Returns list of available services | – | `service_name` (string) <br> `service_type` (string) <br> `request_fields` (array) |
| **`ros2_service_call`** | Calls a ROS 2 service | `service_name` (string) <br> `service_type` (string) <br> `fields` (array) <br> `force_call` (bool, default: false) | `result` (string) <br> `error` (string, if any) |


# 🐞 Debugging

Since MCP servers run over stdio, debugging can be challenging. For the best debugging
experience, we strongly recommend using the [MCP Inspector](https://github.com/modelcontextprotocol/inspector).

You can launch the MCP Inspector via [ `npm` ](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) with this command:

```bash
npx @modelcontextprotocol/inspector uv --directory /path/to/mcp_server_ros2 run mcp_ros_2_server
```

Upon launching, the Inspector will display a URL that you can access in your browser to begin debugging.