biothings-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@biothings-mcp annotate gene BRCA1"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
biothings-mcp
MCP (Model Context Protocol) server for Biothings.io
This server implements the Model Context Protocol (MCP) for BioThings, providing a standardized interface for accessing and manipulating biomedical data. MCP enables AI assistants and agents to access specialized biomedical knowledge through structured interfaces to authoritative data sources. Supported BioThings data sources include:
mygene.info — Gene annotation and query service
myvariant.info — Variant annotation and query service
mychem.info — Chemical compound annotation and query service
If you want to understand more what is Model Context Protocol and how to use it more efficiently you can take DeepLearning AI Course or just search for MCP videos on YouTube.
About MCP (Model Context Protocol)
MCP is a protocol that bridges the gap between AI systems and specialized domain knowledge. It enables:
Structured Access: Direct connection to authoritative biomedical data sources
Natural Language Queries: Simplified interaction with specialized databases
Type Safety: Strong typing and validation through biothings-typed-client
AI Integration: Seamless integration with AI assistants and agents
Related MCP server: Synapse MCP Server
Available API Interfaces
This server provides dedicated API interfaces for different BioThings data types, leveraging the biothings-typed-client library. These interfaces are implemented using the following tool handlers:
Gene Interface:
GeneTools(wrapsGeneClientAsync)Variant Interface:
VariantTools(wrapsVariantClientAsync)Chemical Interface:
ChemTools(wrapsChemClientAsync)Taxon Interface:
TaxonTools(wrapsTaxonClientAsync)Download Interface:
DownloadTools(provides file download and sequence analysis capabilities)
Local File Saving Features
The server includes local file saving capabilities through the DownloadTools interface, which provides:
Download Tools
download_entrez_data: Download data from NCBI Entrez databases (returns content as string)download_entrez_data_local: Download data from NCBI Entrez databases and save to local file
Output Directory Management
Default Location: Files are saved to
biothings_output/directory in the current working directoryCustom Location: Use
--output-dirparameter to specify a custom output directoryAutomatic Creation: Output directories are created automatically if they don't exist
Unique Filenames: Auto-generated filenames include UUID prefixes to avoid conflicts
Supported File Formats
FASTA:
.fastaextension for sequence dataGenBank:
.gbextension for GenBank format dataAlignment:
.alnextension for alignment resultsJSON:
.jsonextension for structured dataText:
.txtextension for general text data
Quick Start
Installing uv
# Download and install uv
curl -LsSf https://astral.sh/uv/install.sh | sh
# Verify installation
uv --version
uvx --versionuvx is a very nice tool that can run a python package installing it if needed.
Running with uvx
You can run the biothings-mcp server directly using uvx without cloning the repository:
STDIO Mode (for MCP clients that require stdio, can be useful when you want to save files)
# Run the server in STDIO mode (default mode)
uvx biothings-mcp
# Or explicitly specify stdio mode
uvx --from biothings-mcp stdio
# With custom output directory
uvx --from biothings-mcp stdio --output-dir ./my_dataHTTP Streamable Mode (Web Server)
# Run the server in streamable HTTP mode on default port (3001)
uvx --from biothings-mcp server run
# Run on a custom port
uvx --from biothings-mcp server run --port 8000
# Run on custom host and port
uvx --from biothings-mcp server run --host 0.0.0.0 --port 8000
# With custom output directory
uvx --from biothings-mcp server run --output-dir ./my_dataSSE Mode (Server-Sent Events)
# Run the server in SSE mode on default port (3001)
uvx --from biothings-mcp sse
# Run on a custom port
uvx --from biothings-mcp sse --port 8000The HTTP streamable mode will start a web server that you can access at http://localhost:3001/mcp (with documentation at http://localhost:3001/docs). The STDIO mode is designed for MCP clients that communicate via standard input/output, while SSE mode uses Server-Sent Events for real-time communication.
Configuring your (Anthropic Claude Desktop, Cursor, Windsurf, etc.)
We provide stdio configuration using the proxy (might need npx to run):
mcp-config-remote.json - for remote configuration
mcp-config-stdio.json - stdio configuration for localhost for MCP clients which do not support
Inspecting Biothings MCP server
If you want to inspect the methods provided by the MCP use npx (you may need to install nodejs and npm)
Test your MCP setup with the MCP Inspector.
If you want to inspect local streamable-http server you use:
npx @modelcontextprotocol/inspector --config mcp-config.json --server biothings-mcpAdd -remote suffix for the remote server.
If you want to inspect stdio local server you should use
npx @modelcontextprotocol/inspector --config mcp-config-stdio.json --server biothings-mcpYou can also run inspector manually and put server parameters in the interface:
npx @modelcontextprotocol/inspectorAfter that you can explore its methods with MCP Inspector at http://127.0.0.1:6274
Repository setup
# Clone the repository
git clone https://github.com/longevity-genie/biothings-mcp.git
cd biothings-mcp
uv syncRunning the MCP Server
If you already cloned the repo you can run the server with uv
# Start the MCP server in HTTP streamable mode (default port 3001)
uv run server run
# Run in STDIO mode
uv run stdio
# Run in SSE mode
uv run sse
# Run with custom port
uv run server run --port 8000
# Run with custom output directory
uv run server run --output-dir ./my_dataIntegration with AI Systems
To integrate this server with your MCP-compatible AI client, you can use one of the preconfigured JSON files provided in this repository:
For connecting to a locally running server: Use
mcp-config.json. Ensure the server is running first, either viauv run server(see Running the MCP Server) ordocker-compose up(see Docker Deployment).For connecting to the publicly hosted server: Use
mcp-config-remote.json. This connects tohttps://biothings.longevity-genie.info/mcpand doesn't require you to run anything locally.
Simply point your AI client (like Cursor, Windserve, ClaudeDesktop, VS Code with Copilot, or others) to use the appropriate configuration file.
Here's an example of how the tools might appear in an MCP client like Cursor after configuration:

