gnomAD MCP Server
# gnomAD MCP Server
## Overview
This MCP server provides a programmatic interface to the Genome Aggregation Database ([gnomAD](https://gnomad.broadinstitute.org/)) API, supporting multiple API versions (**v2.1.1**, **v3.1.2**, **v4.1.0**).
It abstracts version-specific field and schema differences, exposing a unified API for downstream tools and users.
## Status
š§ **Under Active Development** š§
This project is under active development. APIs and features may change without notice.
## Supported gnomAD API Versions
- **v4.1.0** (`gnomad_r4`)
- **v3.1.2** (`gnomad_r3`)
- **v2.1.1** (`gnomad_r2_1`)
## Supported Queries by Version
The following table summarizes which queries are available for each gnomAD API version:
| Query Type | Description | v2 | v3 | v4 |
|-------------------------------|------------------------------------------------------------------|-----|-----|-----|
| get_gene_info | Retrieve gene metadata and constraint metrics (direct lookup by gene_id/gene_symbol) | ā | ā | ā
|
| get_region_info | Retrieve variant and summary information for a genomic region | ā | ā | ā
|
| get_variant_info | Retrieve variant metadata and population frequency data (by variantId) | ā
| ā
| ā
|
| get_clinvar_variant_info | Retrieve ClinVar variant data and clinical significance | ā
| ā
| ā
|
| get_mitochondrial_variant_info| Retrieve mitochondrial variant data and population frequencies | ā | ā | ā
|
| get_structural_variant_info | Retrieve structural variant (SV) data and population frequencies | ā
| ā | ā
|
| get_copy_number_variant_info | Retrieve copy number variant (CNV) data and population frequencies| ā | ā | ā
|
| search_for_genes | Search for genes by symbol or name (no direct gene_id lookup in v2/v3) | ā
| ā
| ā
|
| search_for_variants | Search for variants by ID, gene, or region | ā
| ā
| ā
|
| get_str_info | Retrieve short tandem repeat (STR) data and population frequencies| ā | ā | ā
|
| get_all_strs | Retrieve all STRs in the dataset | ā | ā | ā
|
| get_variant_liftover | Retrieve liftover mapping for a variant between genomes | ā
| ā | ā |
| get_metadata | Retrieve gnomAD browser metadata and API version info | ā
| ā
| ā
|
- ā
= Supported in this version
- ā = Not supported in this version
## Dependencies
- Python >= 3.13
- `aiohttp >= 3.11.18`
- `fastmcp >= 2.2.1`
- `gql >= 3.5.2`
- `httpx >= 0.28.1`
- `mcp[cli] >= 1.6.0`
- `nest-asyncio >= 1.6.0`
- `pytest >= 8.3.5`
- `pytest-asyncio >= 0.26.0`
## Directory Structure
```
.
āāā gnomad/ # Main package
ā āāā __init__.py
ā āāā types.py # Type definitions
ā āāā queries/ # GraphQL query templates
ā ā āāā v2/ # v2.1 specific queries
ā ā āāā v3/ # v3 specific queries
ā ā āāā v4/ # v4 specific queries
ā āāā schemas/ # Versioned schema files
āāā tests/ # Test code and data
ā āāā input/ # Test input data
ā ā āāā analyzed_schemas/ # Analyzed schema data
ā ā āāā schema2query/ # Schema to query conversion
ā ā āāā schemas/ # Raw schema files
ā āāā output/ # Test output data
ā ā āāā server/ # Server test outputs
ā ā āāā v2/ # v2.1 test outputs
ā ā āāā v3/ # v3 test outputs
ā ā āāā v4/ # v4 test outputs
ā āāā scripts/ # Test utility scripts
ā āāā tests/ # Additional test modules
āāā server.py # FastMCP server entrypoint
āāā pyproject.toml # Project metadata
āāā README.md # This file
āāā README_tests.md # Testing documentation
```
## Setup
### Install dependencies
```bash
uv sync
```
### Activate the virtual environment
```bash
. .venv/bin/activate
```
### Test the server
```bash
uv --directory ./ run mcp dev server.py
```
### Add the MCP server to your MCP server list (Claude, Cursor, etc.)
```json
{
"mcpServers": {
"gnomad": {
"command": "uv",
"args": ["--directory", "where you cloned the repo", "run", "server.py"],
"env": {}
}
}
}
```
### Run tests
Please see [README_tests.md](./README_tests.md)
## Query & API Design
- Uses the **QueryTemplateEngine** pattern to manage version-specific GraphQL query templates.
- Currently, queries are fixed; see (`./gnomad/queries`)
- The queries were obtained using [schema_fetcher.py](gnomad/schemas/schema_fetcher.py) and [schema_analyzer.py](gnomad/schemas/schema_analyzer.py)
- [ ] TODO: Dynamic queries
- MCP tool endpoints are documented with detailed parameter and output descriptions.
## License
This MCP server itself is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.
This project uses the gnomAD API. Please ensure you cite gnomAD when using this tool or its outputs.
## Acknowledgements
- [gnomAD](https://gnomad.broadinstitute.org/)
- [FastMCP](https://github.com/jlowin/fastmcp)
TDQS
Scored across 12 tools
Each tool has a clearly distinct purpose targeting specific genomic data types (ClinVar variants, copy number variants, genes, metadata, mitochondrial variants, regions, STRs, structural variants, general variants, liftover, gene search, variant search). The descriptions clearly differentiate what each tool retrieves, with no apparent overlap in functionality.
Most tools follow a consistent 'get_*_info' or 'search_for_*' pattern, but there are minor deviations: 'get_copy_number_variant_info' uses 'variantId' while 'get_variant_info' uses 'variantId' (both camelCase), and 'get_structural_variant_info' uses 'variantId' while others use 'variant_id' (snake_case). The overall pattern is clear and readable despite these inconsistencies.
12 tools is well-scoped for a genomic database API server covering multiple data types (variants, genes, regions, etc.) across different gnomAD versions. Each tool serves a specific purpose in retrieving different genomic entities, with no obvious redundancy.
The toolset provides comprehensive retrieval capabilities for the gnomAD domain, covering all major genomic data types with both specific lookup and search functionality. The only minor gap is the version compatibility limitations noted in tool descriptions (some tools only work with specific gnomAD versions), but agents can work around this by checking metadata or using alternative tools.