
Ros Mcp
io.github.husain-zaidi由 GitHub 帳號 husain-zaidi 發布v1.0.1更新於 Oct 24, 2026
MCP for ROS 2 monitoring, debugging, and managing nodes, topics, services, and TF2 frames.
概覽
一個本機 MCP 伺服器,讓 AI 助理檢視並控制 ROS 2 機器人系統,包括節點、主題、服務與 TF2 座標幀。
- 可以做什麼
- 列出執行中的節點,檢視其連線與參數,並在執行時修改參數或啟動節點與 launch 檔。列出主題、取得主題詳細資訊、在限定時間內監控主題,並向主題發布訊息。列出服務並帶可選參數呼叫服務。監控 TF2 變換幀,包含靜態與動態變換。以文字或 Graphviz DOT 產生節點與主題相依圖,並檢查系統整體健康、守護程序狀態與數量統計。
- 適用情境
- 適合搭配 AI 助理除錯或操作 ROS 2 機器人時使用,例如確認哪些主題正在運作、觀察幾秒的感測器或指令資料流、檢視節點連線關係或檢查系統健康。對象為 ROS 2 系統開發者,而非一般桌面用途。
- 執行需求
- 以本機 Node.js 程序執行(需 Node.js 18+ 與 npm 或 yarn),可透過 npx ros-mcp 或建置後的進入點啟動。需要可用的 ROS 2 環境(已在 Humble 及更新版本測試)且已 source 環境;TF2 監控另需安裝 tf2_tools 套件。僅限桌面端;未宣告驗證或環境變數。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Ros Mcp,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
ROS 2 MCP Server
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
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
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
With GitHub Copilot
Configure the MCP server in your GitHub Copilot settings:
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
This collects up to 10 messages from the LaserScan topic over 5 seconds.
Generate Node Graph
Returns a visual representation of how nodes and topics are connected.
Monitor System Health
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:
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.
來源:README.md,提交 2e12643
工具
0版本歷史
1- v1.0.1最新Sep 16, 2026
評分
已滿足適用檢查項的 40%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分
請在儲存庫或註冊中心條目中宣告授權條款。