Fire in da houseTop Tip:Paying $100+ per month for Perplexity, MidJourney, Runway, ChatGPT and other tools is crazy - get all your AI tools in one site starting at $15 per month with Galaxy AI Fire in da houseCheck it out free

mcp_server_ros_2

MCP.Pizza Chef: wise-vision

The mcp_server_ros_2 is an advanced MCP server that integrates the Model Context Protocol with ROS2 robotics middleware. It enables AI agents to interact directly with robotic systems by listing and subscribing to ROS2 topics, calling services, publishing messages, and accessing data from the WiseVision Data Black Box. This server facilitates real-time, structured communication between AI models and robotic environments, supporting complex robotics workflows and automation.

Use This MCP server To

List available ROS2 topics and services for robotic data access Subscribe to ROS2 topics to receive real-time sensor data Publish messages to ROS2 topics to control robotic actuators Call ROS2 services to trigger robotic functions or queries Retrieve historical robotic data from WiseVision Data Black Box Echo messages on ROS2 topics for debugging and monitoring Extract fields from ROS2 message types for structured processing

README

WiseVision ROS2 MCP Server

Python server implementing Model Context Protocol (MCP) for ROS2.

Demo

Features

  • List available topics
  • List available services
  • Call service
  • Get messages from WiseVision Data Black Box (influxDB alternative to Rosbag2)
  • Subscribe topic to get messages
  • Publish message on topic
  • Echo message on topic
  • Get fields from message type

Note: To call service with custom service source it before start server.

API

Tools

  • ros2_topic_list

    • Retrun list of available topics
    • Output:
      • topic_name (string): Topic name
      • topic_type (string): Message topic type
  • ros2_service_list

    • Retruns list available services
    • Output:
      • service_name (string): Service name
      • service_type (string): Service type
      • request_fields (string array): Fields in service
  • ros2_service_call

    • Call ros2 service
    • Inputs:
      • service_name (string): Service name
      • service_type (string): Service type
      • fields (string array): Fields in service request filled with user data
      • force_call (bool): Force service call without every field in service field up, Default set to false
    • Output:
      • result (string): Return result of the service call
      • error (string): Return error in case of error
    • Features:
      • Check if service exists
      • Check if every field in service is provide
  • ros2_topic_subscribe

    • Subscribes to a ROS 2 topic and collects messages either for a duration or a message limit.
    • Inputs:
      • topic_name (string): Topic name
      • msg_type (string): Message type
      • duration (float): How long subscribe topic
      • message_limit (int): How many messages collect
      • Default to collect first message, waiting 5 seconds
    • Output:
      • messages: Serialized messages from topic
      • count: Number of collected messages
      • duration: How long messages has been collected
  • ros2_get_messages

    • Inputs:
      • topic_name (string): Topic name
      • message_type (string): Message type
      • number_of_msg(int): How many messages get from data black box
      • time_start (str): Start time for data retrieval. Only messages with timestamps after this will be returned
      • time_end (str): End time for data retrieval. Only messages with timestamps before this will be returned
    • Output:
      • timestamps: Time values used to indicate when each message was created, recorded, or received. Typically represented as ISO 8601 strings or UNIX epoch times. Used for filtering, ordering, and synchronizing data.
      • messages: Individual units of published data in ROS 2 topics. Each message contains a structured payload defined by its message type (e.g., std_msgs/msg/String).
  • ros2_get_message_fields

    • Inputs:
      • message_type (string): Message type
    • Output:
      • Returns the field names and types for a given ROS 2 message request type
  • ros2_topic_publish

    • Inputs:
      • topic_name (string): Topic name
      • message_type (string): Message type
      • data (dict): Dictionary with message fields
    • Output:
      • status: Status of publication
  • ros2_topic_echo_wait

    • Inputs:
      • topic_name (string): Topic name
      • message_type (string): Message type
      • timeout (float): Duration to wait for a message before giving up.
    • Output:
      • message: The deserialized ROS 2 message, converted to a Python dictionary (via message_to_ordereddict)
      • received: true, indicating the message was successfully received

Usage

MCP Server Configuration

Note

The server is running inside a Docker container as the root user. To communicate with other ROS components, they must also be run as root.

Note

Due to this issue, this MCP server doesn't work with Copilot in Visual Studio Code.

Docker run

Set MCP setting to mcp.json.

"mcp_server_ros_2": {
    "command": "docker",
    "args": [
        "run",
        "-i",
        "--rm",
        "wisevision/mcp_server_ros_2"
    ],
    }

Build docker image locally

git clone https://github.com/wise-vision/mcp_server_ros_2.git
cd mcp_server_ros_2
docker build -t wisevision/mcp_server_ros_2 .

Add this to AI Agent prompt:

You are an AI assistant that uses external tools via an MCP server.
Before calling any tool, always check your memory to see if the list of available tools is known.
	•	If you don’t have the current tool list in memory, your first action should be to call the list-tools tool.
	•	Never guess tool names or parameters.
	•	If a user requests something that may require a tool and you don’t have the right tool info, ask them or call list-tools first.
Once the tool list is loaded, you may call tools directly using their documented names and schemas.

mcp_server_ros_2 FAQ

How do I start the mcp_server_ros_2 with a custom service source?
You must source the custom service before starting the server to enable service calls.
Can mcp_server_ros_2 access historical robotic data?
Yes, it integrates with WiseVision Data Black Box to retrieve stored messages.
What ROS2 features does this MCP server support?
It supports listing topics and services, subscribing and publishing messages, calling services, and echoing topics.
Is mcp_server_ros_2 compatible with all ROS2 message types?
It can handle any ROS2 message type, including custom types, by extracting message fields dynamically.
How does mcp_server_ros_2 help AI agents interact with robots?
It exposes ROS2 communication channels via MCP, enabling AI models to read sensor data and send commands in real time.
Does mcp_server_ros_2 support service calls?
Yes, it allows calling ROS2 services, provided the service source is sourced before server startup.
What programming language is mcp_server_ros_2 implemented in?
It is implemented in Python for easy integration and extensibility.
Can I use mcp_server_ros_2 for debugging ROS2 topics?
Yes, the echo message feature helps monitor topic messages for debugging purposes.