Open Targets MCP Server
A Model Context Protocol (MCP) server that exposes the Open Targets Platform GraphQL API as a set of tools for use with Claude Desktop and other MCP-compatible clients.
Quick Install
Requires uv. uvx runs the published PyPI package without a separate install:
uvx opentargets-mcp
Claude Code
claude mcp add opentargets -- uvx opentargets-mcp
Claude Desktop and Cursor
Add this to claude_desktop_config.json (Claude Desktop: Settings → Developer → Edit Config) or ~/.cursor/mcp.json (Cursor), then restart the client:
{
"mcpServers": {
"opentargets": {
"command": "uvx",
"args": ["opentargets-mcp"]
}
}
}
If the client reports spawn uvx ENOENT, set command to the absolute path printed by which uvx. uvx reuses its cached install; use "args": ["opentargets-mcp@latest"] to pick up new releases.
Other clients
- VS Code:
code --add-mcp '{"name":"opentargets","command":"uvx","args":["opentargets-mcp"]}' - Codex:
codex mcp add opentargets -- uvx opentargets-mcp - Any stdio MCP client: use
uvxas the command andopentargets-mcpas its argument.
Self-host
From a clone (stdio transport by default):
git clone https://github.com/nickzren/opentargets-mcp
cd opentargets-mcp
uv run opentargets-mcp
With Docker (HTTP transport on port 8000):
git clone https://github.com/nickzren/opentargets-mcp
cd opentargets-mcp
docker compose up -d --build
See the configuration section below for ports and other environment variables.
Features
Core Capabilities
- Target Analysis: Search genes/proteins by Ensembl ID or symbol. Access expression data, genetic constraints, pathways, protein interactions, safety profiles, and mouse phenotypes
- Disease Analysis: Query diseases by ontology ID (mostly MONDO). Find associated targets, phenotypes (HPO), and research projects
- Drug Discovery: Search drugs by ChEMBL ID. Access safety data, adverse events, indications, and mechanism of action
- Evidence Mining: Explore target-disease associations with scored evidence from multiple sources
- Variant Analysis: Query genetic variants, GWAS credible sets, and pharmacogenomics data
- Study Exploration: Access GWAS studies with L2G predictions and fine-mapped loci
- Smart Search: Entity resolution with synonym handling, autocomplete, and ID mapping
- Cross-Entity Workflows: Multi-hop tools that chain disease, target, and drug evidence for prioritization
- Raw GraphQL Power Tools: Run single and batch raw GraphQL operations with structured status envelopes
Why This Server
This implementation is designed for practical Open Targets workflows:
- Curated breadth: 65 curated tools plus 3 advanced GraphQL tools (68 total), spanning target, disease, drug, evidence, variant, study, metadata, and cross-entity workflow tasks.
- Safer automation: strict ID resolution, typed parameter handling, and resilient retry behavior.
- Lower token overhead: optional
fieldsfilters on core domain tools to return only what you need. - Flexible power mode: raw GraphQL tools are available for edge cases.
Data Sources
The Open Targets Platform integrates evidence from 22+ primary data sources:
- Genetics: Open Targets Genetics, ClinVar, UK Biobank, FinnGen, Gene2Phenotype, Orphanet, COSMIC
- Functional: CRISPR screens, DepMap, GeneBass
- Drugs: ChEMBL, FDA/EMA approvals, chemical probes
- Expression: GTEx, Human Protein Atlas, Expression Atlas
- Pathways: Reactome, Signor, IntAct
- Literature: Europe PMC text mining
- Safety: FAERS, pharmacogenomics data
- Models: Mouse (MGI, IMPC) phenotypes
Architecture
graph LR
subgraph "Clients"
A[Claude Desktop]
B[Python Scripts]
C[AI Agents]
end
subgraph "MCP Server"
D[Open Targets<br/>MCP Server]
E[Tool Categories<br/>Target • Disease • Drug<br/>Evidence • Search • Variant • Study]
end
subgraph "Open Targets"
F[GraphQL API]
G[22+ Data Sources]
end
A <-->|MCP Protocol| D
B <-->|Direct API| D
C <-->|Function Calls| D
D <-->|GraphQL| F
F <--> G
E --> D
style D fill:#e1f5fe
style F fill:#fff3e0
The MCP server acts as a bridge between client applications and the Open Targets Platform. It translates tool calls into GraphQL queries and provides structured access to biomedical data from 22+ integrated sources.
Prerequisites
- uv for
uvx, or Python 3.10+ to install from source
Usage
Running the Server Standalone
# From a clone, with uv (stdio transport by default)
uv run python -m opentargets_mcp.server
# Installed entrypoints
opentargets-mcp --help
# Specify transport explicitly
uv run python -m opentargets_mcp.server --transport [stdio|sse|http]
Configuration
- Environment variables: Transport/bind use
MCP_TRANSPORT,FASTMCP_SERVER_HOST, andFASTMCP_SERVER_PORT(defaults:stdio,0.0.0.0,8000). API endpoint usesOPEN_TARGETS_API_URL(default:https://api.platform.opentargets.org/api/v4/graphql). For local-only development, preferFASTMCP_SERVER_HOST=127.0.0.1. - Validated settings: environment configuration is parsed with a typed settings model at startup (
src/opentargets_mcp/settings.py), so invalid values fail fast. - Name resolution: strict; unresolved names raise a clear error, and ambiguous names raise an error listing candidates (use
search_entitiesto find canonical IDs). - Proxies: the
HTTPS_PROXY,HTTP_PROXYandNO_PROXYenvironment variables are honored (NO_PROXYacceptshostorhost:port);.netrcis never read. A plain-http://API URL reached through an authenticated proxy does not follow redirects. - Tool selection guidance: the server sends a short policy to clients to prefer curated tools, use
fieldsto trim output, and reserve raw GraphQL for edge cases. - Pagination guardrails: tool wrappers enforce
page_index >= 0,page_size >= 1, and a globalpage_size <= 500. - Command line:
opentargets-mcp --transport [stdio|sse|http] --host 0.0.0.0 --port 8000 --api <url>provides flexible transport and endpoint selection. - Verbose logging: add
--verboseto elevate the global log level to DEBUG when troubleshooting. - CLI helpers:
--list-toolsprints all registered tools, and--versionprints the package version. - Rate limiting:
OPEN_TARGETS_RATE_LIMIT_RPSandOPEN_TARGETS_RATE_LIMIT_BURSTcan enable a global limit on incoming MCP requests. It does not throttle upstream Open Targets requests: one tool call can issue many upstream requests (at most 20 concurrent).--rate-limitingandOPEN_TARGETS_RATE_LIMIT_ENABLED=trueare also supported.
Transport Modes
The server supports multiple transport protocols powered by FastMCP:
stdio transport (default)
# For Claude Desktop and local CLI tools
opentargets-mcp --transport stdio
SSE transport
# For web-based MCP clients with Server-Sent Events
opentargets-mcp --transport sse --host 0.0.0.0 --port 8000
HTTP transport
# For streamable HTTP MCP clients
opentargets-mcp --transport http --host 0.0.0.0 --port 8000
Example Scripts
uv run python examples/target_validation_profile.py EGFR
uv run python examples/disease_to_drug.py "schizophrenia"
uv run python examples/drug_safety_profile.py "osimertinib"
uv run python examples/genetic_target_prioritization.py "inflammatory bowel disease"
Available Tools
The server wraps 68 operations from the Open Targets Platform: 65 curated tools plus 3 advanced GraphQL tools. Every tool returns structured JSON that mirrors the Open Targets GraphQL schema, and you can inspect the full machine-readable list with the MCP list_tools request.
Most domain tools accept either a canonical identifier (e.g., ENSG..., MONDO_..., CHEMBL...) or a human-readable name/symbol. Disease identifiers are largely MONDO since the 26.06 alignment to EFO 3.88; EFO_... IDs that were replaced no longer resolve. Colon notation (MONDO:0004979) is accepted and normalised. When a name is provided, the server resolves it to the matching Open Targets ID; an ambiguous name raises an error listing candidates. Variant tools also accept rsIDs (e.g. rs4129267) and chr-prefixed or colon-separated variant IDs.
Many core tools accept an optional fields list (dot-paths) to filter the response payload.
search_entities also returns search.triples for compact {id, entity, name} consumption.
For edge cases, prefer curated tools + fields first; use raw GraphQL only when no curated tool fits.
Quick-start shortcuts
get_target_info– Core target identity record (Ensembl IDs, synonyms, genomic coordinates)get_disease_info– Disease/EFO summary with therapeutic area contextget_drug_info– ChEMBL-backed drug profile and mechanism datasearch_entities– Unified entity search with synonym handlingget_target_associated_diseases– High-confidence target-disease links with scoresget_disease_associated_targets– Prioritised target list for an EFO diseaseget_target_known_drugs– Approved and investigational agents for a targetget_target_disease_evidence– Evidence details across genetics, expression, and literatureget_drug_repurposing_candidates– Multi-hop disease -> target -> drug candidate prioritizationgraphql_batch_query– Run one GraphQL query across many variable sets
Full catalog by category
- Target identity & biology (20 tools) —
get_target_info,get_target_class,get_target_alternative_genes,get_target_associated_diseases,get_target_known_drugs,get_target_literature_occurrences,get_target_expression,get_target_pathways_and_go_terms,get_target_homologues,get_target_subcellular_locations,get_target_genetic_constraint,get_target_mouse_phenotypes,get_target_hallmarks,get_target_depmap_essentiality,get_target_interactions,get_target_safety_information,get_target_tractability,get_target_chemical_probes,get_target_tep,get_target_prioritization. - Disease analytics (8 tools) —
get_disease_info,get_disease_associated_targets,get_disease_phenotypes,get_disease_otar_projects,get_disease_known_drugs,get_disease_ontology,get_disease_literature_occurrences,get_disease_similar_entities. - Drug profiling (10 tools) —
get_drug_info,get_drug_cross_references,get_drug_linked_diseases,get_drug_linked_targets,get_drug_adverse_events,get_drug_pharmacovigilance,get_drug_warnings,get_drug_pharmacogenomics,get_drug_literature_occurrences,get_drug_similar_entities. - Evidence synthesis (2 tools) —
get_target_disease_evidence,get_target_disease_biomarkers. - Search & discovery (4 tools) —
search_entities,search_suggestions,get_similar_targets,search_facets. - Metadata & ontology utilities (5 tools) —
get_api_metadata,get_association_datasources,get_gene_ontology_terms,get_interaction_resources,map_ids. - Workflow tools (1 tool) —
get_drug_repurposing_candidates. - Batch lookups (3 tools) —
get_targets_batch,get_diseases_batch,get_drugs_batch. - Variant interpretation (6 tools) —
get_variant_info,get_variant_credible_sets,get_variant_pharmacogenomics,get_variant_evidences,get_variant_intervals,get_variant_protein_coordinates. - Study exploration (6 tools) —
get_study_info,get_studies_by_disease,get_study_credible_sets,get_credible_set_by_id,get_credible_set_colocalisation,get_credible_sets. - Advanced GraphQL (3 tools) —
graphql_schema,graphql_query,graphql_batch_query.
Changes in 0.6.1
- Name resolution: when several search hits tie for the top score, a name resolves only to a unique exact match on ID, name or symbol; otherwise the tool raises an error listing candidates instead of picking the first hit.
- Variants and studies: rsIDs and
chr/colon variant notation resolve to canonical variant IDs; an rsID with several alleles raises an error listing them.variant_idslists resolve too;study_idsaccept study IDs. search_entitiesreturns the direct search results; the response shape is unchanged.- Known drugs: rows are ordered by clinical stage, then clinical report count, before paging. The order is a display heuristic.
- Literature tools return full upstream pages; the
sizeargument is deprecated and ignored. get_target_tepraises an error: TEP was removed from the Open Targets API.get_target_chemical_probesworks again on API 26.9.- Evidence:
get_target_disease_evidenceandget_target_disease_biomarkerstakeenable_indirect(defaultFalse, unchanged results for valid IDs). An unknown disease ID now returns{"target": null}; an unknown target ID returns an empty page. get_target_disease_biomarkersdrops rows without biomarker data (the filter previously kept them) and addsupstreamCount.- Similar entities:
get_disease_similar_entitiesandget_drug_similar_entitiesreturn IDs and names for every entity type, andget_similar_targetsacceptsentity_names. - Network: transport failures return a readable error, and each upstream request, including retries, is bounded by a ~60 s budget (one tool call may make several requests). Proxies are honored via environment variables.
- Removed:
run.sh, the OpenAI ReAct agent example,.env.exampleand theexamplesextra.
Response changes for Open Targets 26.06
Release 26.06 changed several upstream shapes. Tools were updated to match, so responses differ from earlier versions of this server:
get_target_expressionnow returnstarget.baselineExpression, a paginated{count, rows}connection, instead oftarget.expressions. Rows are per-datasource quantitative distributions (median,min,max,q1,q3,specificity_score,distribution_score) keyed ontissueBiosample/celltypeBiosample, and no longer carrytissue/rna/protein. The tool takespage_index(default0) andpage_size(default25); a single target can have well over a thousand rows.fieldskeeps its position as the first optional argument.- Drug
synonymsandtradeNamesare objects rather than plain strings. Each entry is{label, source}, affectingget_drug_info,get_drug_cross_referencesandget_drugs_batch. - Disease identifiers largely moved from EFO to MONDO with the alignment to
EFO 3.88. Replaced
EFO_...IDs no longer resolve;efo_idparameters keep their name but accept any supported disease ontology ID, in either colon or underscore notation. get_target_known_drugshonourspage_index, andknownDrugs.countis the upstream total rather than the page length. Rows no longer carrymechanismOfAction; useget_drug_infofor a drug's mechanisms.get_disease_known_drugsrejectscursorandfree_text_query: the API exposes no paging or filtering on that field.get_target_subcellular_locationsreturnstargetModifier, naming the protein form a location applies to.- When the API rejects a query, the tool error now carries the upstream
GraphQL message instead of a generic failure, and a
200response containing GraphQL errors raises rather than returning partial data. The rawgraphql_querytool still reports partial data with awarningstatus.
Each grouping matches the data domains described in the Open Targets docs (targets, diseases, drugs, evidence, variants, and studies). For high-volume workloads, respect the platform's throttling guidance from the Open Targets API FAQ and cache downstream where possible.
Development
# Install dev dependencies
uv sync --extra dev
# Run lint checks (same as CI/release)
uv run ruff check src tests
# Run offline tests
uv run pytest -m "not live"
# Run live API tests
uv run pytest -m live
# Inspect registered tools from CLI
uv run opentargets-mcp --list-tools
Metadata
Release files for opentargets-mcp 0.6.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| opentargets_mcp-0.6.1.tar.gz | 108.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| opentargets_mcp-0.6.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 188.4 kB
Release files / opentargets_mcp-0.6.1.tar.gz
| Download URL | opentargets_mcp-0.6.1.tar.gz |
|---|---|
| Size | 108.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
525d295e02ccd55cef01bc711976f670f953d4964719e4b1899ae5c88f5cb163
|
|
BLAKE2b-256 checksum How to use checksums |
204fdcb09c1286e93173a7dbc8325774f9080e6fb529e733b947d000e1ea5fef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 9, 2026.
Transparency logRelease files / opentargets_mcp-0.6.1-py3-none-any.whl
| Download URL | opentargets_mcp-0.6.1-py3-none-any.whl |
|---|---|
| Size | 80.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e54e9f244dc8a72560f86136ed29c9c7c35087a87e3cc881cfe347f53a781a0c
|
|
BLAKE2b-256 checksum How to use checksums |
f491f86ec3c47642d29fc766b90203f12e4ef83169c9bcfbc660f7c9e4f8f420
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 9, 2026.
Transparency log