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
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
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 mixins:
- Gene Interface:
GeneRoutesMixin
(wrapsGeneClientAsync
) - Variant Interface:
VariantsRoutesMixin
(wrapsVariantClientAsync
) - Chemical Interface:
ChemRoutesMixin
(wrapsChemClientAsync
) - Taxon Interface:
TaxonRoutesMixin
(wrapsTaxonClientAsync
)
Quick Start
Installing uv
# Download and install uv
curl -LsSf https://astral.sh/uv/install.sh | sh
# Verify installation
uv --version
Setup
# Clone the repository
git clone [email protected]:longevity-genie/biothings-mcp.git
cd biothings-mcp
uv sync
Running the MCP Server
# Start the MCP server locally
uv run server
Docker Deployment
The easiest way to run the MCP server is using Docker. The project provides a pre-built Docker image available on GitHub Container Registry.
- Using Docker Compose (recommended):
# Clone the repository
git clone [email protected]:longevity-genie/biothings-mcp.git
cd biothings-mcp
# Start the services
docker-compose up
This will start:
- The MCP server on port 3001
- The MCP Inspector on port 6277
- Using Docker directly:
# Pull the latest image
docker pull ghcr.io/longevity-genie/biothings-mcp:latest
# Run the container
docker run -p 3001:3001 -e MCP_PORT=3001 ghcr.io/longevity-genie/biothings-mcp:latest
The MCP server will be available at http://localhost:3001/mcp
(with docs at http://localhost:3001/docs).
A publicly hosted version of this server is also available at https://biothings.longevity-genie.info/mcp
(with docs at https://biothings.longevity-genie.info/docs)
Integration 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/mcp
and 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 alpha-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 entetity resolution.
Testing & Verification
Run tests for the API endpoint:
uv run pytest -vvv -s
Test your MCP setup with the MCP Inspector:
npx @modelcontextprotocol/inspector --config mcp-config.json --server biothings-mcp
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