Skip to main content

ros2-doctor-mcp

CI License

An MCP server that answers "why isn't my robot moving?" for ROS 2. Most ROS MCP servers control a robot (publish, call services, send goals). This one only diagnoses: it is read-only, never publishes, and never changes anything, so it is safe to point an agent at a running robot.

diagnose_robot on a UR3 with MoveIt: healthy, then the arm controller deactivated

The tool results are real output captured through MCP on a UR3 + MoveIt Gazebo sim (healthy, then arm_controller deactivated). The question and the agent's reply are illustrative. Source: docs/demo_raw.txt, docs/make_demo_gif.py.

An agent calls ros2-doctor-mcp, which fans out to the read-only doctors

It wraps existing read-only doctors and returns one normalised result, {ok, findings: [{level, code, msg, hint}]}:

Tool Wraps Answers
diagnose_robot all of the below start here: detects which stacks are on the domain (Nav2, an arm, MoveIt, SLAM, cameras), runs every doctor that applies in parallel, returns one merged verdict, errors first, each finding tagged with its source
diagnose_nav2 nav2_doctor stale TF, dead odom or scan, inactive Nav2 servers, no cmd_vel, flapping goals, no progress
nav2_ready nav2_doctor --ready pre-flight: can this stack navigate right now?
diagnose_arm armdoc inactive controller, silent /joint_states, joint at a limit, stalled trajectory, missing move_group
arm_ready armdoc --ready pre-flight for a ros2_control arm
diagnose_perception percept_doctor cameras, depth and point clouds: dead or stale streams, low rate, dark or frozen images, invalid depth, empty clouds, missing camera_info
diagnose_slam slam_doctor SLAM health: map stalls, lost tracking, odometry drift, no loop closures (slam_toolbox, Cartographer, RTAB-Map, ORB-SLAM3)
analyze_force forcetrace offline: did a peg-in-hole or press run jam or insert, peak and steady force, time in contact
check_reach reachlens offline: can a UR3 or UR5e reach this tool-down pose? IK error, manipulability, joint-limit margin
score_map nav_explore_eval offline: coverage, wall recall and precision of a saved map against ground truth
ros_graph ros2 node list, ros2 topic list -t what is visible on a domain; start here when a doctor says nothing is visible
learn_baseline, list_baselines the doctors' --learn record what normal looks like for this robot (message rates) while it is healthy; then pass baseline=<name> to any diagnose_* tool to be warned with RATE_DROP / RATE_SPIKE when a stream drifts. Writes one small file in ~/.ros2_doctor/baselines (override with ROS2_DOCTOR_BASELINE_DIR), nothing on the robot
explain_code every doctor's hint table offline, instant: what a finding code (CMD_ZERO, TF_FREEZE, RATE_DROP ...) means, which doctor raises it, and the next step; unknown codes return the closest known ones
analyze_trajectory trajlens offline: jerk spikes, limit violations, slow profiles in a recorded trajectory (CSV, JSON, rosbag2); no robot needed

The server also offers a resource, doctor://codes (the full finding-code catalog), and a prompt, why_isnt_my_robot_moving, that walks an agent through diagnose, explain and propose. The catalog is generated from the doctors' hint tables with scripts/build_catalog.py; a test fails when a doctor adds a code the catalog lacks.

Every diagnose tool takes ns (namespace), seconds (watch time, clamped to 1 to 120) and domain_id (sets ROS_DOMAIN_ID for that call only). Each finding carries a hint with a suggested next step.

What it has found

Findings from live Gazebo runs and from testing

Every row except by design comes from a run on a UR3 + MoveIt or Nav2 Gazebo sim, or from a bug the testing caught. Nothing here was run on real hardware.

Install

Docker (ROS 2 Humble and the doctors are built in; nothing else to install):

docker build -t ros2-doctor-mcp https://github.com/darshmenon/ros2_doctor_mcp.git
claude mcp add ros2-doctor -- docker run -i --rm --net=host -e ROS_DOMAIN_ID=0 ros2-doctor-mcp

--net=host lets the container see robots on this machine; set ROS_DOMAIN_ID to match yours (or pass domain_id in a tool call). The image uses UDP-only Fast DDS, because shared memory does not work between a container and the host (discovery succeeds but no data arrives).

From source (you already have ROS 2):

