ros2-mcp-server
Integrates with LangChain framework to allow AI agents to interact with ROS2 robots, including reading sensor data, tuning PID controllers, publishing velocity commands, and performing kinematic trajectory predictions.
Enables OpenAI SDK-based agents (e.g., GPT-4o) to interact with ROS2 robots, including reading sensor data, tuning PID controllers, publishing velocity commands, and performing kinematic trajectory predictions.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@ros2-mcp-serverWhat's the current battery level on the robot?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
The World's First Universal Physical AI Coprocessor & MCP Gateway for ROS2
Connect 1,000+ AI Models (Claude, GPT-4o, Gemini 2.0, DeepSeek R1, Llama 3) to Real Robots & Gazebo Simulations with 3-Tier Execution Sandboxing and Fast-Forward Kinematic Trajectory Prediction.
๐ Overview ยท โก Quick Start ยท ๐ 1000+ AI Matrix ยท ๐ World-First Features ยท ๐ ๏ธ Tools ยท ๐ Safety ยท ๐ฌ Community
๐ Supported AI Clients & Frameworks
Related MCP server: ROS2 MCP Server
๐ง What This Solves
Robotics engineers face a massive friction point when integrating AI models into physical workflows:
"I want to ask Claude or GPT-4o why my quadcopter is oscillating โ but copy-pasting 10,000 lines of ROS2 topic sensor dumps into a chat window is tedious and dangerous."
ros2-mcp-server solves this permanently. It creates a high-throughput, bidirectional bridge between any MCP-compatible AI agent and a ROS2 DDS network:
๐ก Live Sensor Introspection: Stream telemetry from
/scan,/imu/data,/battery_state,/odom๐ฎ Pre-Execution Kinematic Simulation: Simulate $(x,y,\theta)$ trajectories in <0.1ms compute before actuation
๐ก๏ธ Predictive Neural Safety: Auto-correct excessive velocity or negative PID gains with mathematical proof
๐บ๏ธ Spatial ASCII Radar Visualizer: Render 360ยฐ LiDAR pointclouds into text-based 2D spatial maps
๐ Multi-Robot Swarm Orchestration: Intercept and manage
/drone_1,/rover_2,/arm_3in one session๐๏ธ Sandboxed Control: Tune controller PID parameters and publish velocity commands safely
๐ World-First Unimagined Innovations
1. ๐ฎ Kinematic Trajectory Predictor (predict_trajectory)
Runs a 1000Hz fast-forward kinematic physics simulation (<0.1ms compute) before any motion command reaches hardware. Predicts $(x, y, \theta)$ position trajectories, dynamic stability margins, and obstacle risk in virtual time.
2. ๐ก๏ธ Predictive Neural Safety Guard (predictive_safety_check)
Evaluates proposed parameter or velocity commands against motor torque limits. If an LLM proposes an unstable input (e.g. negative PID gains), the server automatically caps the values to safe physics bounds and feeds the mathematical proof back to the AI.
3. ๐บ๏ธ Spatial ASCII Radar Map (get_spatial_map)
Converts raw 360ยฐ LaserScan pointclouds into a 2D ASCII spatial map directly in MCP response JSON, allowing text & vision LLMs to "see" surrounding space:
+------------------+ [R] = Robot Center (0,0)
| . * . | [*] = Detected Obstacle Point
| . [R] . | [.] = Clear Navigable Space
| . . |
+------------------+ Heading: 0.0 rad | Clear Path: RIGHT4. ๐ Multi-Robot Swarm Fleet Orchestrator (swarm_fleet_status)
Aggregates and coordinates multi-namespace ROS2 fleets (/drone_1, /rover_2, /arm_3) within a single unified MCP session.
โก Quick Start (60 Seconds)
1. Frictionless 1-Line Installer
curl -sSL https://raw.githubusercontent.com/EngineerAbdullahBinZafar/ros2-mcp-server/main/install.sh | bash2. System Diagnostic Check (doctor)
Run our CLI diagnostic doctor to verify Python runtime, rclpy status, and client config files:
ros2-mcp-server doctor3. Instant Simulation Playground
No physical robot nearby? Spin up our built-in virtual robot:
ros2-mcp-server --demo-sim๐ ๏ธ Available MCP Tools (16 Tools)
Tool Name | Innovation / Function | Category |
| Test bridge latency & active node count | System |
| Full health check (battery, LiDAR, IMU, issues) | Health |
| List active ROS2 topics & message types | Graph |
| Read message from topic (latched support) | Data |
| Sandboxed message publisher | Actuation |
| Parallel fetch of LiDAR + IMU + Battery + Odom | Parallel |
| Enumerate active nodes & namespaces | Graph |
| Inspect node publishers, subscribers & services | Graph |
| Read live parameters from running node | Params |
| Sandboxed parameter update | Params |
| Read Kp, Ki, Kd gains & stability bounds | Control |
| Apply new PID gains with engineering advice | Control |
๐ฎ | [WORLD-FIRST] Kinematic pre-simulation of trajectory ($x,y,\theta$) | Innovation |
๐ก๏ธ | [WORLD-FIRST] Risk evaluation & auto-correction of LLM inputs | Innovation |
๐บ๏ธ | [WORLD-FIRST] Renders 360ยฐ LiDAR into 2D ASCII radar grid | Innovation |
๐ | [WORLD-FIRST] Multi-namespace ROS2 swarm fleet manager | Innovation |
๐ 3-Tier Execution Sandbox
Level | Set Via | Operational Envelope |
|
| AI can only read telemetry โ zero hardware writes |
|
| Writes restricted to explicit topic/param allowlist |
|
| Unrestricted write access โ use in simulation only |
Every decision is logged in a thread-safe, timestamped audit log:
print(sandbox.get_audit_log())๐๏ธ System Architecture
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ AI Client (Claude / Cursor / GPT-4o) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ MCP stdio / JSON-RPC 2.0
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ros2-mcp-server v1.2.0 โ
โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ O(1) Tool Dispatcher โ โ CommandSandbox โ โ
โ โ (16 Tools <0.08ms) โ โ (3-Tier Safety) โ โ
โ โโโโโโโโโโโโโโฌโโโโโโโโโโโโโ โโโโโโโโโโโโโฌโโโโโโโโโโโโ โ
โ โ โ โ
โ โโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโ โ
โ โ ROS2 Interface Layer (Native / Simulation) โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ DDS / Serial / WebSocket
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ROS2 Robot System โ
โ (Gazebo Sim / TurtleBot / Nav2 / STM32) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ๐ Performance Benchmarks
Tool Dispatch Overhead:
< 0.08 ms($O(1)$ compiled lookup table)Kinematic Simulation:
< 0.10 ms(1000Hz fast-forward compute)Memory Footprint:
~14.2 MBRAMTest Coverage: 42 / 42 Tests Passed (Simulation mode)
๐งช Running Tests
git clone https://github.com/EngineerAbdullahBinZafar/ros2-mcp-server
cd ros2-mcp-server
python run_tests.py๐ Extended Documentation
๐จโ๐ป Author
Abdullah Bin Zafar โ Mechatronics & Control Engineering, UET Lahore
Building robots that think, act, and reason safely.
๐ฌ Community & Support
๐ Found a bug? Open an issue
๐ก Have an idea? Start a discussion
โญ Star the repository to support open-source AI robotics!
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/EngineerAbdullahBinZafar/ros2-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server