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

Requires uv (the Python package runner). If you don't have it:

curl -LsSf https://astral.sh/uv/install.sh | sh

That's it — uvx handles the rest. No pip install needed.

Manual install (optional): 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.4.0.tar.gz (79.1 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.4.0-py3-none-any.whl (44.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mcap_mcp_server-0.4.0.tar.gz
  • Upload date:
  • Size: 79.1 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.4.0.tar.gz
Algorithm Hash digest
SHA256 f72ce13b124a27e15df90d0de50f3a430a7134ff3278d3ddc2d1bc803b2a1f45
MD5 92a3dff3db668185d03fd51bafe25175
BLAKE2b-256 512fb0945c991fb3e35019c3d583c806755e41b7df15da484bf961f0d81a7e97

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcap_mcp_server-0.4.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.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mcap_mcp_server-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6b6d3c7c657c06c6c85f0bd0bd3f65a213fb34b53f9e3e9333622b4c78bde716
MD5 916ee69744fceedffc2e81cbc39ed905
BLAKE2b-256 7e491d713d67a55e2e5ff461720c5b211e7e33c66fb4b083918d8f6768f31e1d

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcap_mcp_server-0.4.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