Skip to main content
Glama
Yutarop
by Yutarop
README.md
## ROS MCP
[![Trust Score](https://archestra.ai/mcp-catalog/api/badge/quality/Yutarop/ros-mcp)](https://archestra.ai/mcp-catalog/yutarop__ros-mcp)
![ROS2-humble Industrial CI](https://github.com/Yutarop/ros-mcp/actions/workflows/ros2_humble_ci.yml/badge.svg)

**ROS MCP** is a MCP server designed for controlling robots in ROS environments using natural language. 
It supports communication via ROS topics, services, and actions, and works with any ROS message type.

## Demo
#### Test to see if ros topics, services, and actions can be used.
https://github.com/user-attachments/assets/61143c37-fb73-4998-9cbc-844d92ae61d9

##### Prompt used (Topic)
> Open gazebo with TurtleBot3 and publish topic to move it.

##### Prompt used (Service)
> Show me service list and call service to reset the world in Gazebo.

##### Prompt used (Action)
> Show me action list and call action to move the TurtleBot3 forward for 1m.

## Components
- **Socket Server** ([`socket_server.py`](https://github.com/Yutarop/ros-mcp/blob/main/src/socket_server.py)): A lightweight server that runs on localhost:8765 to handle GUI-related operations. 
It receives instructions from the MCP server to launch tools such as `Gazebo` or `rqt_graph` on the local display.

- **MCP Server** ([`ros-general.py`](https://github.com/Yutarop/ros-mcp/blob/main/ros-general.py)): A Python-based server that implements the MCP.
It processes natural language input, maps it to ROS commands, and communicates with the socket server.
To enable node communication between the MCP server and the local machine, both must be configured with the same `ROS_DOMAIN_ID` on the same local network.

## Overview of MCP Tools
- `Topic Management`: List, monitor, and publish to ROS2 topics
- `Node Control`: List and inspect running ROS2 nodes
- `Service Interaction`: Call ROS2 services with custom
- `Action Support`: Send goals to ROS2 actions
- `GUI Integration`: Launch ROS2 GUI tools via WebSocket server
- `Environment Debugging`: Check ROS2 setup and configuration
- `Process Management`: Clean up running ROS2 processes

Please refer [here](https://github.com/Yutarop/ros-mcp/wiki/Available-Tools) for more details.

## Getting Started
#### Requirements
- ROS2 Humble Hawksbill (This project has only been tested with ROS2 Humble. Compatibility with other ROS2 distributions is not guaranteed.)
- claude desktop ([Linux](https://github.com/aaddrick/claude-desktop-debian), [macOS](https://claude.ai/download) and [Windows](https://claude.ai/download))
- Python 3.10+
- websockets >= 15.0.1
- uv package manager ([Installing uv](https://docs.astral.sh/uv/getting-started/installation/))
- Other dependencies as listed in `pyproject.toml`

### Installation
#### Git clone and install websockets package
```bash
git clone git@github.com:Yutarop/ros-mcp.git
cd ros-mcp
pip install "websockets>=15.0.1"
```

#### Activate .venv and install dependencies
```bash
uv venv
source .venv/bin/activate
uv pip install -e .
```

#### Claude Settings (`claude_desktop_config.json`)
To use the MCP server correctly with Claude Desktop, you need to modify the claude_desktop_config.json file with appropriate values.
```
{
  "mcpServers": {
    "ros-general": {
      "command": "uv",
      "args": [
        "--directory",
        "/ABSOLUTE/PATH/TO/PARENT/FOLDER/ros-mcp",
        "run",
        "bash",
        "-c",
        "export ROS_LOG_DIR=/tmp && export ROS_DOMAIN_ID=${ROS_DOMAIN_ID:-YOUR_ROS_DOMAIN_ID} && source /opt/ros/humble/setup.bash && python3 /ABSOLUTE/PATH/TO/PARENT/FOLDER/ros-general.py"
      ]
    }
  }
}
```
##### **💡 Replace the following placeholders:**
- `/ABSOLUTE/PATH/TO/PARENT/FOLDER/ros-mcp`
Replace with the absolute path the ros-mcp directory. 
For example: /home/ubuntu/ros-mcp

- `YOUR_ROS_DOMAIN_ID`
  Replace with the ROS domain ID used in your environment to enable ROS communication between the MCP server and your local machine. If you're not sure what your current domain ID is, you can check it by running the following command in your terminal:
  ```bash
  echo $ROS_DOMAIN_ID
  ```
  If nothing is printed, the domain ID is not set, and the default value 0 will be used.
  Alternatively, you can set it manually using the following command:
  ```bash
  export ROS_DOMAIN_ID=10  # Replace 10 with your desired domain ID
  ```
- `/ABSOLUTE/PATH/TO/PARENT/FOLDER/ros-general.py`
Replace with the absolute path to your ros-general.py script.
For example: /home/ubuntu/ros-mcp/ros-general.py

## Running the Servers
#### Start MCP server
Make sure your virtual environment is activated before running the MCP server:
```bash
(ros-mcp) $ uv run ros-general.py
```
#### Start socket server
```bash
python3 socket_server.py
```
 > 💡not in the virtual environment!

TDQS

A3.7/5.0

Scored across 24 tools

Disambiguation5/5

Each tool targets a distinct ROS 2 operation (e.g., call service, echo topic, launch simulation, list nodes). Despite some similar verbs like 'check' and 'get', the descriptions clearly differentiate the tools, leaving no ambiguity.

Naming Consistency4/5

Tool names consistently use verb_noun pattern, but there is minor inconsistency in whether 'ros2' is included in the noun (e.g., 'list_topics' vs 'list_ros2_services'). This slight deviation from perfect uniformity justifies a 4.

Tool Count4/5

With 24 tools, the set is comprehensive but slightly above the typical 3-15 range for well-scoped servers. However, each tool serves a clear purpose in the ROS 2 ecosystem, so it is not excessive.

Completeness4/5

The tool set covers major ROS 2 interactions: listing, publishing, service calls, actions, node info, and launching simulations. Minor gaps like a specific stop-node tool are absent, but agents can work around using 'clean_all_ros2_nodes' or other means.

Maintenance

ActivityInactive
ResponsivenessNo issues