ROS Robot Control MCP server

Provides a bridge between natural language commands and Robot Operating System (ROS) for controlling robot movement through WebSocket communication with velocity commands.
Back to servers
Setup instructions
Provider
Jungsoo Lee
Release date
Apr 26, 2025
Language
Python
Stats
399 stars

The ROS MCP Server connects large language models (such as Claude, GPT, and Gemini) to robots through ROS, enabling bidirectional communication without modifying existing robot code. This integration allows for natural language robot control and gives AI models full visibility into robot sensors and state information.

Installation

Prerequisites

  • Python 3.10+
  • ROS or ROS2
  • A robot with rosbridge installed
  • An MCP-compatible LLM (Claude Desktop, Gemini, ChatGPT, etc.)

Setup Steps

  1. Clone the repository:
git clone https://github.com/robotmcp/ros-mcp-server.git
cd ros-mcp-server
  1. Install uv package manager:
pip install uv
  1. Install rosbridge on your robot:

For ROS1:

sudo apt-get install ros-$ROS_DISTRO-rosbridge-suite

For ROS2:

sudo apt-get install ros-$ROS_DISTRO-rosbridge-server
  1. Install the MCP server dependencies:
uv pip install -r requirements.txt

Usage

Starting the Server

  1. Launch rosbridge on your robot system:

For ROS1:

roslaunch rosbridge_server rosbridge_websocket.launch

For ROS2:

ros2 launch rosbridge_server rosbridge_websocket_launch.xml
  1. Start the MCP server:
python mcp_server.py

Connecting an MCP-Compatible LLM

Configure your LLM client (like Claude Desktop) to use the MCP server:

  1. Open your MCP-compatible client
  2. Navigate to settings and locate the MCP configuration section
  3. Add a new MCP server with the address http://localhost:8000 (or the appropriate address if running remotely)
  4. Save and connect to the server

Available Commands

Once connected, you can use natural language to interact with your robot through commands like:

  • "List all available ROS topics"
  • "Show me the message type for /camera/image_raw"
  • "Subscribe to the /odom topic"
  • "Publish a twist message to move the robot forward"
  • "Call the /set_pose service with x=1.0, y=2.0"
  • "What parameters are available on the robot?"

Core Features

Topic Management

  • List all topics:
list topics
  • View topic details:
show topic /camera/image_raw
  • Subscribe to a topic:
subscribe to /odom
  • Publish to a topic:
publish to /cmd_vel {linear: {x: 0.2, y: 0, z: 0}, angular: {x: 0, y: 0, z: 0.1}}

Service Interaction

  • List available services:
list services
  • View service details:
show service /spawn_entity
  • Call a service:
call service /set_model_state {model_state: {model_name: 'robot', pose: {position: {x: 1.0, y: 2.0, z: 0.0}}}}

Parameter Management

  • List parameters:
list parameters
  • Get a parameter value:
get parameter /use_sim_time
  • Set a parameter:
set parameter /max_velocity 0.5

Example Workflows

Exploring a Robot's Capabilities

  1. Connect to the robot via the MCP server
  2. Ask "What topics are available?"
  3. For interesting topics, ask "What is the message type for /topic_name?"
  4. Subscribe to relevant sensor topics with "Subscribe to /camera/rgb/image_raw"
  5. Monitor data coming from the robot in real-time

Controlling a Mobile Robot

  1. Connect to the robot via the MCP server
  2. Identify the command topic with "Find topics related to movement"
  3. Ask "How do I send a velocity command to this robot?"
  4. Control the robot with "Publish to /cmd_vel a message to move forward at 0.2 m/s"
  5. Monitor the robot's position with "Subscribe to /odom"

Troubleshooting

Connection Issues

  • Verify rosbridge is running with: rosnode list or ros2 node list
  • Check if the MCP server is running: ps aux | grep mcp_server
  • Ensure network connectivity between the LLM client and the MCP server

Command Failures

  • Verify topic/service names with list topics or list services
  • Check message format with show topic /topic_name before publishing
  • Review any error messages in the MCP server console output

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "ros-mcp-server" '{"command":"uv","args":["--directory","/ABSOLUTE/PATH/TO/PARENT/FOLDER/ros-mcp-server","run","server.py"]}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "ros-mcp-server": {
            "command": "uv",
            "args": [
                "--directory",
                "/ABSOLUTE/PATH/TO/PARENT/FOLDER/ros-mcp-server",
                "run",
                "server.py"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "ros-mcp-server": {
            "command": "uv",
            "args": [
                "--directory",
                "/ABSOLUTE/PATH/TO/PARENT/FOLDER/ros-mcp-server",
                "run",
                "server.py"
            ]
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later