mcap-mcp-server
SQL query interface for MCAP robotics data via the Model Context Protocol.
Decodes MCAP recordings (any encoding), loads them into DuckDB as in-memory tables, and exposes 6 MCP tools for discovery, schema inspection, loading, and SQL querying. Runs in-process — no external database, no ETL.
graph LR
Client["MCP Client<br/>(Cursor, Claude Desktop)"]
Server["mcap-mcp-server"]
DuckDB["DuckDB<br/>(in-process SQL)"]
Files["MCAP Files<br/>(any encoding)"]
Client -->|MCP protocol| Server
Server -->|read & decode| Files
Server -->|register & query| DuckDB
Quick Start
pip install mcap-mcp-server # core (JSON built-in)
pip install mcap-mcp-server[ros2] # + ROS 2 CDR decoder
pip install mcap-mcp-server[all] # all encodings
Add to your MCP client config (Cursor: .cursor/mcp.json, Claude Desktop: claude_desktop_config.json):
{
"mcpServers": {
"mcap-query": {
"command": "uvx",
"args": ["mcap-mcp-server[all]"]
}
}
}
That’s it. Point your LLM at MCAP files and ask questions.
Key Design Choices
Encoding-agnostic — Pluggable decoder system: JSON, Protobuf, ROS 1, ROS 2, FlatBuffers. Add custom decoders via entry points.
DuckDB as query engine — Full analytical SQL including
ASOF JOINfor cross-sensor time correlation. Read-only, sandboxed (no file-system access from SQL).Zero infrastructure — No database server, no schema migration, no config files required. Scans the working directory by default.
LRU memory management — Configurable memory cap (
MCAP_MAX_MEMORY_MB, default 2 GB) with least-recently-used eviction across loaded recordings.Topic → table mapping —
/sensors/imubecomes tableimu,/battery/statusbecomesbattery_status. Every table gets atimestamp_uscolumn for JOINs. A_metadatatable holds MCAP metadata records.
Tools
Tool |
Purpose |
|---|---|
|
Discover MCAP files in a directory |
|
Metadata, channels, attachments |
|
Table names, column names & DuckDB types |
|
Decode + register as DuckDB tables |
|
Execute SQL (full DuckDB dialect) |
|
Server version, decoders, upgrade command |
Supported Encodings
Encoding |
Decoder |
Install extra |
|---|---|---|
JSON |
|
— |
Protobuf |
|
|
ROS 1 (bag) |
|
|
ROS 2 (CDR) |
|
|
FlatBuffers |
|
|