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.

概览

AI 生成的概览

一个本地 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 包。仅限桌面端;未声明认证或环境变量。
安装前请注意
部分工具会改变机器人实时状态:set_node_parameter 在运行时修改参数,run_ros_node 和 run_ros_launch 启动进程,publish_to_topic 发送消息,call_service 调用服务。向速度指令等话题发布消息可能驱动真实硬件,请仅在安全的环境中使用。监控类工具会阻塞最长 30 秒。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Ros Mcp,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

ROS 2 MCP Server

[图片] [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

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

bash
# Clone or navigate to the repositorycd /path/to/ROS-MCP
# Install dependenciesnpm install
# Build the TypeScriptnpm 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

bash
# Direct execution (recommended for MCP integration)npm start
# Development with ts-nodenpm run dev

With GitHub Copilot

Configure the MCP server in your GitHub Copilot settings:

json
{  "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_topicParameters:  - 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_graphParameters:  - 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_statusParameters:  - 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

  1. Command Execution: Each tool executes the corresponding ros2 CLI command
  2. Output Parsing: Results are parsed and formatted for agent consumption
  3. Timeout Handling: Observational tools use configurable timeouts to collect data
  4. 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:

  1. Blocking Observational Operations: Tools like monitor_topic block for the specified duration, allowing agents to naturally await results
  2. Bounded Time Windows: All monitoring tools have maximum durations (typically 5-30 seconds) to prevent indefinite waits
  3. Progressive Data Collection: Tools collect data incrementally and return results at the end of the observation window
  4. 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_tools package 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
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v1.0.1最新Sep 16, 2026

评分

已满足适用检查项的 40%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分

    请在仓库或注册中心条目中声明许可证。