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.
rosbridge
installedgit clone https://github.com/robotmcp/ros-mcp-server.git
cd ros-mcp-server
uv
package manager:pip install uv
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
uv pip install -r requirements.txt
rosbridge
on your robot system:For ROS1:
roslaunch rosbridge_server rosbridge_websocket.launch
For ROS2:
ros2 launch rosbridge_server rosbridge_websocket_launch.xml
python mcp_server.py
Configure your LLM client (like Claude Desktop) to use the MCP server:
http://localhost:8000
(or the appropriate address if running remotely)Once connected, you can use natural language to interact with your robot through commands like:
list topics
show topic /camera/image_raw
subscribe to /odom
publish to /cmd_vel {linear: {x: 0.2, y: 0, z: 0}, angular: {x: 0, y: 0, z: 0.1}}
list services
show service /spawn_entity
call service /set_model_state {model_state: {model_name: 'robot', pose: {position: {x: 1.0, y: 2.0, z: 0.0}}}}
list parameters
get parameter /use_sim_time
set parameter /max_velocity 0.5
rosbridge
is running with: rosnode list
or ros2 node list
ps aux | grep mcp_server
list topics
or list services
show topic /topic_name
before publishingTo 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.
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.
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"
]
}
}
}
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.
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.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.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