The ROS MCP Server enables robots to perform complex tasks by transforming natural language commands into ROS actions. Using WebSocket-based communication through rosbridge, it works with both ROS and ROS2 systems across various platforms, creating a seamless bridge between large language models and robot control systems.
If you're using Claude Desktop, you can install the ROS MCP Server automatically using Smithery:
npx -y @smithery/cli install @lpigeon/ros-mcp-server --client claude
First, install the UV package manager:
curl -LsSf https://astral.sh/uv/install.sh | sh
Or alternatively:
pip install uv
Then create and activate a virtual environment (optional but recommended):
uv venv
source .venv/bin/activate
Create or edit the MCP configuration file with the following content:
{
"mcpServers": {
"ros-mcp-server": {
"command": "uv",
"args": [
"--directory",
"/ABSOLUTE/PATH/TO/PARENT/FOLDER/ros-mcp-server",
"run",
"server.py"
]
}
}
}
The location of this configuration file depends on your operating system:
MacOS:
~/Library/Application\ Support/Claude/claude_desktop_config.json
Linux (Ubuntu):
~/.config/Claude/claude_desktop_config.json
Windows:
%AppData%\Claude\claude_desktop_config.json
Open server.py
and update the following settings to match your environment:
LOCAL_IP
: Your machine's IP addressROSBRIDGE_IP
: IP where rosbridge is runningROSBRIDGE_PORT
: Port for rosbridge (default is 9090)For ROS 1:
roslaunch rosbridge_server rosbridge_websocket.launch
For ROS 2:
ros2 launch rosbridge_server rosbridge_websocket_launch.xml
Launch your AI system that has imported the ROS MCP Server. When you type natural language commands like "Make the robot move forward," the server will convert these to appropriate ROS commands.
You can verify that commands are being processed by:
The ROS MCP Server currently supports these message types:
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 > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
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 explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.