{
  "markdown": "# Open Targets MCP Server\n\n[![CI](https://img.shields.io/github/actions/workflow/status/nickzren/opentargets-mcp/ci.yml?label=CI)](https://github.com/nickzren/opentargets-mcp/actions/workflows/ci.yml)\n[![PyPI](https://img.shields.io/pypi/v/opentargets-mcp)](https://pypi.org/project/opentargets-mcp/)\n[![Python](https://img.shields.io/badge/Python-3.10%2B-3776AB?logo=python&logoColor=white)](https://www.python.org/)\n[![MCP Registry](https://img.shields.io/badge/MCP-Registry-blue)](https://registry.modelcontextprotocol.io/v0/servers?search=nickzren/opentargets&version=latest)\n[![Open Targets](https://img.shields.io/badge/Open%20Targets-Platform-5C85DE)](https://platform.opentargets.org/)\n[![License: MIT](https://img.shields.io/github/license/nickzren/opentargets-mcp)](LICENSE)\n\nA 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.\n\n<!-- mcp-name: io.github.nickzren/opentargets -->\n\n## Quick Install\n\n### Option 1: Run once with `uvx` (no install)\n```bash\nuvx --from git+https://github.com/nickzren/opentargets-mcp opentargets-mcp\n```\n\n### Option 2: Claude Desktop (MCPM)\n```bash\n# Install mcpm package manager\npip install mcpm\n\n# Install the server\nmcpm install opentargets\n```\n\n### Option 3: Local install (dev or self-host)\n```bash\ngit clone https://github.com/nickzren/opentargets-mcp\ncd opentargets-mcp\npip install uv\nuv sync\n\n# Run (stdio transport by default)\nuv run python -m opentargets_mcp.server\n```\n\n### Option 4: Docker\n```bash\ngit clone https://github.com/nickzren/opentargets-mcp\ncd opentargets-mcp\n\n# Build and run with Docker Compose\ndocker-compose up -d --build\n```\nNote: the default transport is `http` for docker deployments.\n\nSee the configuration section below for details and how to set ports and other environment variables.\n\n### Claude Desktop Manual Import (optional)\n```bash\nmcpm import stdio opentargets \\\n  --command \"$(uv run which python)\" \\\n  --args \"-m opentargets_mcp.server --transport stdio\"\n```\n\nThen restart Claude Desktop to start using the Open Targets tools.\n\n## Features\n\n### Core Capabilities\n\n- **Target Analysis**: Search genes/proteins by Ensembl ID or symbol. Access expression data, genetic constraints, pathways, protein interactions, safety profiles, and mouse phenotypes\n- **Disease Analysis**: Query diseases by EFO ID. Find associated targets, phenotypes (HPO), and research projects\n- **Drug Discovery**: Search drugs by ChEMBL ID. Access safety data, adverse events, indications, and mechanism of action\n- **Evidence Mining**: Explore target-disease associations with scored evidence from multiple sources\n- **Variant Analysis**: Query genetic variants, GWAS credible sets, and pharmacogenomics data\n- **Study Exploration**: Access GWAS studies with L2G predictions and fine-mapped loci\n- **Smart Search**: Entity resolution with synonym handling, autocomplete, and ID mapping\n- **Cross-Entity Workflows**: Multi-hop tools that chain disease, target, and drug evidence for prioritization\n- **Raw GraphQL Power Tools**: Run single and batch raw GraphQL operations with structured status envelopes\n\n## Why This Server\n\nThis implementation is designed for practical Open Targets workflows:\n\n- **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.\n- **Safer automation**: strict ID resolution, typed parameter handling, and resilient retry behavior.\n- **Lower token overhead**: optional `fields` filters on core domain tools to return only what you need.\n- **Flexible power mode**: raw GraphQL tools are available for edge cases.\n\n### Data Sources\n\nThe Open Targets Platform integrates evidence from 22+ primary data sources:\n\n- **Genetics**: Open Targets Genetics, ClinVar, UK Biobank, FinnGen, Gene2Phenotype, Orphanet, COSMIC\n- **Functional**: CRISPR screens, DepMap, GeneBass\n- **Drugs**: ChEMBL, FDA/EMA approvals, chemical probes\n- **Expression**: GTEx, Human Protein Atlas, Expression Atlas\n- **Pathways**: Reactome, Signor, IntAct\n- **Literature**: Europe PMC text mining\n- **Safety**: FAERS, pharmacogenomics data\n- **Models**: Mouse (MGI, IMPC) phenotypes\n\n## Architecture\n\n```mermaid\ngraph LR\n    subgraph \"Clients\"\n        A[Claude Desktop]\n        B[Python Scripts]\n        C[AI Agents]\n    end\n    \n    subgraph \"MCP Server\"\n        D[Open Targets<br/>MCP Server]\n        E[Tool Categories<br/>Target • Disease • Drug<br/>Evidence • Search • Variant • Study]\n    end\n    \n    subgraph \"Open Targets\"\n        F[GraphQL API]\n        G[22+ Data Sources]\n    end\n    \n    A <-->|MCP Protocol| D\n    B <-->|Direct API| D\n    C <-->|Function Calls| D\n    D <-->|GraphQL| F\n    F <--> G\n    \n    E --> D\n    \n    style D fill:#e1f5fe\n    style F fill:#fff3e0\n```\n\nThe 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.\n\n## Prerequisites\n\n- Python 3.10+ with pip\n\n## Usage\n\n### Running the Server Standalone\n```bash\n# Using the convenience script (installs uv if missing, then syncs dependencies)\n./run.sh\n\n# Or run directly with uv (stdio transport by default)\nuv run python -m opentargets_mcp.server\n\n# Installed entrypoints\nopentargets-mcp --help\n\n# Specify transport explicitly\nuv run python -m opentargets_mcp.server --transport [stdio|sse|http]\n```\n\n### Configuration\n\n- **Environment variables**: Transport/bind use `MCP_TRANSPORT`, `FASTMCP_SERVER_HOST`, and `FASTMCP_SERVER_PORT` (defaults: `stdio`, `0.0.0.0`, `8000`). API endpoint uses `OPEN_TARGETS_API_URL` (default: `https://api.platform.opentargets.org/api/v4/graphql`). For local-only development, prefer `FASTMCP_SERVER_HOST=127.0.0.1`.\n- **Validated settings**: environment configuration is parsed with a typed settings model at startup (`src/opentargets_mcp/settings.py`), so invalid values fail fast.\n- **Name resolution**: strict; unresolved names raise a clear error (use `search_entities` to find canonical IDs).\n- **Tool selection guidance**: the server sends a short policy to clients to prefer curated tools, use `fields` to trim output, and reserve raw GraphQL for edge cases.\n- **Pagination guardrails**: tool wrappers enforce `page_index >= 0`, `page_size >= 1`, and a global `page_size <= 500`.\n- **Command line**: `opentargets-mcp --transport [stdio|sse|http] --host 0.0.0.0 --port 8000 --api <url>` provides flexible transport and endpoint selection.\n- **Verbose logging**: add `--verbose` to elevate the global log level to DEBUG when troubleshooting.\n- **CLI helpers**: `--list-tools` prints all registered tools, and `--version` prints the package version.\n- **Rate limiting**: `OPEN_TARGETS_RATE_LIMIT_RPS` and `OPEN_TARGETS_RATE_LIMIT_BURST` can enable global server-side rate limiting. `--rate-limiting` and `OPEN_TARGETS_RATE_LIMIT_ENABLED=true` are also supported.\n\n### Transport Modes\n\nThe server supports multiple transport protocols powered by FastMCP:\n\n#### **stdio transport** (default)\n```bash\n# For Claude Desktop (via mcpm) and local CLI tools\nopentargets-mcp --transport stdio\n```\n\n#### **SSE transport**\n```bash\n# For web-based MCP clients with Server-Sent Events\nopentargets-mcp --transport sse --host 0.0.0.0 --port 8000\n```\n\n#### **HTTP transport**\n```bash\n# For streamable HTTP MCP clients\nopentargets-mcp --transport http --host 0.0.0.0 --port 8000\n```\n\n### Using with MCP Clients\n\n- **Claude Desktop**: Use mcpm installation (stdio) or direct server connection (sse)\n- **Web MCP clients**: Use SSE or HTTP transports with public URL (tunnel required)\n- **Custom integrations**: Any transport mode depending on your client implementation\n\n### Example Scripts\n```bash\nuv run python examples/target_validation_profile.py EGFR\nuv run python examples/disease_to_drug.py \"schizophrenia\"\nuv run python examples/drug_safety_profile.py \"osimertinib\"\nuv run python examples/genetic_target_prioritization.py \"inflammatory bowel disease\"\n```\n\n### AI Agent Example\n\nThe ReAct Agent provides an interactive terminal interface for exploring Open Targets data:\n\n![Open Targets React Agent Demo](docs/screenshots/react-agent-demo.png)\n\n```bash\n# Copy the example .env file and add your OpenAI API key\ncp .env.example .env\n# Then edit .env and set your OPENAI_API_KEY\n\n# Run agent\nuv run python examples/react_agent.py\n```\n\nThe agent uses a ReAct (Reasoning and Acting) pattern to break down complex biomedical queries into steps, making it easy to explore drug targets, diseases, and their relationships.\n\n## Available Tools\n\nThe server wraps **68** operations from the [Open Targets Platform](https://platform-docs.opentargets.org/): **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.\n\nMost domain tools accept either a canonical identifier (e.g., `ENSG...`, `EFO_...`, `CHEMBL...`) or a human-readable name/symbol. When a name is provided, the server automatically resolves it to the best matching Open Targets ID.\nMany core tools accept an optional `fields` list (dot-paths) to filter the response payload.\n`search_entities` also returns `search.triples` for compact `{id, entity, name}` consumption.\nFor edge cases, prefer curated tools + `fields` first; use raw GraphQL only when no curated tool fits.\n\n### Quick-start shortcuts\n- `get_target_info` – Core target identity record (Ensembl IDs, synonyms, genomic coordinates)\n- `get_disease_info` – Disease/EFO summary with therapeutic area context\n- `get_drug_info` – ChEMBL-backed drug profile and mechanism data\n- `search_entities` – Unified entity search with synonym handling\n- `get_target_associated_diseases` – High-confidence target-disease links with scores\n- `get_disease_associated_targets` – Prioritised target list for an EFO disease\n- `get_target_known_drugs` – Approved and investigational agents for a target\n- `get_target_disease_evidence` – Evidence details across genetics, expression, and literature\n- `get_drug_repurposing_candidates` – Multi-hop disease -> target -> drug candidate prioritization\n- `graphql_batch_query` – Run one GraphQL query across many variable sets\n\n### Full catalog by category\n- **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`.\n- **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`.\n- **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`.\n- **Evidence synthesis (2 tools)** — `get_target_disease_evidence`, `get_target_disease_biomarkers`.\n- **Search & discovery (4 tools)** — `search_entities`, `search_suggestions`, `get_similar_targets`, `search_facets`.\n- **Metadata & ontology utilities (5 tools)** — `get_api_metadata`, `get_association_datasources`, `get_gene_ontology_terms`, `get_interaction_resources`, `map_ids`.\n- **Workflow tools (1 tool)** — `get_drug_repurposing_candidates`.\n- **Batch lookups (3 tools)** — `get_targets_batch`, `get_diseases_batch`, `get_drugs_batch`.\n- **Variant interpretation (6 tools)** — `get_variant_info`, `get_variant_credible_sets`, `get_variant_pharmacogenomics`, `get_variant_evidences`, `get_variant_intervals`, `get_variant_protein_coordinates`.\n- **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`.\n- **Advanced GraphQL (3 tools)** — `graphql_schema`, `graphql_query`, `graphql_batch_query`.\n\nEach 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.\n\n## Development\n\n```bash\n# Run lint checks (same as CI/release)\nuv run ruff check src tests\n\n# Run tests\nuv run pytest tests/ -v\n\n# Inspect registered tools from CLI\nuv run opentargets-mcp --list-tools\n```\n",
  "bytes": 13113,
  "sha": "96c0e9649a2aa56311bb107ac541ba48dcfbc830e8a54a72cd286141b08b29d8",
  "repo_slug": "nickzren/opentargets-mcp",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_nickzren_opentargets_89ba6c33/readme"
}