librealsense-mcp
by ros-claw
README.md
# librealsense-mcp
[](https://www.python.org/downloads/)
[](https://opensource.org/licenses/MIT)
[](https://www.intelrealsense.com/)
π **English** | [δΈζ](./README.zh.md)
Intel RealSense MCP Server β directly wraps the pyrealsense2 SDK, providing 26 MCP tools for AI assistants to directly control Intel RealSense depth cameras.
---
## Features
### Device Management
- `list_devices` β List all connected Intel RealSense devices
- `get_device_info` β Get detailed device information
- `hardware_reset` β Hardware reset the device
### Stream Control
- `start_pipeline` β Start device streaming (color/depth/infrared/IMU)
- `stop_pipeline` β Stop streaming
- `get_pipeline_status` β Check all active pipeline status
### Frame Capture
- `capture_frames` β Capture frame metadata
- `capture_color_image` β Capture color image and save as PNG
- `capture_depth_image` β Capture depth image (colorized or raw 16-bit)
- `capture_aligned_rgbd` β Capture aligned RGBD image pair
### Depth Measurement
- `get_distance` β Get depth value at pixel coordinates (meters)
- `get_depth_stats` β Depth statistics (min/max/mean/std), supports ROI
### Point Cloud
- `capture_pointcloud` β Export PLY point cloud file
- `get_pointcloud_data` β Point cloud data summary (bounding box, centroid)
### Filters
- `apply_depth_filters` β Configure depth filter chain (threshold/decimation/spatial/temporal/hole-filling)
### Calibration
- `get_intrinsics` β Camera intrinsics (fx/fy/ppx/ppy/distortion coefficients)
- `get_extrinsics` β Stream-to-stream extrinsics (rotation + translation)
- `deproject_pixel` β Deproject pixel to 3D coordinates
### Device Control
- `get_sensor_options` β List available sensor options
- `set_sensor_option` β Set sensor option
- `set_emitter` β IR emitter on/off
- `set_exposure` β Exposure control
### Advanced Mode
- `get_advanced_mode_json` β Export D400 advanced mode JSON
- `load_advanced_mode_json` β Load advanced mode configuration
### Multi-Camera
- `start_multi_pipeline` β Batch start multiple cameras
- `capture_multi_frames` β Multi-camera synchronized frame capture
---
## Quick Start
### Install Dependencies
```bash
# Install pyrealsense2 (choose based on your platform)
# Ubuntu/Debian
pip install pyrealsense2
# Or build from source (ARM64 platforms like Jetson)
# See: https://github.com/IntelRealSense/librealsense/blob/master/doc/installation.md
# Install Python dependencies
pip install -r requirements.txt
```
### Test Server
```bash
# Test if server starts
python mcp_server.py --test
# Run server (stdio transport)
python mcp_server.py
```
### MCP Configuration
Add to OpenClaw `config.yaml`:
```yaml
mcp:
servers:
librealsense:
command: python3
args: ["/path/to/librealsense-mcp/mcp_server.py"]
```
Or use Claude Desktop configuration:
```json
{
"mcpServers": {
"librealsense": {
"command": "python3",
"args": ["/path/to/librealsense-mcp/mcp_server.py"]
}
}
}
```
---
## Hardware Requirements
- Intel RealSense D400/L500 series cameras
- D435/D435i (recommended)
- D455
- D415
- L515
- USB 3.0 connection (required)
- Python 3.8+
---
## Usage Examples
```python
# List all devices
list_devices()
# Returns: {"devices": [{"serial": "12345", "name": "Intel RealSense D435"}], "count": 1}
# Start camera pipeline
start_pipeline(serial="12345", enable_color=True, enable_depth=True)
# Capture color image
capture_color_image(serial="12345", filename="color.png")
# Get depth value
get_distance(serial="12345", x=320, y=240)
# Returns: {"distance_m": 1.25}
# Capture point cloud
capture_pointcloud(serial="12345", filename="scene.ply")
# Stop pipeline
stop_pipeline(serial="12345")
```
---
## Architecture
```
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β MCP Client β
β (Claude / OpenClaw / etc.) β
ββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββ
β stdio
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β librealsense-mcp β
β (mcp_server.py / FastMCP) β
ββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β bridge.py β
β (RealSenseBridge - pyrealsense2) β
ββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Intel RealSense SDK 2.0 β
β (pyrealsense2) β
ββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββ
β USB 3.0
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Intel RealSense Camera β
β (D435/D455/L515/etc.) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
```
---
## Testing
```bash
# Run tests
cd tests
python demo_capture.py
```
---
## Related Projects
- [realsense-ros-mcp](https://github.com/ros-claw/realsense-ros-mcp) β ROS2 version of RealSense MCP Server
---
## License
MIT License - See [LICENSE](LICENSE)
---
**Made with β€οΈ for the robotics community**
This server cannot be deployed
Maintenance
ActivityInactive
ResponsivenessNo recent community issues