KNOWN ISSUES
The library is beta-quality. The major problem right now is that LLM-s are often stupid and do not know how to put valid gene and gene variant symbols. We plan to mitigrate it by extending comments and providing additional method for entity resolution.
Testing & Verification
Run tests for the API endpoint:
uv run pytest -vvv -sYou can use MCP inspector with locally build MCP server same way as with uvx
Note: Using the MCP Inspector is optional. Most MCP clients (like Cursor, Windsurv, etc.) will automatically display the available tools from this server once configured. However, the Inspector can be useful for detailed testing and exploration.
If you choose to use the Inspector via npx, ensure you have Node.js and npm installed. Using nvm (Node Version Manager) is recommended for managing Node.js versions.
This opens a web interface where you can explore and test all available tools.
Documentation
For detailed documentation about the MCP protocol and its implementation, refer to:
License
This project is licensed under the MIT License.
Acknowledgments
BioThings for the REST API and original client library
MCP Protocol for the protocol specification
Pydantic for the data validation framework
FastAPI-MCP for the MCP server implementation
This project is part of the Longevity Genie organization, which develops open-source AI assistants and libraries for health, genetics, and longevity research.
We are supported by:

HEALES - Healthy Life Extension Society
and

IBIMA - Institute for Biostatistics and Informatics in Medicine and Ageing Research
Available Tools
19 toolsbiothings_download_entrez_dataA
Download data from NCBI Entrez databases using Bio.Entrez.
Downloads data records from specified NCBI Entrez databases. This tool is designed to be called
by automated agents (like LLMs) or other services.
**Critical Configuration:**
The server hosting this API *must* have the `ENTREZ_EMAIL` environment variable set
to a valid email address. NCBI requires this for Entrez queries to monitor usage
and prevent abuse. Without it, NCBI may block requests.
**Parameters:**
- `ids` (List[str], required): A list of unique identifiers for the records to fetch
from the specified Entrez database. Example: `["NM_000546.6", "AY123456.1"]`
- `db` (DB_LITERAL, required): The target NCBI Entrez database.
Common choices for sequences: 'nucleotide', 'protein'.
Other examples: 'gene', 'pubmed', 'taxonomy'.
Ensure the `ids` provided are appropriate for the selected `db`.
- `reftype` (Literal["fasta", "gb"], required): The desired format for the
downloaded data.
- "fasta": Returns data in FASTA format.
- "gb": Returns data in GenBank format.
Ensure the chosen `reftype` is compatible with the selected `db`.
**Returns:**
On success: Returns the downloaded data as a single raw string with the
data fetched from Entrez in the specified `reftype`.
**Example Usage:**
To fetch the FASTA sequence for human TP53 mRNA (NM_000546.6):
```
download_entrez_data(
ids=["NM_000546.6"],
db="nucleotide",
reftype="fasta"
)
```
Inputs: db (required), ids (required), reftype (required). Returns: result
biothings_download_entrez_data_localA
Download data from NCBI Entrez databases and save to local file.
Same as download_entrez_data but saves the result to a local file instead of returning the content.
This is useful for large downloads or when you want to persist the data.
**Parameters:**
- `ids` (List[str], required): A list of unique identifiers for the records to fetch
- `db` (DB_LITERAL, required): The target NCBI Entrez database
- `reftype` (Literal["fasta", "gb"], required): The desired format for the downloaded data
- `output_path` (Optional[str]): Custom output path. If None, generates unique filename
**Returns:**
LocalFileResult containing:
- `path`: Path to the saved file
- `format`: File format used
- `success`: Whether the operation succeeded
- `error`: Error message if failed
**Example Usage:**
```
download_entrez_data_local(
ids=["NM_000546.6"],
db="nucleotide",
reftype="fasta",
output_path="tp53_sequence.fasta"
)
```
Inputs: db (required), ids (required), reftype (required), output_path. Returns: object
biothings_get_chemB
Fetch a specific chemical compound by ID (e.g., InChIKey, PubChem CID).
Retrieves detailed information about a specific chemical compound using its identifier.
**Supported ID formats:**
- InChIKey: "KTUFNOKKBVMGRW-UHFFFAOYSA-N" (Glucose)
- PubChem CID: "5793" (Glucose)
- SMILES: "C([C@@H]1[C@H]([C@@H]([C@H]([C@H](O1)O)O)O)O"
Returns comprehensive chemical information including structural properties, physical properties,
chemical properties, stereochemistry information, and chemical identifiers.
Inputs: chem_id (required), email, fields. Returns: Response model for chemical compound information from MyChem.info. This class r…
biothings_get_chemsA
Fetch multiple chemical compounds by a comma-separated list of IDs.
Retrieves information for multiple chemical compounds in a single request.
**Input Format:** Accepts comma-separated list of chemical IDs in various formats:
- InChIKeys: "KTUFNOKKBVMGRW-UHFFFAOYSA-N,XEFQLINVKFYRCS-UHFFFAOYSA-N"
- PubChem CIDs: "5793,5281"
- Mixed formats: "KTUFNOKKBVMGRW-UHFFFAOYSA-N,5281"
Inputs: chem_ids (required), email, fields. Returns: result
biothings_get_geneA
Fetch a specific gene by Entrez or Ensembl ID.
Retrieves detailed information for a **single, specific gene** using its exact known identifier.
**This is the preferred tool over `query_genes` for fetching a specific gene when you already know
its standard ID (Entrez or Ensembl) and don't need complex search filters.**
**Supported Identifiers:**
- Entrez Gene ID: e.g., `1017`
- Ensembl Gene ID: e.g., `ENSG00000123374`
Inputs: gene_id (required), email, fields, species. Returns: Response model for gene information
biothings_get_gene_metadataA
Retrieve MyGene.info database metadata including stats and fields.
Retrieve metadata about the underlying MyGene.info gene annotation database, **NOT** information about specific genes.
**Use this tool ONLY to understand the database itself** (e.g., to discover available fields, check data versions,
or get overall statistics). It **CANNOT** be used to find or retrieve data for any particular gene.
**Returned Information:**
- `stats`: Database statistics (e.g., total number of genes)
- `fields`: Available gene annotation fields and their data types
- `index`: Information about the backend data index
- `version`: Data version information
Inputs: email. Returns: index, stats, fields, version
biothings_get_genesA
Fetch multiple genes by a comma-separated list of Entrez or Ensembl IDs.
Retrieves detailed information for **multiple specific genes** in a single request using their exact known identifiers.
**This is the preferred tool over `query_many_genes` for fetching multiple specific genes when you already know
their standard IDs (Entrez, Ensembl) and don't need complex search filters.**
**Input Format:** Accepts a comma-separated list of gene IDs (Entrez or Ensembl).
**Example:** `gene_ids=1017,1018` or `gene_ids=ENSG00000123374,ENSG00000134057`
Inputs: gene_ids (required), email, fields, species. Returns: result
biothings_get_taxonA
Fetch a specific taxon by NCBI ID or scientific name.
Retrieves detailed information about a specific taxon using its identifier.
**Supported Identifiers:**
- NCBI ID: 9606 (Homo sapiens)
- Scientific name: "Homo sapiens"
Returns comprehensive taxon information including basic information (ID, scientific name, common name),
taxonomic classification (rank, parent taxon), lineage information, alternative names and authorities,
and gene data availability.
Inputs: taxon_id (required), email, fields. Returns: Response model for taxon information with version field as optional
biothings_get_taxonsA
Fetch multiple taxa by a comma-separated list of NCBI IDs or scientific names.
Retrieves information for multiple taxa in a single request.
**Input Format:** Accepts comma-separated list of taxon IDs (either NCBI IDs or scientific names).
**Examples:**
- Multiple NCBI IDs: "9606,10090" (Homo sapiens and Mus musculus)
- Multiple scientific names: "Homo sapiens,Mus musculus"
- Mixed IDs: "9606,Mus musculus" (Homo sapiens by NCBI ID and Mus musculus by name)
Inputs: taxon_ids (required), email, fields. Returns: result
biothings_get_variantA
Fetch a specific variant by HGVS or rsID.
Retrieves detailed annotation data for a **single, specific variant** using its identifier.
**This is the preferred tool over `query_variants` for fetching a specific variant when you already know
its standard ID (HGVS or rsID) and don't need complex search filters.**
**Supported Identifiers:**
- HGVS ID (e.g., `chr7:g.140453134T>C`). *Note: MyVariant.info primarily uses hg19-based HGVS IDs.*
- dbSNP rsID (e.g., `rs58991260`)
Inputs: variant_id (required), email, fields. Returns: Response model for variant information
biothings_get_variantsA
Fetch multiple variants by a comma-separated list of HGVS or rsIDs.
Retrieves annotation data for **multiple specific variants** in a single request using their identifiers.
**This is the preferred tool over `query_many_variants` for fetching multiple specific variants when you already know
their standard IDs (HGVS or rsID).**
**Input Format:** Accepts a comma-separated list of variant IDs (HGVS or dbSNP rsIDs).
**Examples:** `variant_ids=chr7:g.140453134T>C,chr1:g.69511A>G` or `variant_ids=rs58991260,rs2500`
Inputs: variant_ids (required), email, fields. Returns: result
biothings_query_chemsC
Search chemical compounds via Lucene query (e.g., name, formula), returning compound details and query metadata.
Search for chemical compounds using a query string with various filtering options.
**Supported Query Features:**
1. Simple Queries: "C6H12O6" - Find compounds with molecular formula, "glucose" - Find compounds with name
2. Fielded Queries: "pubchem.molecular_formula:C6H12O6", "pubchem.molecular_weight:[100 TO 200]"
3. Range Queries: "pubchem.xlogp:>2", "pubchem.topological_polar_surface_area:[50 TO 100]"
4. Boolean Queries: "pubchem.hydrogen_bond_donor_count:>2 AND pubchem.hydrogen_bond_acceptor_count:>4"
Returns compound details including PubChem data like formula, weight, and XLogP.
Inputs: q (required), size, skip, sort, +2 more. Returns: hits, took, total, max_score
biothings_query_genesA
Search genes via Lucene query, returning gene details and query metadata.
**IMPORTANT:** This endpoint requires structured queries using specific field names.
Simple natural language queries like "CDK2 gene" or "human kinase" will **NOT** work.
You **MUST** specify the field you are querying, e.g., `symbol:CDK2`, `name:"cyclin-dependent kinase 2"`, `taxid:9606`.
Use this tool when you need to *search* for genes based on criteria, not when you already know the specific gene ID.
If you know the exact Entrez or Ensembl ID, use the `get_gene` tool instead for faster retrieval.
**Supported Query Features (based on Lucene syntax):**
1. Simple Term Queries: `q=cdk2` (Searches across default fields)
2. Fielded Queries: `q=symbol:CDK2`, `q=name:"cyclin-dependent kinase 2"`
3. Range Queries: `q=taxid:[9606 TO 10090]`
4. Boolean Queries: `q=symbol:CDK2 AND taxid:9606`
5. Wildcard Queries: `q=symbol:CDK*`
Returns gene details including symbol, name, taxid, and entrezgene.
Inputs: q (required), size, skip, sort, +3 more. Returns: hits, took, total, max_score
biothings_query_many_chemsB
Batch query chemical compounds by multiple terms (e.g., names, InChIKeys).
Perform multiple chemical queries in a single request.
**Supported Usage:**
1. Multiple Query Types: ["C6H12O6", "C12H22O11"] (formulas), ["glucose", "sucrose"] (names)
2. Field Scoping: Search in specific fields using scopes parameter
3. Result Filtering: Return specific fields using fields parameter
Inputs: query_list (required), email, fields, scopes. Returns: result
biothings_query_many_genesA
Batch query genes by multiple terms, returning a list of gene details.
Perform multiple gene searches in a single request using a comma-separated list of query terms.
Unlike `query_genes`, the `query_list` parameter takes multiple **terms** (like gene IDs, symbols, names)
rather than full query strings. The `scopes` parameter defines which fields these terms should be searched against.
**Endpoint Usage:**
- Query multiple symbols: `query_list=CDK2,BRCA1` with `scopes=symbol`
- Query multiple Entrez IDs: `query_list=1017,672` with `scopes=entrezgene`
- Query mixed IDs/symbols: `query_list=CDK2,672` with `scopes=symbol,entrezgene`
Inputs: query_list (required), size, email, fields, +2 more. Returns: result
biothings_query_many_taxonsA
Batch query taxa by multiple terms (e.g., scientific names, common names).
Perform multiple taxon queries in a single request.
**Supported Usage:**
1. Multiple Query Types: ["Homo sapiens", "Mus musculus"] (scientific names), ["human", "mouse"] (common names)
2. Field Scoping: Search in specific fields using scopes parameter: ["scientific_name", "common_name"]
3. Result Filtering: Return specific fields using fields parameter: ["scientific_name", "common_name", "rank"]
Inputs: query_list (required), email, fields, scopes. Returns: result
biothings_query_many_variantsA
Batch query variants by multiple identifiers (e.g., rsIDs, HGVS IDs).
Perform multiple variant queries in a single request using a comma-separated list of variant identifiers.
This tool takes multiple **terms** (like rsIDs, HGVS IDs) in `query_list` and searches for them within the specified `scopes`.
**Endpoint Usage:**
- Query multiple rsIDs: `query_list=rs58991260,rs2500` with `scopes=dbsnp.rsid`
- Query multiple HGVS IDs: `query_list=chr7:g.140453134T>C,chr1:g.69511A>G`
- Query mixed IDs: `query_list=rs58991260,chr1:g.69511A>G` with `scopes=dbsnp.rsid,_id`
Inputs: query_list (required), email, fields, scopes. Returns: result
biothings_query_taxonsB
Search taxa via Lucene query (e.g., scientific name, rank), returning taxon details and query metadata.
Search for taxa using a query string with various filtering options.
**Supported Query Features:**
1. Simple Queries: "scientific_name:Homo sapiens", "common_name:human"
2. Fielded Queries: "rank:species", "parent_taxid:9606", "has_gene:true"
3. Range Queries: "taxid:[9606 TO 10090]", "lineage:>9606"
4. Boolean Queries: "rank:species AND has_gene:true", "scientific_name:Homo* AND NOT rank:genus"
5. Wildcard Queries: "scientific_name:Homo*", "common_name:*mouse*"
Inputs: q (required), size, skip, sort, +2 more. Returns: hits, took, total, max_score
biothings_query_variantsA
Search variants via Lucene query (e.g., rsID, gene name), returning variant details and query metadata.
Search for variants using a query string with various filtering options, leveraging the MyVariant.info API.
**Use this tool for *searching* variants based on criteria.**
If you already know the exact variant ID (HGVS, rsID), use the `get_variant` tool for faster direct retrieval.
**Supported Query Features (Lucene syntax):**
1. Simple Queries: `q=rs58991260` (Find by rsID)
2. Fielded Queries: `q=dbsnp.vartype:snp`, `q=dbnsfp.polyphen2.hdiv.pred:(D P)`
3. Range Queries: `q=dbnsfp.polyphen2.hdiv.score:>0.99`
4. Wildcard Queries: `q=dbnsfp.genename:CDK*`
5. Boolean Queries: `q=_exists_:dbsnp AND dbsnp.vartype:snp`
6. Genomic Interval Queries: `q=chr1:69000-70000`
Inputs: q (required), size, skip, sort, +2 more. Returns: hits, took, total, max_score
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 19 tools
Tools are generally distinct through singular/plural and get/query patterns, and descriptions are detailed. However, the large number of similar patterns (e.g., get_chem vs get_chems) may cause slight confusion for agents without careful reading.
All tools follow a consistent 'biothings_' prefix with a verb_noun pattern, and the same structure is applied across domains (get, gets, query, query_many). Singular/plural naming is uniform.
19 tools is well-scoped for a biological data retrieval server covering genes, chemicals, taxa, variants, and Entrez download. Each tool serves a clear purpose without redundancy.
The tool surface covers single fetch, multiple fetch, search, and batch search for each data type. However, metadata endpoints are only provided for genes, not for chemicals, taxa, or variants, which is a minor gap.
Maintenance
Related MCP Connectors
Model Context Protocol server for Studex tools, notifications, and profile integrations
A Model Context Protocol server for Wix AI tools
MCP server for querying BrainKB, a knowledge base for neuroscience knowledge graphs.
MyGene.info MCP. Docs: https://docs.mygene.info/en/latest/
Related MCP Servers
- AlicenseAqualityDmaintenanceA Model Context Protocol server that interfaces with Biomart databases, allowing models to discover biological datasets, explore attributes/filters, retrieve biological data, and translate between different biological identifiers.88MIT
- AlicenseCqualityFmaintenanceA Model Context Protocol server that exposes Synapse Entities (Datasets, Projects, Folders, Files, Tables) with their annotations, enabling programmatic access to Synapse data resources through a RESTful API.711MIT
- AlicenseBqualityDmaintenanceUnofficial Model Context Protocol server for accessing Open Targets platform data for gene-drug-disease associations research.611MIT
- AlicenseAqualityDmaintenanceModel Context Protocol server for accessing Reactome pathway and systems biology data.812MIT