io.github.husain-zaidi/ros-mcp
编码与调试by husain-zaidi
MCP for ROS 2 monitoring, debugging, and managing nodes, topics, services, and TF2 frames.
什么是 io.github.husain-zaidi/ros-mcp?
MCP for ROS 2 monitoring, debugging, and managing nodes, topics, services, and TF2 frames.
README
ROS 2 MCP Server
<img src="https://img.shields.io/npm/v/ros-mcp"> <img src="https://img.shields.io/badge/VS_Code-VS_Code?style=flat-square&label=Install%20Server&color=0098FF" alt="Install in VS Code">
A Model Context Protocol (MCP) server for ROS 2 that enables GitHub Copilot and other AI agents to interact with ROS 2 systems. This server provides tools for monitoring, debugging, and managing ROS 2 nodes, topics, services, and TF2 frames.
Quickstart
Add the following to .vscode/mcp.json
{
"servers": {
"ros": {
"command": "npx",
"args": ["ros-mcp"]
}
}
}
Ensure the server is selected in tools for vs code copilot
You're good to go! try "List active ros topics" to test it out.
Features
Node Management
- list_ros_nodes: List all running ROS 2 nodes with detailed information
- get_node_connections: View all topics a node publishes to and subscribes from
- get_node_parameters: List parameters for a specific node
- set_node_parameter: Modify node parameters at runtime
- run_ros_node: Launch a ROS 2 node from a package
- run_ros_launch: Execute a launch file
Topic Monitoring
- list_ros_topics: List all available topics with optional detailed type information
- get_topic_info: Get detailed information about a specific topic
- monitor_topic: Subscribe to a topic and collect messages for a specified duration (observational tool with wait capability)
- publish_to_topic: Publish messages to a topic
Service Management
- list_ros_services: List all available services
- call_service: Call a service with optional parameters
TF2 Frame Monitoring
- monitor_tf2_frames: Monitor TF2 transform frames and relationships (includes static and dynamic transforms)
System Visualization & Debugging
- generate_ros_graph: Generate dependency graphs showing connections between nodes and topics (supports both text and Graphviz DOT format)
- check_ros_system_status: Check overall system health, daemon status, and node/topic/service counts
Installation
Prerequisites
- ROS 2 (tested with Humble and later)
- Node.js 18+
- npm or yarn
Manual Setup
# Clone or navigate to the repository
cd /path/to/ROS-MCP
# Install dependencies
npm install
# Build the TypeScript
npm run build
WSL might need linking the nvm node to the default node path
sudo ln -s ~/.nvm/versions/node/v24.11.0/bin/node /usr/local/bin/node sudo ln -s ~/.nvm/versions/node/v24.11.0/bin/npm /usr/local/bin/npm
Usage
Running the Server
# Direct execution (recommended for MCP integration)
npm start
# Development with ts-node
npm run dev
With GitHub Copilot
Configure the MCP server in your GitHub Copilot settings:
{
"servers": {
"ros": {
"command": "node",
"args": ["/path/to/ROS-MCP/build/index.js"]
}
}
}
Tool Details
Observational Tools (with Wait Capability)
Some tools are designed to collect data over time, allowing the agent to wait and observe:
-
monitor_topic: Waits for 1-30 seconds, collecting messages from a topic. Supports custom message count limits. Perfect for:
- Observing sensor data streams
- Verifying topic publishing patterns
- Debugging message throughput
-
monitor_tf2_frames: Observes TF2 frame transforms over a specified duration (1-30 seconds)
Tool Examples
Monitor a Topic
Tool: monitor_topic
Parameters:
- topic_name: "/sensor_msgs/LaserScan"
- duration_seconds: 5
- message_count: 10
This collects up to 10 messages from the LaserScan topic over 5 seconds.
Generate Node Graph
Tool: generate_ros_graph
Parameters:
- output_format: "text" (or "dot" for Graphviz)
Returns a visual representation of how nodes and topics are connected.
Monitor System Health
Tool: check_ros_system_status
Parameters:
- include_diagnostics: true
Provides comprehensive system status including daemon health, active nodes, and services.
Architecture
The server is built with:
- @modelcontextprotocol/sdk: MCP framework for agent communication
- Zod: Type-safe parameter validation
- Node.js Child Process: Command execution for ROS 2 CLI tools
How It Works
- Command Execution: Each tool executes the corresponding
ros2CLI command - Output Parsing: Results are parsed and formatted for agent consumption
- Timeout Handling: Observational tools use configurable timeouts to collect data
- Error Handling: Commands that fail gracefully return error messages
Designing Tools for Agent Observation
This MCP server follows patterns that work well with AI agents:
- Blocking Observational Operations: Tools like
monitor_topicblock for the specified duration, allowing agents to naturally await results - Bounded Time Windows: All monitoring tools have maximum durations (typically 5-30 seconds) to prevent indefinite waits
- Progressive Data Collection: Tools collect data incrementally and return results at the end of the observation window
- Clear Output Format: Results are structured text that agents can easily parse and reason about
Example Usage with Copilot
A Copilot agent using this MCP can:
Agent: "What topics are currently being published?"
[Uses: list_ros_topics]
Agent: "Let me observe the /cmd_vel topic for 5 seconds"
[Uses: monitor_topic with topic_name="/cmd_vel", duration_seconds=5]
[Waits 5 seconds for data collection]
Agent: "Here are the velocity commands being sent: [parsed data]"
Agent: "Show me how all nodes are connected"
[Uses: generate_ros_graph with output_format="text"]
Agent: "Let me try publishing a test message to the /cmd_vel topic"
[Uses: publish_to_topic]
Agent: "Let me check if any node is having issues"
[Uses: check_ros_system_status with include_diagnostics=true]
Limitations
- Some ROS 2 CLI commands require the ROS 2 environment to be properly sourced
- TF2 monitoring requires the
tf2_toolspackage to be installed - The server executes commands in the current environment - ensure ROS 2 is properly installed
- Long-running operations may timeout; adjust duration parameters as needed
Future Enhancements
- Integration with ROS 2 bag recording/playback
- Parameter server monitoring
- Action client/server interface
- Live rqt plugin integration
- Rviz2 data streaming
- Custom message type parsing
- CLI
License
MIT
Contributing
Contributions welcome! Please ensure all tools handle errors gracefully and include proper parameter validation.
常见问题
io.github.husain-zaidi/ros-mcp 是什么?
MCP for ROS 2 monitoring, debugging, and managing nodes, topics, services, and TF2 frames.
相关 Skills
前端设计
by anthropics
面向组件、页面、海报和 Web 应用开发,按鲜明视觉方向生成可直接落地的前端代码与高质感 UI,适合做 landing page、Dashboard 或美化现有界面,避开千篇一律的 AI 审美。
✎ 想把页面做得既能上线又有设计感,就用前端设计:组件到整站都能产出,难得的是能避开千篇一律的 AI 味。
网页应用测试
by anthropics
用 Playwright 为本地 Web 应用编写自动化测试,支持启动开发服务器、校验前端交互、排查 UI 异常、抓取截图与浏览器日志,适合调试动态页面和回归验证。
✎ 借助 Playwright 一站式验证本地 Web 应用前端功能,调 UI 时还能同步查看日志和截图,定位问题更快。
网页构建器
by anthropics
面向复杂 claude.ai HTML artifact 开发,快速初始化 React + Tailwind CSS + shadcn/ui 项目并打包为单文件 HTML,适合需要状态管理、路由或多组件交互的页面。
✎ 在 claude.ai 里做复杂网页 Artifact 很省心,多组件、状态和路由都能顺手搭起来,React、Tailwind 与 shadcn/ui 组合效率高、成品也更精致。
相关 MCP Server
GitHub
编辑精选by GitHub
GitHub 是 MCP 官方参考服务器,让 Claude 直接读写你的代码仓库和 Issues。
✎ 这个参考服务器解决了开发者想让 AI 安全访问 GitHub 数据的问题,适合需要自动化代码审查或 Issue 管理的团队。但注意它只是参考实现,生产环境得自己加固安全。
Context7 文档查询
编辑精选by Context7
Context7 是实时拉取最新文档和代码示例的智能助手,让你告别过时资料。
✎ 它能解决开发者查找文档时信息滞后的问题,特别适合快速上手新库或跟进更新。不过,依赖外部源可能导致偶尔的数据延迟,建议结合官方文档使用。
by tldraw
tldraw 是让 AI 助手直接在无限画布上绘图和协作的 MCP 服务器。
✎ 这解决了 AI 只能输出文本、无法视觉化协作的痛点——想象让 Claude 帮你画流程图或白板讨论。最适合需要快速原型设计或头脑风暴的开发者。不过,目前它只是个基础连接器,你得自己搭建画布应用才能发挥全部潜力。