Skip to main content

GraceDB MCP Server

An open-source Model Context Protocol (MCP) server that exposes LIGO/Virgo/KAGRA gravitational-wave alerts from GraceDB to LLM agents. It bridges the official ligo-gracedb client with the MCP standard so an agent can query, classify, and fetch data for gravitational-wave candidate events.

Intended as the data-ingestion layer for a downstream signal-processing / anomaly-detection pipeline (e.g. isolating astrophysical "chirps" from instrumental glitches).

Tools

Tool What it does
search_superevents Search recent superevents by time window and significance (FAR / astrophysical probability).
get_event_metadata Full superevent record + source classification (BBH / BNS / NSBH / Terrestrial).
download_event_files Download GraceDB artifacts: skymaps, p_astro.json, PE results, logs.
download_strain_data Fetch public strain time series from GWOSC around the event GPS time.
utc_to_gps Convert an ISO-8601 UTC timestamp to GPS seconds.
search_catalog_events Search published GWOSC catalogue events (GWTC-1 to GWTC-5) by masses, distance, SNR, p_astro.
get_catalog_event Source parameters with 90% intervals for one event, by GW name or GraceDB id.
get_event_labels GraceDB labels (data quality, review, retraction, products ready) explained in plain English.
check_data_availability Which detectors have public GWOSC strain for an event or GPS span, before you download.

⚠️ Important: where strain data actually comes from

GraceDB does not host raw strain data. It stores event artifacts (skymaps, classifications, parameter-estimation results). The public strain time series lives at GWOSC and is fetched by GPS time via gwpy. Public strain is only available for released observing runs — fresh low-latency alerts will not have public strain yet. download_strain_data reflects this: it reads t_0 from GraceDB, then pulls open data from GWOSC (and cleanly reports when data isn't public).

Requirements

  • Python 3.10+
  • mcp, ligo-gracedb, gwosc, python-dotenv
  • Optional: gwpy (for download_strain_data and utc_to_gps) — installed via the strain extra.

Install

Run straight from PyPI with uv:

uvx --from "gracedb-mcp[strain]" gracedb-mcp

Or from source:

git clone https://github.com/izabelamaria24/gracedb-mcp.git
cd gracedb-mcp
python -m venv .venv && source .venv/bin/activate
pip install -e ".[strain]"     # omit [strain] if you don't need strain download

Configuration

Copy .env.example to .env and adjust. Anonymous access is enough for public superevents:

cp .env.example .env
Variable Purpose
GRACEDB_SERVICE_URL API base URL (production or playground).
GRACEDB_FORCE_NOAUTH true for anonymous public access.
GRACEDB_PROXY / GRACEDB_CERT + GRACEDB_KEY LVK member authentication (X.509).
GRACEDB_MCP_DATA_DIR Where downloaded files are written (default ~/.cache/gracedb-mcp; /data in Docker).

Run locally

gracedb-mcp          # speaks MCP JSON-RPC over stdio

Development

Requires Python 3.11+ (the mcp 2.x SDK needs 3.10+).

pip install -e ".[dev]"
pytest -q            # tests mock the GraceDB client, no network needed

Run with Docker

A prebuilt image (linux/amd64 and arm64, with strain support) is published to GHCR:

docker run --rm -i -v gracedb-data:/data ghcr.io/izabelamaria24/gracedb-mcp:latest

Or build it yourself:

docker build -t gracedb-mcp .
docker run --rm -i -v gracedb-data:/data gracedb-mcp

Connect to an MCP client

Claude Desktop / VS Code (mcp.json)

Add to your MCP client configuration:

{
  "mcpServers": {
    "gracedb": {
      "command": "gracedb-mcp",
      "env": {
        "GRACEDB_FORCE_NOAUTH": "true",
        "GRACEDB_MCP_DATA_DIR": "./data"
      }
    }
  }
}

Or run the container directly:

{
  "mcpServers": {
    "gracedb": {
      "command": "docker",
      "args": ["run", "--rm", "-i", "-v", "gracedb-data:/data", "ghcr.io/izabelamaria24/gracedb-mcp:latest"]
    }
  }
}

Example agent prompts

  • "Search for superevents from 2023-05-01 to 2023-06-01 with a FAR below 1e-8."
  • "What's the source classification for S230518h? Is it more likely a BBH or an NSBH?"
  • "Download the skymap and p_astro file for S230518h."
  • "Fetch H1 and L1 strain around GW150914."
  • "What are the masses of GW190814, and how certain are they?"
  • "List GWTC-3 events with total mass under 10 solar masses."
  • "Was S190814bv checked by a human? What do its labels mean?"
  • "Is there public strain for GW190814 from every detector?"

RL environment (experimental)

gw_rl is a Gymnasium environment built on strain fetched by this server. Each episode shows the agent a 1 s spectrogram and it answers noise, chirp or glitch (+1 correct, -1 wrong).

Real chirps are scarce, so training injects synthetic chirps into real detector noise; the real catalogue events are kept for evaluation. Chirps are IMRPhenomD waveforms from LALSimulation (--chirp imr, default) or a simple analytic sweep (--chirp toy). Glitches are real LIGO glitches labelled by Gravity Spy (--glitch real, default) or sine-Gaussian bursts (--glitch synthetic).

It is not part of the PyPI package; run it from a clone of this repository (needs pip 25.1+):

pip install -e . --group rl
python scripts/fetch_training_strain.py --catalog GWTC-3-confident  # small files, a few MB
python scripts/fetch_glitches.py --files 30  # ~3 GB of GWOSC hour files, cached by gwpy
python scripts/train_agent.py --algo ppo mlp cnn --verbose

Roadmap

  • Streamable-HTTP transport (in addition to stdio) for remote deployments.
  • MCP resources for cached skymaps and p_astro files.

Disclaimer

Unofficial; not affiliated with or endorsed by LIGO, Virgo, KAGRA or GraceDB. Respect the GWOSC and GraceDB data-use policies.

If you publish results using data fetched by this server, cite the data sources: GWOSC (CC BY 4.0) and, for glitch labels, Gravity Spy.

License

GPL-3.0-or-later, matching its core dependencies ligo-gracedb and gwpy.

Metadata

Release files for gracedb-mcp 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gracedb-mcp 0.2.0
File Size Uploaded Provenance
gracedb_mcp-0.2.0.tar.gz 287.8 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for gracedb-mcp 0.2.0
File Interpreter ABI Platform
gracedb_mcp-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 316.1 kB

Release files / gracedb_mcp-0.2.0.tar.gz

Download URL gracedb_mcp-0.2.0.tar.gz
Size 287.8 kB
Tags Source
SHA-256 checksum
How to use checksums
7f6bbf16377ae91d40ec87798c1e30f5800c646998910acf109e9dc55a11ef63
BLAKE2b-256 checksum
How to use checksums
d195fe505c7dc7bb4033a312359d40e7c87ff0b7a3a70f9104cbaa6d5d3c740c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

Release files / gracedb_mcp-0.2.0-py3-none-any.whl

Download URL gracedb_mcp-0.2.0-py3-none-any.whl
Size 28.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4d73b9c5f25ef874cc3514cfd1acae2c6b3985bd1345a69cc62a9f622e8572dc
BLAKE2b-256 checksum
How to use checksums
50b465f669401bc2f696cc047c4f7b693151949d289002c963346a9fb940db17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

Security for gracedb-mcp 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for gracedb_mcp-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page