Overview
What is ros2-mcp-server?
ros2-mcp-server is a Python-based server that integrates the Model Context Protocol (MCP) with ROS 2, enabling AI assistants to control robots via ROS 2 topics. It processes commands through FastMCP and runs as a ROS 2 node, publishing geometry_msgs/Twist messages to the /cmd_vel topic to control robot movement.
How to use ros2-mcp-server?
Install dependencies and configure the server as an MCP transport in your client (e.g., Claude Desktop or Cline in VSCode) using the provided JSON block with uv and a bash command that sources ROS 2 and runs the script. Then send natural language movement commands or use the move_robot tool directly with linear/angular velocity and duration.
Key features of ros2-mcp-server
- MCP integration via FastMCP for AI assistant commands.
- Operates as a ROS 2 node publishing to
/cmd_vel. - Supports time‑based movement with duration and stop.
- Asynchronous processing using asyncio and ROS 2 event loop.
- Uses stdio transport for MCP client communication.
- Compatible with ROS 2 Humble and Python 3.10.
Use cases of ros2-mcp-server
- Command a robot to move forward for a specific duration.
- Test robot movement in Gazebo with TurtleBot3.
- Integrate an AI assistant like Claude with a physical robot.
- Prototype voice or text‑driven robot navigation tasks.
FAQ from ros2-mcp-server
What ROS 2 distribution is required?
ROS 2 Humble must be installed and sourced.
What Python version is needed?
Python 3.10 is required for compatibility with ROS 2 Humble.
What topic does the server publish to?
It publishes geometry_msgs/Twist messages to the /cmd_vel topic.
Can I use other topics or services?
Currently only /cmd_vel is supported. Extend ros2-mcp-server.py to add other topics or services.
How do I verify the robot is receiving commands?
Run ros2 topic echo /cmd_vel to monitor the published twist messages.