GW MCP Server
An MCP server providing tools to query gravitational wave data from GraceDB and GWOSC, enabling natural language queries about GW events.
README
GW MCP Server
An MCP (Model Context Protocol) server providing tools to query Gravitational Wave (GW) data from GraceDB and GWOSC.
What is MCP?
MCP (Model Context Protocol) allows AI assistants like Claude to use external tools. This server gives Claude the ability to query gravitational wave databases in real-time, so you can ask questions about GW events in natural language.
Sample Questions
Once connected, you can ask Claude questions like:
- "What was the GPS time of GW150914?"
- "Show me all events in the GWTC-3 catalog"
- "Get strain data from the Hanford detector around GW150914"
- "Search for gravitational wave events with FAR less than 1e-10"
- "What files are available for a specific GraceDB event?"
Example
<img width="1012" height="703" alt="Screenshot 2026-01-05 203324" src="https://github.com/user-attachments/assets/7fd8c9ed-8a7f-49ac-a5de-afc642feec89" />
Access Levels
| Source | Public Access | Authenticated Access |
|---|---|---|
| GWOSC | Full (strain data, catalogs) | N/A |
| GraceDB | Released events only | Full access to current observing run |
| GCN Kafka | No | Requires NASA Earthdata credentials |
This server works out-of-the-box with public data only.
Installation
Step 1: Create Conda Environment
# Create new conda environment with Python 3.11
conda create -n opticsGPT python=3.11 -y
# Activate the environment
conda activate opticsGPT
Step 2: Install Dependencies
cd C:\Users\Asus\Desktop\OpticsGPT\GW_MCP
# Install from requirements.txt
pip install -r requirements.txt
Step 3: Verify Installation
# Test GWOSC (should print GPS time)
python -c "from gwosc.datasets import event_gps; print('GW150914 GPS:', event_gps('GW150914'))"
Usage with Claude Desktop
Add to claude_desktop_config.json:
Or create the file
{
"mcpServers": {
"GW-Data": {
"command": "C:/Users/Asus/anaconda3/envs/mcp/python.exe",
"args": ["C:/Users/Asus/Desktop/GW_MCP/server.py"]
}
}
}
WARNING: You must update the paths below to match your system. Change:
- The Python executable path to your conda environment location
- The server.py path to where you cloned this repository
Find your Python path with:
conda activate mcp && where python
Using with Other LLMs and Frameworks
LangChain Integration
You can use this MCP server with LangChain using the langchain-mcp-adapters package:
pip install langchain-mcp-adapters
from langchain_mcp_adapters.client import MCPClient
from langchain_openai import ChatOpenAI
# Connect to the MCP server
client = MCPClient(
command="python",
args=["path/to/GW_MCP/server.py"]
)
# Get tools from MCP server
tools = client.get_tools()
# Use with any LangChain-compatible LLM
llm = ChatOpenAI(model="gpt-4")
llm_with_tools = llm.bind_tools(tools)
Open Source LLMs
For open source LLMs (Ollama, LMStudio, etc.), you can:
-
Use MCP-compatible clients: Some open source projects like MCP CLI support connecting MCP servers to local LLMs.
-
Direct function calling: Import the service classes directly in your Python code:
from services.gracedb_service import get_gracedb_service
from services.gwosc_service import get_gwosc_service
# Use services directly
gwosc = get_gwosc_service()
gps_time = gwosc.get_event_gps("GW150914")
print(f"GPS time: {gps_time}")
- Build a REST API: Wrap the services in a FastAPI/Flask server for any LLM that supports function calling via HTTP.
Available Tools
| Tool | Source | Description |
|---|---|---|
search_gw_events |
GraceDB | Search events by FAR, GPS time, pipeline |
get_event_details |
GraceDB | Get full metadata for an event |
get_superevent |
GraceDB | Get superevent information |
get_event_files |
GraceDB | List files (skymaps, PSD, etc.) |
get_event_labels |
GraceDB | Get event labels (DQV, PE_READY, etc.) |
get_event_gps |
GWOSC | Get GPS time for named event (GW150914, etc.) |
get_catalog_events |
GWOSC | Query GWTC-1/2/3 catalogs |
fetch_strain_data |
GWOSC | Get strain time-series by GPS range |
fetch_event_strain |
GWOSC | Get strain centered on a named event |
For LIGO/Virgo Collaboration Members
If you have LIGO credentials, you can access real-time alerts from the current observing run.
How GraceDB Authentication Works
By default, the ligo-gracedb client searches for credentials in this order:
- SciToken at
/tmp/bt_u${UID}orSCITOKEN_FILEenvironment variable - X.509 credentials from the
credparameter (cert/key pair or proxy file) - Environment variables:
X509_USER_CERT+X509_USER_KEY - Environment variable:
X509_USER_PROXY - Proxy from ligo-proxy-init:
/tmp/x509up_u${UID} - Default location:
~/.globus/usercert.pemand~/.globus/userkey.pem - No credentials (public access only)
Option 1: Using Environment Variables (Recommended)
Set these before running the MCP server:
# For SciToken
export SCITOKEN_FILE=/path/to/your/scitoken
# OR for X.509 certificate
export X509_USER_CERT=/path/to/usercert.pem
export X509_USER_KEY=/path/to/userkey.pem
# OR for proxy file
export X509_USER_PROXY=/tmp/x509up_u${UID}
Option 2: Modify the Service Code
Edit src/gw_mcp_server/services/gracedb_service.py:
# For X.509 cert/key pair:
self._client = GraceDb(
cred=('/path/to/cert.pem', '/path/to/key.pem')
)
# For combined proxy file:
self._client = GraceDb(
cred='/path/to/proxy.pem'
)
# To explicitly use only SciToken:
self._client = GraceDb(use_auth='scitoken')
# To explicitly use only X.509:
self._client = GraceDb(use_auth='x509')
Option 3: Force Public Access Only
If you want to explicitly disable authentication attempts:
self._client = GraceDb(force_noauth=True)
Getting Credentials
- ligo-proxy-init: Run
ligo-proxy-initto create a short-lived proxy from your certificate - htgettoken: Use
htgettokento obtain a SciToken - CILogon: Get certificates from https://cilogon.org
Test Your Authentication
from ligo.gracedb.rest import GraceDb
client = GraceDb()
client.show_credentials() # Prints auth type and info
# Test access to current run superevents
try:
for se in client.superevents('category: Production', max_results=5):
print(se['superevent_id'])
except Exception as e:
print(f"Auth required: {e}")
Useful GraceDb Client Options
GraceDb(
service_url='https://gracedb.ligo.org/api/', # Production server
# service_url='https://gracedb-playground.ligo.org/api/', # Test server
cred=None, # Path to credentials
force_noauth=False, # Skip credential lookup
fail_if_noauth=False, # Fail if no credentials found
reload_cred=False, # Auto-reload expiring credentials
reload_buffer=300, # Seconds before expiry to reload
use_auth='all', # 'all', 'scitoken', or 'x509'
retries=5, # Max retries on server error
)
For full documentation: https://ligo-gracedb.readthedocs.io/en/latest/
Data Sources
| Source | URL | Auth Required |
|---|---|---|
| GWOSC | https://gwosc.org | No |
| GraceDB | https://gracedb.ligo.org | For current run |
| GCN | https://gcn.nasa.gov | Yes (Earthdata) |
Citation
If you use this software in your research, please cite:
@software{gw_mcp,
title={GW MCP Server: Gravitational Wave Data Access for AI Agents},
author={Adam Zacharia Anil},
year={2025},
url={https://github.com/adamzacharia/GW_MCP}
}
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。