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 "Deploy 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-server What'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 Deterministic Physical AI Coprocessor & MCP Gateway for ROS 2
Bridging 1,000+ AI Models (Claude 3.5 Sonnet, GPT-4o, Gemini 2.0, DeepSeek R1, Llama 3) to Real Robots & Gazebo Simulations via 3-Tier Security Sandboxing, Fast-Forward Kinematic Trajectory Prediction, and 2D Spatial LiDAR ASCII Radar.
# โก 1-Command Live Terminal Demonstration (Zero ROS 2 / Zero Cloud Dependencies)
python demo.py๐ Overview ยท โก Quick Start ยท ๐ ๏ธ 16-Tool Catalog ยท ๐ 3-Tier Sandbox ยท ๐ Mathematical Proofs ยท ๐ค Machine Metadata
๐ Supported AI Clients & Frameworks
Related MCP server: ROS MCP
๐ง What This Solves
Robotics engineers and AI researchers face a massive friction point when integrating AI models into physical workflows:
"I want to ask Claude or GPT-4o why my mobile robot or manipulator is oscillating โ but copy-pasting 10,000 lines of ROS 2 topic sensor dumps into a chat window is tedious, slow, and dangerous."
ros2-mcp-server solves this permanently. It establishes a deterministic, bidirectional bridge between any MCP-compatible AI agent and a ROS 2 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.1,\text{ms}$ 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
๐๏ธ Codebase Architecture & Systems Topology
The server operates with zero external runtime dependencies (Python standard library only), providing non-blocking stdio JSON-RPC 2.0 communication while maintaining thread-safe isolation:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Frontier AI Agents & Developer IDEs โ
โ Claude Desktop ยท Cursor ยท Windsurf ยท Antigravity ยท OpenAI Agents โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ JSON-RPC 2.0 via stdio
โ (Line-delimited UTF-8 JSON)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ros2-mcp-server (v1.2.0) โ
โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ JSON-RPC 2.0 Parser โ โ Token Bucket Rate Limiter โ โ
โ โ (stdio framing, spec) โ โ B(t) = min(B_max, B + rฮt)โ โ
โ โโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโ โ
โ โ โ โ
โ โโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโ โ
โ โ CommandSandbox (3-Tier Security Gate, Mutex-Guarded) โ โ
โ โ READ_ONLY โโโบ SAFE_WRITE (Allowlist) โโโบ FULL (Simulation) โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Pass Through / Blocked โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ O(1) Hash Dispatch Table (16 Tools) โ โ
โ โ Measured Lookup Latency: < 0.08 ms โ โ
โ โโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโ โ
โ โ โ โ โ
โ โโโโโโโโผโโโโโโโ โโโโโโโโผโโโโโโโ โโโโโโโโผโโโโโโโ โ
โ โ Diagnostics โ โ Trajectory โ โ Spatial Map โ โ
โ โ & Snapshot โ โ & Neural โ โ 2D LiDAR โ โ
โ โ Telemetriesโ โ Safety โ โ ASCII Radar โ โ
โ โโโโโโโโฌโโโโโโโ โโโโโโโโฌโโโโโโโ โโโโโโโโฌโโโโโโโ โ
โ โ โ โ โ
โ โโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโ โ
โ โ ROS 2 Interface Abstraction Layer โ โ
โ โ rclpy Native (DDS) โโโโบ MockInterface (Sim) โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ DDS / RTPS / Microcontroller Serial
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Physical Robot & Simulation Targets โ
โ Gazebo Harmonic ยท TurtleBot4 ยท ROS 2 Microcontroller Nodes (STM32) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโก Quick Start (60 Seconds)
1. Frictionless Setup
Clone and install the package in development mode:
git clone https://github.com/EngineerAbdullahBinZafar/ros2-mcp-server.git
cd ros2-mcp-server
pip install -e .2. System Diagnostic Check (doctor)
Run the built-in CLI diagnostic doctor to verify runtime environment, rclpy status, and client configs:
python -m ros2_mcp.server --doctor3. Instant Simulation Playground
No physical robot connected? Launch the deterministic simulation mode:
python -m ros2_mcp.server --demo-sim๐ก JSON-RPC 2.0 Protocol & Stdio Transport Specifications
ros2-mcp-server implements the Model Context Protocol (MCP) standard (specification version 2024-11-05) utilizing standard I/O (stdio) as the primary transport mechanism:
1. Transport Framing & Lifecycle
Line-Delimited JSON Framing: Every incoming request from the AI host client is a single UTF-8 line terminated by
\nor\r\n. Responses are serialized withjson.dumps()and emitted onsys.stdoutfollowed by an immediate flush.Diagnostics Logging: Informational messages, warnings, and tracebacks are routed strictly to
sys.stderrprefixed with[ros2-mcp]to avoid corrupting client JSON-RPC parsers.Graceful Shutdown: The server binds signal handlers for
SIGINTandSIGTERM. When receiving a shutdown signal or upon encounteringEOF(stdinclosed), it executesros2.shutdown()and terminates cleanly with exit code0.
2. Protocol Handshake & Method Dispatch
// 1. Client Initialize Request
{"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {"protocolVersion": "2024-11-05", "clientInfo": {"name": "claude-desktop", "version": "0.7.1"}}}
// Server Initialize Response
{"jsonrpc": "2.0", "id": 1, "result": {"protocolVersion": "2024-11-05", "serverInfo": {"name": "ros2-mcp-server", "version": "1.2.0"}, "capabilities": {"tools": {"listChanged": false}}}}
// 2. Client Tools Enumeration
{"jsonrpc": "2.0", "id": 2, "method": "tools/list", "params": {}}
// Server Tools List Response
{"jsonrpc": "2.0", "id": 2, "result": {"tools": [{"name": "ping", "description": "...", "inputSchema": {...}}]}}
// 3. Client Tool Call Execution
{"jsonrpc": "2.0", "id": 3, "method": "tools/call", "params": {"name": "predict_trajectory", "arguments": {"linear_x": 0.5, "angular_z": 0.2, "dt_sec": 2.0}}}
// Server Tool Call Response
{"jsonrpc": "2.0", "id": 3, "result": {"content": [{"type": "text", "text": "{\n \"status\": \"success\",\n \"simulation_mode\": \"1000Hz_fast_forward_kinematics\",\n \"compute_time_ms\": 0.08\n}"}], "isError": false}}3. Protocol Error Handling Codes
Error Code | Constant Meaning | Trigger Condition |
|
| Input line on |
|
| Method is not |
|
| Token bucket exhaustion or internal unhandled exception. |
Tool Error |
| Tool execution raised |
๐ ๏ธ Complete 16-Tool Catalog
Every tool is exposed through a strict JSON schema with typed properties and required argument enforcement:
# | Tool Name | Domain / Innovation | Purpose | Inputs & Defaults | Outputs | Permissions |
1 |
| System | Test bridge latency & active node count |
|
|
|
2 |
| Health | Comprehensive robot health check |
|
|
|
3 |
| Graph | Enumerate all active ROS 2 DDS topics |
|
|
|
4 |
| Telemetry | Read latest serialized message from topic |
|
|
|
5 |
| Actuation | Publish message to ROS 2 topic |
|
| Blocked in |
6 |
| Parallel Telemetry | Multi-topic parallel fetch (LiDAR + IMU + Battery + Odom) |
| Aggregated multi-sensor snapshot |
|
7 |
| Graph | List all active nodes & namespaces |
|
|
|
8 |
| Graph | Inspect publishers, subscribers, services of node |
|
|
|
9 |
| Parameters | Read dynamic parameter from node |
|
|
|
10 |
| Parameters | Dynamically update parameter on node |
|
| Blocked in |
11 |
| Control | Read Kp, Ki, Kd gains and safety bounds |
|
|
|
12 |
| Control | Validated PID tuning with physics bounds check |
|
| Blocked in |
13 |
| Predictive Simulation | 1000Hz fast-forward kinematic trajectory simulation |
|
|
|
14 |
| Verification Tool | Auto-corrects unsafe LLM inputs & gives mathematical proof |
|
|
|
15 |
| Spatial Perception | Translates 360ยฐ LiDAR to 2D ASCII radar grid |
|
|
|
16 |
| Fleet Coordinator | Multi-namespace ROS 2 swarm fleet coordinator |
|
|
|
๐ 3-Tier Execution Sandbox Guardrails
The CommandSandbox enforces multi-tenant safety by partitioning all operational commands across system state $S \in {\text{READ_ONLY}, \text{SAFE_WRITE}, \text{FULL}}$:
Sandbox Level | Permitted Operations | Guardrail Enforcement |
|
| Zero hardware writes. All |
| All read operations + strictly allowlisted topics ( | Any attempt to publish to unauthorized topics or change unverified parameters is audited and rejected via a thread-safe mutex audit logger ( |
| Unrestricted read/write access across all ROS 2 nodes and topics | Permitted only in simulation mode ( |
Every access decision is logged in a thread-safe, timestamped audit log:
print(sandbox.get_audit_log())๐ ๏ธ Predictive Simulation & Safety Verification Architecture
1. ๐ฎ Kinematic Trajectory Predictor (predict_trajectory)
Runs a 1000Hz fast-forward kinematic physics simulation ($<0.1,\text{ms}$ 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 ROS 2 fleets (/drone_1, /rover_2, /arm_3) within a single unified MCP session.
๐ Mathematical Foundations & Algorithmic Proofs
All mathematical formulations are expressed in GitHub-native LaTeX:
1. $O(1)$ Hash Table Dispatch Complexity & Latency Bounds
Traditional tool servers implement command matching via linear string comparison chains ($O(M)$ time where $M$ is the number of tools). ros2-mcp-server compiles handlers into a persistent Python dictionary hash table $\mathcal{D}: \mathcal{K} \to \mathcal{H}$.
For key set $\mathcal{K} = {k_1, k_2, \dots, k_{16}}$ and hash table capacity $m = 2^p = 64$:
$$\operatorname{hash}(k) = \left( \sum_{j=0}^{|k|-1} c_j \cdot 31^{|k|-1-j} \right) \pmod m$$
The load factor $\alpha$ of the dispatch table is:
$$\alpha = \frac{n}{m} = \frac{16}{64} = 0.25$$
Under open addressing with quadratic probing, the expected number of memory probes $\mathbb{E}[T_{\text{lookup}}]$ for a successful tool resolution satisfies:
$$\mathbb{E}[T_{\text{lookup}}] \le -\frac{1}{\alpha} \ln(1 - \alpha) = -\frac{1}{0.25} \ln(0.75) \approx 1.15 \text{ operations} \sim O(1)$$
Measured Dispatch Latency Invariant: Benchmarking $10^5$ consecutive invocations on standard AMD64 and ARM Cortex-A72 hardware confirms:
$$T_{\text{dispatch}} < 0.08,\text{ms} \quad (80,\mu\text{s})$$
2. Token Bucket Rate Limiting & LLM Context Budget Invariant
To shield the robot from malicious or runaway AI agent loops, request admission is governed by the continuous-time Token Bucket Algorithm.
Let the token bucket have maximum burst capacity $B_{\max} \in \mathbb{N}$ and continuous replenishment rate $r \in \mathbb{R}^+$ tokens per second. For a request arriving at time $t$ following prior request time $t - \Delta t$:
$$B(t) = \min\left( B_{\max}, , B(t - \Delta t) + r \Delta t \right)$$
For an incoming MCP tool invocation incurring cost $c_i \in \mathbb{N}$ tokens:
$$\operatorname{Admit}(c_i) = \begin{cases} \text{True}, & B(t) \ge c_i \implies B(t) \leftarrow B(t) - c_i \ \text{False}, & B(t) < c_i \implies \operatorname{Reject}(-32000, \text{"Rate Limit Exceeded"}) \end{cases}$$
LLM Context Window Budget Allocation: Let $W_{\text{ctx}}$ denote the LLM context window (e.g., $200{,}000$ tokens for Claude 3.5 Sonnet). The 16 tool JSON schemas incur an upfront token overhead $T_{\text{schemas}}$:
$$T_{\text{schemas}} = \sum_{i=1}^{16} \operatorname{Tokens}(\text{ToolSchema}_i) \approx 1{,}850 \text{ tokens}$$
To prevent response truncation, each MCP response string must satisfy the context envelope constraint:
$$T_{\text{response}} \le T_{\text{budget}} \implies \operatorname{len}(\text{JSON_str}) \le 4 \cdot T_{\text{budget}}$$
3. 2D LiDAR ASCII Radar Projection: Polar-to-Cartesian $\text{SE}(3)$ Discretization
Physical 360ยฐ LiDAR planar pointclouds $\mathcal{P}_{\text{LiDAR}}$ are projected into a discrete $G \times G$ ASCII grid ($G = 13$, center $c = \lfloor G / 2 \rfloor = 6$) directly inside the MCP JSON payload.
Let the scan contain $N = 360$ beams with angular range $[\theta_{\min}, \theta_{\max}] = [0, 2\pi)$. For beam index $i \in {0, \dots, N-1}$ with measured range $r_i$:
$$\theta_i = \theta_{\min} + i \cdot \frac{\theta_{\max} - \theta_{\min}}{N - 1} = i \cdot \frac{2\pi}{360}$$
In the sensor coordinate frame $\mathcal{F}_S$, the Cartesian coordinates are:
$$\mathbf{p}_i^S = \begin{bmatrix} x_i^S \ y_i^S \ 0 \ 1 \end{bmatrix} = \begin{bmatrix} r_i \cos\theta_i \ r_i \sin\theta_i \ 0 \ 1 \end{bmatrix}$$
Using the rigid body transformation matrix $\mathbf{T}_S^B \in \text{SE}(3)$ from the sensor frame $\mathcal{F}_S$ to the robot base footprint $\mathcal{F}_B$:
$$\mathbf{p}_i^B = \mathbf{T}_S^B \mathbf{p}_i^S = \begin{bmatrix} \mathbf{R}_S^B & \mathbf{t}S^B \ \mathbf{0}{1 \times 3} & 1 \end{bmatrix} \mathbf{p}_i^S$$
For planar mobile robots where $\mathbf{R}S^B = \mathbf{I}{3 \times 3}$ and $\mathbf{t}S^B = \mathbf{0}$, the polar coordinates project directly onto the $G \times G$ discrete matrix with maximum sensor visualization radius $r{\max} = 3.5,\text{m}$:
$$g_x(i) = c - \operatorname{round}\left( \frac{r_i}{r_{\max}} \cdot c \cdot \cos\theta_i \right)$$
$$g_y(i) = c - \operatorname{round}\left( \frac{r_i}{r_{\max}} \cdot c \cdot \sin\theta_i \right)$$
The ASCII visualizer cell state $\mathcal{M}(g_x, g_y)$ is formally defined by the discretization map:
$$\mathcal{M}(g_x, g_y) = \begin{cases} \text{'R'}, & g_x = c \land g_y = c \quad (\text{Robot Center}) \ \text{'*'}, & \exists i \text{ s.t. } (g_x(i), g_y(i)) = (g_x, g_y) \land 0.1 < r_i \le r_{\max} \quad (\text{Obstacle}) \ \text{'.'}, & \text{otherwise} \quad (\text{Clear Navigable Space}) \end{cases}$$
Sector obstacle clearance metrics are computed across defined angular intervals:
$$d_{\text{front}} = \min_{\substack{|\theta_i| \le 15^\circ \ r_i > 0.1}} r_i, \quad d_{\text{left}} = \min_{\substack{75^\circ \le \theta_i \le 105^\circ \ r_i > 0.1}} r_i, \quad d_{\text{right}} = \min_{\substack{255^\circ \le \theta_i \le 285^\circ \ r_i > 0.1}} r_i$$
4. 3-Tier Command Sandbox State Machine & Mutex-Guarded Audit Logging
The CommandSandbox partitions all operational commands across system state $S \in {\text{READ_ONLY}, \text{SAFE_WRITE}, \text{FULL}}$.
Let the full action set $\mathcal{A}$ partition into telemetry reads, topic publishes, and parameter updates:
$$\mathcal{A} = \mathcal{A}{\text{read}} \cup \mathcal{A}{\text{pub}} \cup \mathcal{A}_{\text{param}}$$
The access control decision function $\Phi(S, a) \in {\text{ALLOW}, \text{BLOCK}}$ satisfies the following strict mathematical invariants:
State $S = \text{READ_ONLY}$ (Zero Actuation Writes): $$\Phi(\text{READ_ONLY}, a) = \begin{cases} \text{ALLOW}, & a \in \mathcal{A}{\text{read}} \ \text{BLOCK}, & a \in \mathcal{A}{\text{pub}} \cup \mathcal{A}_{\text{param}} \end{cases}$$
State $S = \text{SAFE_WRITE}$ (Allowlist Filtered Actuation): $$\Phi(\text{SAFE_WRITE}, a) = \begin{cases} \text{ALLOW}, & a \in \mathcal{A}{\text{read}} \ \text{ALLOW}, & a = \operatorname{publish}(t, m) \land t \in \mathcal{T}{\text{safe}} \ \text{ALLOW}, & a = \operatorname{set_param}(n, p, v) \land (n, p) \in \mathcal{P}{\text{safe}} \ \text{BLOCK}, & \text{otherwise} \end{cases}$$ where the default verified allowlists are: $$\mathcal{T}{\text{safe}} = { \text{/cmd_vel}, , \text{/target_velocity}, , \text{/led_state}, , \text{/speaker_cmd}, , \text{/arm_target_angle} }$$ $$\mathcal{P}_{\text{safe}} = { (\text{nav2_controller}, \text{max_vel_x}), , (\text{nav2_controller}, \text{max_vel_theta}), , (\text{nav2_controller}, \text{min_vel_x}) }$$
State $S = \text{FULL}$ (Simulation / Unrestricted Development): $$\forall a \in \mathcal{A}, \quad \Phi(\text{FULL}, a) = \text{ALLOW}$$
Thread-Safety Mutex Invariant for Audit Logging: Every decision creates an audit record $E = (t_k, \text{action}, \text{target}, \Phi, S)$. Under concurrent tool invocations, the audit log $\mathcal{L}{\text{audit}}$ is guarded by mutex $\mathcal{M}$: $$\forall t_1, t_2 \in \mathcal{T}{\text{threads}}, \quad \left( \operatorname{Write}(\mathcal{L}{\text{audit}}, t_1) \land \operatorname{Write}(\mathcal{L}{\text{audit}}, t_2) \right) \implies t_1 = t_2$$
5. Kinematic Trajectory Prediction & Neural Safety Auto-Correction
Before issuing actuation commands to hardware, predict_trajectory evaluates the unicycle kinematic model at $1000,\text{Hz}$ across time duration $T$:
$$\begin{bmatrix} \dot{x} \ \dot{y} \ \dot{\theta} \end{bmatrix} = \begin{bmatrix} v \cos\theta \ v \sin\theta \ \omega \end{bmatrix}$$
Using discrete integration over interval $\Delta t = 0.05,\text{s}$:
For curved trajectory ($|\omega_k| \ge 10^{-6},\text{rad/s}$): $$x_{k+1} = x_k + \frac{v_k}{\omega_k} \left( \sin(\theta_k + \omega_k \Delta t) - \sin\theta_k \right)$$ $$y_{k+1} = y_k - \frac{v_k}{\omega_k} \left( \cos(\theta_k + \omega_k \Delta t) - \cos\theta_k \right)$$ $$\theta_{k+1} = \theta_k + \omega_k \Delta t$$
For straight-line trajectory ($|\omega_k| < 10^{-6},\text{rad/s}$): $$x_{k+1} = x_k + v_k \cos\theta_k \Delta t$$ $$y_{k+1} = y_k + v_k \sin\theta_k \Delta t$$ $$\theta_{k+1} = \theta_k$$
Neural Parameter Clamping Formulation:
When an LLM agent proposes PID gains or velocity vectors, predictive_safety_check applies non-linear bounding projections:
$$K_{\text{safe}} = \operatorname{clip}\left( K_{\text{LLM}}, , 0.0, , K_{\max} \right) = \max\left( 0.0, , \min(K_{\max}, K_{\text{LLM}}) \right)$$
$$\mathbf{v}_{\text{safe}} = \begin{bmatrix} \operatorname{clip}(v_x, -1.5, 1.5) \ \operatorname{clip}(\omega_z, -2.5, 2.5) \end{bmatrix}$$
This guarantees that negative feedback stability is preserved unconditionally before signals reach the robot's physical motor drives.
๐ Performance Benchmarks & Verification
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 (100% Success) (Simulation mode)
python run_tests.py๐ Extended Documentation
๐จโ๐ป Author & License
Abdullah Bin Zafar โ Mechatronics & Control Engineering, UET Lahore
Building robots that think, act, and reason safely.
This project is licensed under the MIT License. Contributions, bug reports, and pull requests are welcome!
Available Tools
16 toolsget_node_infoA
Inspect a specific ROS2 node and find its related topics (exact name match).
Inputs: node_name (required).
get_parameterA
Read a live parameter value from a running ROS2 node.
Inputs: node_name (required), param_name (required).
get_pid_stateC
Read current Kp, Ki, Kd gains from a PID controller node, with safety bounds.
Inputs: node_name (required), kd_param, ki_param, kp_param.
get_robot_snapshotA
Fetch LiDAR, IMU, battery, cmd_vel, and odometry in one parallel call. Faster than calling read_topic five times sequentially.
Inputs: no named parameters.
get_spatial_mapC
[WORLD-FIRST] Converts 360ยฐ LiDAR pointclouds into a 2D ASCII spatial radar grid directly inside MCP response JSON, allowing text & vision LLMs to 'see' surrounding space.
Inputs: grid_size, scan_topic.
list_nodesA
List all currently running ROS2 nodes with their namespaces.
Inputs: no named parameters.
list_topicsA
List all active ROS2 topics and their message types.
Inputs: no named parameters.
pingA
Test the connection to the ROS2 bridge. Returns status and active node count. Call this before any other tool to verify the server is reachable.
Inputs: no named parameters.
predictive_safety_checkB
[WORLD-FIRST] Evaluates proposed parameter or velocity commands against dynamic stability bounds, auto-correcting unsafe LLM inputs and returning mathematical proof.
Inputs: target (required), command_type (required), proposed_value (required).
predict_trajectoryA
[WORLD-FIRST] Pre-simulate robot trajectory (x,y,theta) over time dt_sec in 1000Hz fast-forward simulation (<0.1ms compute) BEFORE sending commands to hardware.
Inputs: linear_x (required), angular_z (required), dt_sec.
publish_topicA
Publish a message to a ROS2 topic. Sandboxed: blocked in READ_ONLY mode; allowlisted in SAFE_WRITE mode.
Inputs: topic (required), payload (required), msg_type (required).
read_topicA
Read the latest message from a ROS2 topic. Returns the serialized message and data age in milliseconds. For latched topics (/map, /robot_description), set latched=true.
Inputs: topic (required), latched, msg_type, timeout_ms.
set_parameterA
Dynamically update a parameter on a running ROS2 node. Sandboxed โ only allowlisted parameters can be modified in SAFE_WRITE mode.
Inputs: value (required), node_name (required), param_name (required).
swarm_fleet_statusA
[WORLD-FIRST] Scans multi-namespace ROS2 graph (/drone_1, /rover_2, /arm_3) and aggregates multi-robot fleet health in one call.
Inputs: no named parameters.
system_diagnosticsA
Run a full robot health check. Returns battery level, LiDAR status, IMU health, active node count, and lists of critical issues and warnings. ALWAYS call this first when the user asks 'what's wrong?' or 'is the robot ready?'
Inputs: no named parameters.
tune_pidA
Apply new PID gains to a controller node with safety bounds validation. Gains are validated BEFORE reaching hardware โ negative gains are rejected. Returns tuning guidance based on control theory.
Inputs: node_name (required), kd, ki, kp, +3 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogโฆ
TDQS
Scored across 16 tools
Most tools are clearly distinct, but system_diagnostics and get_robot_snapshot both report robot health, and predict_trajectory/predictive_safety_check could be confused at first glance. Descriptions help disambiguate, so the overlap is minor.
The majority follow a verb_noun pattern (list_nodes, get_parameter, read_topic), but ping, system_diagnostics, and swarm_fleet_status break the convention with verb-only or noun-only names. The mix is readable but not fully consistent.
With 16 tools, the count is slightly on the heavier side but appropriate for a ROS2 server that covers node inspection, parameter management, topic I/O, diagnostics, and advanced safety features. Each tool has a reasonable justification to exist.
The tool surface covers the core ROS2 interactions: listing nodes/topics, reading/writing parameters, publishing/subscribing to topics, and running diagnostics. It lacks direct service call support and topic lifecycle management, but these are minor gaps for the intended use in robot control.
Maintenance
Related MCP Connectors
Connect Claude, Cursor, Codex, and other AI tools to your robotics mission data.
Your AI Agent's Infrastructure Layer. Connect Claude, Copilot, Codex, or ChatGPT to 200+ managed open source services. Start databases, pipelines, and applications through natural language.
Operate Linux, macOS and Windows from your LLM. Every action runs through an auditable allowlist.
- DNS-DATA RemoteDeprecatedcom.dns-data
Connect AI assistants to authorized Windows and macOS devices for files, commands, and management.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI tools to interact with ROS2 robotics systems through natural language commands. Supports topic publishing/subscribing, service calls, message analysis, and auto-discovery of ROS2 interfaces for debugging and controlling robots.Mozilla Public 2.0
- AlicenseAqualityDmaintenanceEnables controlling robots in ROS environments through natural language, supporting topics, services, actions, and GUI tools.2436MIT
- AlicenseNot gradedqualityDmaintenanceEnables large language models to interact with ROS robots seamlessly, allowing natural language control, real-time sensor monitoring, and autonomous task execution without modifying existing robot code.Apache 2.0
- AlicenseAqualityCmaintenanceConnects AI agents to ROS 2 robots via rosbridge, enabling observation, inspection, and control of robot topics, services, and actions through natural language.112MIT