遗传学数据MCP服务器

Genetics MCP Server是一个模型上下文协议(MCP)服务器和LLM聊天服务,为AI助手提供遗传学数据工具访问,适用于遗传学数据分析、文献搜索和药物靶点查询等场景。

  • by fulltiltgenomics
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 fulltiltgenomics/genetics-mcp-server

使用说明

Genetics MCP Server

A Model Context Protocol (MCP) server and LLM chat service for genetics data tools.

This repository provides:

  1. Standalone MCP Server - Connect any MCP client to genetics data tools
  2. LLM Chat API - Chat service with Anthropic integration

This is deployed as part of FinnGenie AI assistant (see https://github.com/fulltiltgenomics/genetics-results-suite).

Quick Start

Install requirements

uv pip install --system .

Environment Variables

All environment variables are optional but needed for each type of functionality.

Variable Description Default
GENETICS_API_URL Base URL for genetics-results-api server http://0.0.0.0:2000/api
BIGQUERY_API_URL Base URL for genetics-results-db server -
INTERNAL_API_SECRET Shared secret sent as a bearer token on every call to GENETICS_API_URL and BIGQUERY_API_URL. Optional only for a local run against services that require no internal auth — the remote-transport MCP server and the chat API with REQUIRE_AUTH=true refuse to start without it, rather than making anonymous calls -
ANTHROPIC_API_KEY Anthropic API key (for chat) -
OPENAI_API_KEY OpenAI API key. Still read and plumbed through, but no request can reach the OpenAI path: the chat API refuses provider="openai" (and any model not starting with claude-) with a 400 before the stream opens, since genetics-results-suite-c4s -
PERPLEXITY_API_KEY Perplexity API key (for literature search, the default backend) -
TAVILY_API_KEY Tavily API key (for web search) -
MCP_API_KEY Comma-separated bearer tokens; required to start the MCP server on a remote transport -
EXTERNAL_MCP_SERVERS Comma-separated external MCP servers to proxy (e.g. gnomAD, Open Targets, C3PO); an entry is `URL[ option]..., see .env.example`
RAG_MCP_SERVER URL of genetics-rag-service server -
UNIPROT_API_URL UniProt REST API base URL (protein annotations, chat only) https://rest.uniprot.org
EBI_PROTEINS_API_URL EBI Proteins API base URL (protein-to-genome mapping, chat only) https://www.ebi.ac.uk/proteins/api
UNIPROT_CACHE_TTL TTL in seconds for cached UniProt responses (0 disables) 86400
CHEMBL_API_URL ChEMBL REST API base URL (drug/target mechanisms, indications, bioactivity, chat only) https://www.ebi.ac.uk/chembl/api/data
CHEMBL_CACHE_TTL TTL in seconds for cached ChEMBL responses (0 disables) 86400
TURN_DRAIN_TIMEOUT_S How long the chat API waits at shutdown for turns whose clients disconnected before cancelling them 270

MCP Server

cd src
export GENETICS_API_URL=https://.../api
# stdio transport
python -m genetics_mcp_server.mcp_server
# streamable http (or --transport sse); MCP_API_KEY is mandatory for remote
# transports — the server refuses to start unauthenticated
export MCP_API_KEY=...
python -m genetics_mcp_server.mcp_server --transport streamable-http --port 8080 --host 0.0.0.0

Chat API Server

cd src
export ANTHROPIC_API_KEY=sk-ant-...
export GENETICS_API_URL=https://.../api
uvicorn genetics_mcp_server.chat_api:app --port 8000

Development

git clone https://github.com/fulltiltgenomics/genetics-mcp-server.git
cd genetics-mcp-server
uv sync --extra dev

# tests
uv run pytest

# lint and format-check (the whole repo, as the pre-commit gate's --all mode does)
uv run ruff check && uv run ruff format --check

scripts/install-git-hooks.sh, run once per clone, wires core.hooksPath so the pre-commit hook runs: scripts/check-doc-drift.sh warns, and scripts/lint-staged.sh lints and format-checks the staged Python files and blocks the commit on a finding or an unformatted file (ruff format <file> fixes the latter; the gate never rewrites files itself). The setting is shared across worktrees, so one run covers every worktree too. In a worktree with no .venv, the gate falls back to the main checkout's ruff, then PATH, then uvx — and fails the commit if it finds none, rather than passing it unchecked.

In a git worktree, run uv sync --extra dev in the worktree before testing: otherwise uv run pytest resolves to a global interpreter that has the main checkout installed editable, and the run silently tests the main checkout's source. tests/conftest.py refuses to start such a run — it checks that genetics_mcp_server imports from under the pytest rootdir and aborts with the fix if it does not.

License

MIT