YR

yutarop/ros-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

36 stars 6 forks 质量 60 趋势 12MIT

用于ROS的MCP服务器,通过主题、服务和动作控制机器人。

概览

是一款MCP服务器,设计用于使用自然语言控制ROS环境中的机器人。它支持通过ROS主题、服务和动作进行通信,并支持任何ROS消息类型。 https://github.com/user-attachments/assets/61143c37-fb73-4998-9cbc-844d92ae61d9 用TurtleBot3打开凉亭并发布主题以移动它。 给我看服务列表,然后打电话给服务人员重置凉亭的世界。 显示行动列表并呼叫动作,将TurtleBot3向前推进100万。 - (socket_server.py):一台运行在localhost:8765上的轻量级服务器,用于处理图形界面相关操作。它接收MCP服务器的指令,在本地显示器上启动Gazebo或rqt_graph等工具。 - (ros-general.py):基于Python的服务器,实现MCP。它处理自然语言输入,映射为ROS命令,并与套接字服务器通信。

概述(AI 翻译)

罗斯 MCP

ROS MCP 是一款为在 ROS 环境中使用自然语言控制机器人而设计的 MCP 服务器。 它支持通过ROS主题、服务和动作进行通信,并适用于任何ROS消息类型。

演示

####测试是否可以使用ROS主题、服务和操作。 https://github.com/user-attachments/assets/61143c37-fb73-4998-9cbc-844d92ae61d9

使用的提示(主题)

用TurtleBot3打开凉亭并发布主题以移动它。

提示(服务)

显示服务列表并致电服务以重置Gazebo世界。

使用的提示词(动作)

显示行动列表并呼叫动作,将TurtleBot3推进100万。

组成部分

  • Socket Server(socket_server.py):一款运行在localhost:8765上的轻量级服务器,用于处理GUI相关操作。 它接收来自MCP服务器的指令,在本地显示器上启动诸如Gazebo或rqt_graph等工具。

  • MCP 服务器(ros-general.py):基于 Python 的服务器实现 MCP。 它处理自然语言输入,映射为 ROS 命令,并与套接字服务器通信。

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

ROS MCP

ROS MCP is a MCP server designed for controlling robots in ROS environments using natural language. It supports communication via ROS topics, services, and actions, and works with any ROS message type.

Demo

Test to see if ros topics, services, and actions can be used.

https://github.com/user-attachments/assets/61143c37-fb73-4998-9cbc-844d92ae61d9

Prompt used (Topic)

Open gazebo with TurtleBot3 and publish topic to move it.

Prompt used (Service)

Show me service list and call service to reset the world in Gazebo.

Prompt used (Action)

Show me action list and call action to move the TurtleBot3 forward for 1m.

Components

  • Socket Server (socket_server.py): A lightweight server that runs on localhost:8765 to handle GUI-related operations. It receives instructions from the MCP server to launch tools such as Gazebo or rqt_graph on the local display.

  • MCP Server (ros-general.py): A Python-based server that implements the MCP. It processes natural language input, maps it to ROS commands, and communicates with the socket server. To enable node communication between the MCP server and the local machine, both must be configured with the same ROS_DOMAIN_ID on the same local network.

Overview of MCP Tools

  • Topic Management: List, monitor, and publish to ROS2 topics
  • Node Control: List and inspect running ROS2 nodes
  • Service Interaction: Call ROS2 services with custom
  • Action Support: Send goals to ROS2 actions
  • GUI Integration: Launch ROS2 GUI tools via WebSocket server
  • Environment Debugging: Check ROS2 setup and configuration
  • Process Management: Clean up running ROS2 processes

Please refer here for more details.

Getting Started

Requirements

  • ROS2 Humble Hawksbill (This project has only been tested with ROS2 Humble. Compatibility with other ROS2 distributions is not guaranteed.)
  • claude desktop (Linux, macOS and Windows)
  • Python 3.10+
  • websockets >= 15.0.1
  • uv package manager (Installing uv)
  • Other dependencies as listed in pyproject.toml

Installation

Git clone and install websockets package

git clone [email protected]:Yutarop/ros-mcp.git
cd ros-mcp
pip install "websockets>=15.0.1"

Activate .venv and install dependencies

uv venv
source .venv/bin/activate
uv pip install -e .
在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →