SuperAPI AI Directory

ros-mcp

Control robots with natural language via ROS 2 topics, services and actions.

Open website

About this tool

ROS MCP is an MCP (Model Context Protocol)-based server designed for controlling robots in a ROS environment through natural language. It supports communication via ROS topics, services, and actions, and can handle any ROS message type.

Purpose

ROS MCP allows users to interact with robots using natural language instructions, without the need to manually write ROS commands. For example, users can say "Open Gazebo and TurtleBot3, and publish a topic to move it" or "Show the list of services and call a service to reset the world in Gazebo."

Main Capabilities

  • Topic Management: List, monitor, and publish to ROS2 topics.
  • Node Control: List and inspect running ROS2 nodes.
  • Service Interaction: Call custom ROS2 services.
  • Action Support: Send goals to ROS2 actions.
  • GUI Integration: Launch ROS2 GUI tools (such as Gazebo, rqt_graph) via a WebSocket server.
  • Environment Debugging: Inspect ROS2 settings and configuration.
  • Process Management: Clean up running ROS2 processes.

Usage

ROS MCP includes two main components:

  1. Socket Server (socket_server.py): A lightweight server running on localhost:8765 that handles GUI-related operations. It receives instructions from the MCP server and locally displays tools such as Gazebo or rqt_graph when launched.
  2. MCP Server (ros-general.py): A Python-based server that implements 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 and be on the same local network.

Quick Start

  • Ensure you are using ROS2 Humble Hawksbill (tested only on this version; compatibility with other ROS2 distributions is not guaranteed).
  • Requires Claude Desktop (supports Linux, macOS, and Windows).
  • Depends on websockets >= 15.0.1 and the uv package manager.
  • See pyproject.toml for other dependencies.

Configuration

When using Claude Desktop, you need to modify the claude_desktop_config.json file:

  • Replace /ABSOLUTE/PATH/TO/PARENT/FOLDER/ros-mcp with the absolute path to the ros-mcp directory, for example /home/ubuntu/ros-mcp.
  • Replace YOUR_ROS_DOMAIN_ID with the ROS domain ID used in your environment. If unclear, you can run in the terminal echo $ROS_DOMAIN_ID to check; if there is no output, the domain ID is not set and defaults to 0. You can also set it manually, for example export ROS_DOMAIN_ID=10.
  • Replace /ABSOLUTE/PATH/TO/PARENT/FOLDER/ros-general.py with the absolute path to the ros-general.py script, for example /home/ubuntu/ros-mcp/ros-general.py.

Running the Server

Before running the MCP server, make sure the virtual environment is activated.

Applicable Scenarios

ROS MCP is suitable for robot development, simulation testing, and educational scenarios, especially when there is a need to quickly control ROS robots or perform prototype validation through natural language. It can be used with common ROS tools and robots such as the Gazebo simulation environment and TurtleBot3.

Limitations

  • Tested only on ROS2 Humble Hawksbill; compatibility with other ROS2 distributions is unknown.
  • Requires Claude Desktop as the natural language interface.
  • Requires configuring ROS_DOMAIN_ID and ensuring network communication.
  • Specific functionality and performance may be affected by the ROS environment and message types.