# a ROS 2 install with the doctors you want
cd ~/ros2_ws/src && git clone https://github.com/darshmenon/nav2_doctor.git && git clone https://github.com/darshmenon/armdoc.git
cd .. && colcon build --packages-select nav2_doctor armdoc

pip install ros2-doctor-mcp      # latest main instead: pip install git+https://github.com/darshmenon/ros2_doctor_mcp.git

Run the server from a shell where ROS 2 and your workspace are sourced.

Use with Claude Code

claude mcp add ros2-doctor -- ros2-doctor-mcp

or in .mcp.json:

{"mcpServers": {"ros2-doctor": {"command": "ros2-doctor-mcp"}}}

Then ask: "The robot on domain 77 won't move. Why?" and the agent calls diagnose_robot.

Configuration

The doctors are found on PATH (nav2_doctor, armdoc), else through ros2 run. Override either with an environment variable:

ROS2_DOCTOR_NAV2_CMD="python3 -m nav2_doctor.doctor"
ROS2_DOCTOR_ARM_CMD="ros2 run armdoc armdoc"

Not included

nav2_fault_inject and armchaos deliberately break a running robot, so they stay out of a read-only server. ctrlbench is a long benchmark, not a quick question.

Safety

  • The wrapped doctors only subscribe to topics and query lifecycle or controller state.
  • The server runs them as subprocesses with a hard timeout and a clamped watch time. There is no tool that publishes, calls a mutating service, or sends a goal.
  • Pairs well with a control-oriented ROS MCP server: let that one move the robot, and use this one to find out why it did not.

Scoreboard

docs/scoreboard.md: 23 injected faults across nav2_doctor, armdoc and percept_doctor, each with the finding code fixed in advance, plus 5 healthy controls. All 23 were named by the doctor that owns them and all 5 controls stayed free of errors and warnings. The graphs are the synthetic fakes from each doctor's integration tests, so this is a regression table for the rules on the fault patterns they model, not recall on a real robot (those faults were chosen with the rules in hand). A few scenarios also raise a second, related code (a wrong namespace cascades into ODOM_NONE, SCAN_NONE, NODE_MISSING); the table lists everything reported. Re-run it with python3 scripts/scoreboard.py in a sourced ROS 2 shell with the doctors cloned next to each other.

Tests

pip install ".[test]" && pytest -q

The unit tests stub the subprocess, so they need neither ROS nor a robot. The Nav2 and arm tools were also run end to end through the MCP protocol against live Gazebo sims (see the changelog).

Roadmap

  • fault injectors (nav2_fault_inject, armchaos) are deliberately not exposed: this server stays read-only
  • merged node logs tied to a finding
  • multi-robot: one call per namespace

License: Apache-2.0.

Metadata

Release files for ros2-doctor-mcp 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ros2-doctor-mcp 0.1.1
File Size Uploaded Provenance Actions
ros2_doctor_mcp-0.1.1.tar.gz 28.6 kB With provenance Details for ros2_doctor_mcp-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ros2-doctor-mcp 0.1.1
File Interpreter ABI Platform Actions
ros2_doctor_mcp-0.1.1-py3-none-any.whl Python 3 none any Details for ros2_doctor_mcp-0.1.1-py3-none-any.whl

Total release size: 51.7 kB

Release files / ros2_doctor_mcp-0.1.1.tar.gz

Download URL ros2_doctor_mcp-0.1.1.tar.gz
Size 28.6 kB
Tags Source
SHA-256 checksum
How to use checksums
e5064e7be6c90eda1458df34ac852d479078aa92d0dfc8dda3add6889f49bc07
BLAKE2b-256 checksum
How to use checksums
51d3982f200ecaba8893ad4cbb7550dc37bd00509939cf1186b0b5fdb29b34e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Release files / ros2_doctor_mcp-0.1.1-py3-none-any.whl

Download URL ros2_doctor_mcp-0.1.1-py3-none-any.whl
Size 23.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4dd057a10fcb83436432dba1602169b3a5ee89884747bc3e794eb3e58f427b36
BLAKE2b-256 checksum
How to use checksums
7520dfc116cd82fcceb64ec3be76f8b0c421d54c6e5fe52c38127991387b2763
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Security for ros2-doctor-mcp 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for ros2_doctor_mcp-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page