Skip to main content

A generic SQL query interface for MCAP robotics data via the Model Context Protocol

Project description

mcap-mcp-server

PyPI Python CI codecov License

Query your robot's MCAP recordings with SQL — straight from your LLM.

Point Claude, Cursor, or any MCP client at your bag files. Ask questions in plain English. Get SQL-powered answers from DuckDB. No scripts, no pipelines, no BS.

MCAP files → mcap-mcp-server → DuckDB (in-memory) → SQL results → LLM

Supports JSON, Protobuf, ROS 1, ROS 2, and FlatBuffers out of the box.

Full documentation


Install

Zero-install via uvx (recommended) — or pip install:

pip install mcap-mcp-server

# ROS 2 users
pip install mcap-mcp-server[ros2]

# Everything
pip install mcap-mcp-server[all]

Configure Your MCP Client

Copy-paste the config below. That's it — no API keys, no setup, no database.

Cursor

Add to .cursor/mcp.json in your project:

{
  "mcpServers": {
    "mcap-query": {
      "command": "uvx",
      "args": ["mcap-mcp-server[all]"]
    }
  }
}

Claude Desktop

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "mcap-query": {
      "command": "uvx",
      "args": ["mcap-mcp-server[all]"]
    }
  }
}

Windsurf / VS Code / Other MCP Clients

Same JSON — check your client's docs for where to put it.

Recordings outside the project? Set MCAP_DATA_DIR=/path/to/recordings as an env var, or just give the LLM an absolute path — it handles that too.


What Can It Do?

Once configured, just talk to your LLM. It has 6 tools:

Tool What it does
list_recordings Find MCAP files in your project (or any path)
get_recording_info Metadata, channels, attachments for a file
get_schema SQL table names & column types — for query planning
load_recording Decode MCAP data into DuckDB
query Run SQL (full DuckDB — including ASOF JOIN)
get_statistics Quick stats (min/max/mean/std) for numeric fields

Example Prompts

Just ask your LLM:

  • "List all my recordings and show me what topics are in session_003.mcap"
  • "Load the battery data and find all moments where voltage dropped below 22V"
  • "Correlate IMU acceleration with motor current using an ASOF JOIN"
  • "Compare average battery voltage across my last 5 runs"

Example SQL (under the hood)

-- Time-windowed stats
SELECT (timestamp_us / 1000000) as second,
       AVG(voltage) as avg_v, MIN(voltage) as min_v
FROM battery GROUP BY second ORDER BY second

-- Cross-sensor correlation via ASOF JOIN
SELECT b.timestamp_us, b.voltage, i.linear_acceleration_x
FROM battery b ASOF JOIN imu i ON b.timestamp_us >= i.timestamp_us

-- Multi-recording comparison
SELECT 'run1' as run, AVG(voltage) FROM r1_battery
UNION ALL
SELECT 'run2', AVG(voltage) FROM r2_battery

Supported Encodings

Encoding Install
JSON Built-in
Protobuf pip install mcap-mcp-server[protobuf]
ROS 1 pip install mcap-mcp-server[ros1]
ROS 2 (CDR) pip install mcap-mcp-server[ros2]
FlatBuffers pip install mcap-mcp-server[flatbuffers]
All pip install mcap-mcp-server[all]

Configuration (Optional)

Defaults work for most setups. Tune if needed:

Variable Default Description
MCAP_DATA_DIR . Root directory to scan for MCAP files
MCAP_RECURSIVE true Scan subdirectories
MCAP_MAX_MEMORY_MB 2048 Max memory for loaded data (LRU eviction)
MCAP_QUERY_TIMEOUT_S 30 SQL query timeout
MCAP_DEFAULT_ROW_LIMIT 1000 Default result row limit
MCAP_MAX_ROW_LIMIT 10000 Max allowed row limit
MCAP_TRANSPORT stdio stdio or sse

Docker

docker run -d \
  -v /data/recordings:/data:ro \
  -e MCAP_DATA_DIR=/data \
  -e MCAP_TRANSPORT=sse \
  -p 8080:8080 \
  ghcr.io/turkenberg/mcap-mcp-server:latest

Development

git clone https://github.com/turkenberg/mcap_mcp_server.git
cd mcap_mcp_server
git submodule update --init
pip install -e ".[dev]"
pytest

License

GNU General Public License v3.0 — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcap_mcp_server-0.3.0.tar.gz (78.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcap_mcp_server-0.3.0-py3-none-any.whl (44.7 kB view details)

Uploaded Python 3

File details

Details for the file mcap_mcp_server-0.3.0.tar.gz.

File metadata

  • Download URL: mcap_mcp_server-0.3.0.tar.gz
  • Upload date:
  • Size: 78.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mcap_mcp_server-0.3.0.tar.gz
Algorithm Hash digest
SHA256 d0b5c27a43a637803d27c1240b169bc6be22a4f90385912b9a269e6da142398a
MD5 e854ff6ca7c6dc8da1d64009db881ffc
BLAKE2b-256 b25f9a7522470df0c41070920778919cacd735a270df5c478ad10459c355af6d

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcap_mcp_server-0.3.0.tar.gz:

Publisher: ci.yml on turkenberg/mcap_mcp_server

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mcap_mcp_server-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mcap_mcp_server-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4711e1f83322bc910608d40ef889225d7f48cff1cca5a5211255a15137b135fc
MD5 4ac6134d8dafcb93a4f63f4e11335c9c
BLAKE2b-256 915dabcd26c6fccfb7d5164640ffbe9d48707af022bec64e2909e5e62db5076d

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcap_mcp_server-0.3.0-py3-none-any.whl:

Publisher: ci.yml on turkenberg/mcap_mcp_server

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page