Skip to main content
Glama
realsense-ros-mcp
by ros-claw
README.md
# realsense-ros-mcp

[![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
[![ROS2 Humble](https://img.shields.io/badge/ROS2-Humble-blue.svg)](https://docs.ros.org/en/humble/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![RealSense](https://img.shields.io/badge/Intel-RealSense-blue.svg)](https://www.intelrealsense.com/)

🌐 **English** | [δΈ­ζ–‡](./README.zh.md)

Intel RealSense ROS2 MCP Server β€” wraps the realsense2_camera ROS2 interface, providing 25 MCP tools for AI assistants to control Intel RealSense depth cameras via ROS2.

---

## Features

### ROS2 Node Management
- `launch_camera` β€” Launch realsense2_camera ROS2 node
- `stop_camera` β€” Stop camera node
- `list_active_cameras` β€” List active camera processes

### Topic Operations
- `list_topics` β€” List ROS2 topics
- `get_topic_info` β€” Get topic type and publishers
- `get_topic_hz` β€” Measure topic publishing frequency
- `capture_color_image` β€” Capture color image from topic
- `capture_depth_image` β€” Capture depth image from topic
- `capture_rgbd` β€” Capture aligned RGBD image pair
- `capture_infrared` β€” Capture infrared image
- `get_imu_data` β€” Get IMU data
- `capture_pointcloud` β€” Capture point cloud (PLY/PCD)

### Service Calls
- `get_device_info` β€” Call DeviceInfo service

### Parameter Control
- `get_camera_parameters` β€” Get all parameters
- `set_camera_parameter` β€” Set parameter
- `enable_filter` β€” Enable/disable filters
- `set_depth_profile` β€” Set depth stream resolution and FPS
- `set_color_profile` β€” Set color stream resolution and FPS

### TF and Calibration
- `get_camera_info` β€” Get CameraInfo (intrinsics)
- `get_tf` β€” Query TF transform
- `get_extrinsics` β€” Get extrinsics

### Multi-Camera
- `launch_multi_cameras` β€” Batch launch multiple cameras
- `capture_multi_frames` β€” Multi-camera synchronized capture

### ROS2 Diagnostics
- `check_ros2_status` β€” Check ROS2 environment
- `list_ros2_nodes` β€” List all nodes

---

## Quick Start

### Prerequisites

```bash
# Install ROS2 Humble (Ubuntu 22.04)
# See: https://docs.ros.org/en/humble/Installation.html

# Install realsense2_camera package
sudo apt install ros-humble-realsense2-camera

# Or install from source
# cd ~/ros2_ws/src
# git clone https://github.com/IntelRealSense/realsense-ros.git -b ros2-development
# cd ..
# rosdep install -i --from-path src --rosdistro humble -y
# colcon build
```

### Installation

```bash
# Ensure ROS2 is sourced
source /opt/ros/humble/setup.bash

# Install Python dependencies
pip install -r requirements.txt

# Test server
python mcp_server.py --test

# Run server (stdio)
python mcp_server.py

# Demo (without MCP)
python tests/demo_ros_capture.py
```

### MCP Configuration

Add to OpenClaw `config.yaml`:

```yaml
mcp:
  servers:
    realsense-ros:
      command: bash
      args: ["-c", "source /opt/ros/humble/setup.bash && python3 /path/to/realsense-ros-mcp/mcp_server.py"]
```

Or use Claude Desktop configuration:

```json
{
  "mcpServers": {
    "realsense-ros": {
      "command": "bash",
      "args": ["-c", "source /opt/ros/humble/setup.bash && python3 /path/to/realsense-ros-mcp/mcp_server.py"]
    }
  }
}
```

---

## Hardware Requirements

- Intel RealSense D400/L500 series cameras
  - D435/D435i (recommended)
  - D455
  - D415
  - L515
- ROS2 Humble (Ubuntu 22.04)
- realsense2_camera package installed
- USB 3.0 connection (required)
- Python 3.8+

---

## Usage Examples

```python
# Check ROS2 status
check_ros2_status()

# Launch camera node
launch_camera(serial="12345", namespace="camera")

# List topics
list_topics()
# Returns: ["/camera/color/image_raw", "/camera/depth/image_rect_raw", ...]

# Capture color image
capture_color_image(topic="/camera/color/image_raw", filename="color.png")

# Get camera parameters
get_camera_parameters(node_namespace="camera")

# Set parameter
set_camera_parameter(node_namespace="camera", param_name="depth_module.emitter_enabled", param_value=True)

# Stop camera
stop_camera(namespace="camera")
```

---

## Architecture

```
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     MCP Client                          β”‚
β”‚              (Claude / OpenClaw / etc.)                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                     β”‚ stdio
                     β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                realsense-ros-mcp                        β”‚
β”‚              (mcp_server.py / FastMCP)                  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                     β”‚
                     β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                   bridge.py                             β”‚
β”‚        (ROS2Bridge - rclpy / ros2cli integration)       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                     β”‚
                     β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              ROS2 Humble + realsense2_camera            β”‚
β”‚              (ROS2 nodes / topics / services)           β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                     β”‚ USB 3.0
                     β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚             Intel RealSense Camera                      β”‚
β”‚                (D435/D455/L515/etc.)                    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```

---

## Comparison with librealsense-mcp

| Feature | librealsense-mcp | realsense-ros-mcp |
|------|------------------|-------------------|
| Low-level | pyrealsense2 direct calls | ROS2 topics/services |
| Dependencies | pyrealsense2 | ROS2 Humble + realsense2_camera |
| Use Case | Standalone apps, lightweight | ROS2 robotics integration |
| TF Support | ❌ | βœ… |
| Point Cloud Format | PLY | PLY / PCD |
| Filters | SDK built-in | ROS2 dynamic parameter config |
| Multi-camera | Manual management | ROS2 native support |

---

## Testing

```bash
# Ensure ROS2 environment is set
source /opt/ros/humble/setup.bash

# Run tests
cd tests
python demo_ros_capture.py
```

---

## Related Projects

- [librealsense-mcp](https://github.com/ros-claw/librealsense-mcp) β€” Direct SDK version of RealSense MCP Server
- [realsense-ros](https://github.com/IntelRealSense/realsense-ros) β€” Official ROS2 RealSense package

---

## License

MIT License - See [LICENSE](LICENSE)

---

**Made with ❀️ for the ROS2 robotics community**