BaranziniLab

SPOKEAgent

Community BaranziniLab
Updated

MCP server for SPOKE biomedical knowledge graph

SPOKEAgent

Current version: 0.5.1. Small queries stay on MCP; long queries and fullexports run as monitored local jobs without tying up an MCP request.

Install in BioRouter

  1. Download spokeagent.brxtfrom Releases.The same current bundle is committed under extensions/.
  2. In BioRouter, open Extensions → Add extension, select the BRXT and install.BioRouter creates the Python environment; uv and Python 3.11+ are required.
  3. Enter credentials in BioRouter's own configuration dialog, never in chat.
  4. Enable the extension in your chat. Verify a small query before a larger export.

Terminal installation uses the same installer:

biorouter extension install ./extensions/spokeagent.brxt
biorouter extension configure spokeagent

Configure SPOKEAGENT_PASSCODE. Alternatively provide KNOWLEDGE_GRAPH_URI, KNOWLEDGE_GRAPH_USERNAME, KNOWLEDGE_GRAPH_PASSWORD, and optionally KNOWLEDGE_GRAPH_DATABASE (default neo4j). Direct settings take precedence; use one route consistently. Because either route is valid, manifest fields are optional individually; startup validates that one complete route exists.

The Desktop installer discovers bundled skills/*/SKILL.md. If using a BioRouterCLI version that does not copy bundled skills, the MCP server still provides thejob-routing instructions; the skill folders can also be installed separately.

Long queries, CLI and progress

Use spoke-submit_query_job for an export or a query that could exceed theinteractive timeout. It returns a job ID immediately. Pollspoke-query_job_status at its recommended interval; usespoke-cancel_query_job to stop. Only completed means the file is complete.Status includes rows, bytes, elapsed time, phase and an advisory ETA when known.Set mode="explain" to obtain a plan without running the query.

From a source checkout, or BioRouter's installed extension directory:

uv sync --locked
# Standalone CLI only: configure its OS-keyring profile interactively once.
# BioRouter MCP jobs already receive credentials and do not need this command.
uv run spokeagent auth
uv run spokeagent submit --query-file query.cypher --format jsonl --timeout-seconds 3600
uv run spokeagent watch JOB_ID

No-argument uv run spokeagent continues to start the MCP server. status, watch,list, cancel and purge need no database credentials. Results remain in thelocal private job directory and are not sent to chat. Database/server limits canstill fail a query; jobs report those failures instead of silently truncating.

See architecture, storage, security and release details.To rebuild the tracked bundle: uv run python scripts/build_brxt.py.

A structure-aware MCP (Model Context Protocol) server for querying the SPOKEbiomedical knowledge graph for rapid biomedical knowledge inference. Points to theofficial release of SPOKE.

SPOKEAgent doesn't just expose raw Cypher — it understands SPOKE's structure. Itintrospects the live schema (so it tolerates schema changes), resolves entity names /synonyms / identifiers to canonical nodes via the graph's indexes, profiles a node'sreal relationships, finds shortest paths between entities, and guards every queryagainst the pitfalls of a 43-million-node graph (case-sensitivity, expensive edges,unbounded scans). See docs/CHANGELOG.md anddocs/TEST_FINDINGS.md for the design rationale, validatedover 100 natural-language questions through BioRouter.

Features

  • Compact, cached schema — a curated node table + Source-[:REL]->Target edgedirectory with counts and cost flags, derived live from the database.
  • Entity resolution — name / synonym / brand / identifier → canonical SPOKEnode(s), case- and apostrophe-safe, across DOID / Entrez / Ensembl / DrugBank /UMLS / UBERON / GO, ranked by connectivity.
  • Node profiling — a node's real relationship types, directions, and counts.
  • Path finding — shortest connecting path(s) between two entities.
  • Guarded querying — read-only Cypher with auto safety-LIMIT, transactiontimeout, and trimmed output.

Alternative install (custom extension via uvx)

If you prefer not to use the .brxt bundle, you can register SPOKEAgent as a custom extension command:

  1. In BioRouter, go to Add custom extension

  2. Fill in the extension name and description

  3. For the command, use the following:

uvx --from git+https://github.com/BaranziniLab/SPOKEAgent spokeagent
  1. Add an environment variable:

    a. Variable name = SPOKEAGENT_PASSCODE

    b. Value = <your-passcode> (from the credentials page)

    c. Click + Add to add the variable.

  2. Click Add extension — you're ready to go

Available Tools

The recommended workflow is schema once → resolve_entity → query / describe /find_path, passing string literals through parameters.

1. get_spoke_schema(refresh=false)

Returns a compact, cached map of the current graph: node_labels (by count), anedge_directory of {source, rel, target, count, expensive}, and usage_notes(identifier namespaces, edge properties, vestige filtering, performance rules).Call once near the start of a task.

2. resolve_entity(query, label?, limit?)

Maps a free-text name, synonym, brand, or identifier to canonical node(s). Handlescase-sensitivity, apostrophes, and cross-vocabulary identifiers (DOID, Entrez,Ensembl, DrugBank, UMLS CUI, UBERON, GO). Returns ranked candidates{label, name, identifier, matched_on, score} (degree may also be present). Use it before querying.

3. describe_node(query, label?)

Returns a node's real relationship profile {dir, rel, neighbor_label, count} — topick the right edge. If truncated=true, the profile contains only the top 60 groups;do not conclude that an unlisted edge is absent.

4. find_path(source, target, source_label?, target_label?, max_hops?, max_paths?)

Resolves both endpoints and returns the shortest connecting path(s) as node +relationship-type sequences — the right tool for "how are X and Y connected".

5. query_spoke(cypher_query, parameters?)

Execute a read-only Cypher query. Behaviour built in: writes rejected; a safetyLIMIT auto-applied to unbounded non-aggregate queries; a transaction timeout;trimmed, size-capped output; coaching metadata on empty/limited results.

Example (resolve first, then query by the resolved value via parameters):

MATCH (d:Disease {name: $name})-[:ASSOCIATES_DaG]->(g:Gene)
RETURN g.name AS gene, g.identifier AS entrez
LIMIT 10

parameters = {"name": "Alzheimer's disease"}. Note ASSOCIATES_DaG carriesdiseases_scores/gwas_pvalue (not a score property), and drug→gene targets go(:Compound)-[:BINDS_CbP]->(:Protein)<-[:ENCODES_GeP]-(:Gene) — there is noTARGETS_CtG edge.

Security

A conservative query guard rejects writes and procedure calls in user-suppliedCypher. Use a database principal with read-only permissions: the guard supplementsserver authorization. Entity labels are validated before interpolation, andresolver steps share a total timeout budget rather than accumulating long waits.

Provenance and credits

Made by the Baranzini Lab (Wanjun Gu, UCSF).

Original work of the Baranzini Lab.

Sources

Source Version or commit Licence Credit and people Use and what
keyring version 25.7.0 MIT Kang Zhang and Jason R. Coombs installed as a dependency: Python dependency: the operating system keyring the standalone command line keeps its credential profile in
FastMCP version 4.0.10 Apache-2.0 Prefect installed as a dependency: Python dependency: the MCP server framework the extension runs on
MCP Python SDK version 2.2.0 MIT Anthropic, PBC installed as a dependency: Python dependency: the MCP types the tools return
Neo4j Python Driver version 6.3.1 Apache-2.0 AND Python-2.0 Neo4j Sweden AB installed as a dependency: Python dependency: the Neo4j driver the Cypher queries run through
Pydantic version 2.13.5 MIT Pydantic Services Inc. and individual contributors installed as a dependency: Python dependency: the schemas of the tools' arguments
filelock version 3.32.7 MIT Bernát Gábor and contributors installed as a dependency: Python dependency: the file locks of the query jobs
sqlglot version 28.10.1 MIT Toby Mao installed as a dependency: Python dependency of the query-job code shared with the lab's SQL agents, which checks SQL with it; SPOKE's own queries are Cypher

Data and services

Data or service Kind Provider Terms How it is used Citation
SPOKE knowledge graph (Neo4j, about 43 million nodes) dataset Baranzini Lab, UCSF Access is subject to the provider's authorization. Integrated sources retain their own terms. read at run time
Identifiers it resolves: DOID, Entrez, Ensembl, DrugBank, UMLS CUI, UBERON and GO dataset the source vocabularies and databases SPOKE integrates each identifier system keeps its own terms; DrugBank and UMLS are licence-restricted (custom DrugBank terms of use and licensing; terms: https://trust.drugbank.com/drugbank-trust-center/drugbank-terms-of-service (as BioMCP 0.9.3's source inventory records it, reviewed 2026-09-27); custom UMLS Metathesaurus license and terminology-specific appendices; terms: https://www.nlm.nih.gov/databases/umls.html (as BioMCP 0.9.3's source inventory records it, reviewed 2026-09-27)) read at run time

Contributors

  • Wanjun Gu, Baranzini Lab, UCSF: author
  • Gianmarco Bellucci, Baranzini Lab, UCSF: author
  • Ilan Ladabaum, Baranzini Lab, UCSF: editor

The copyright lines and licences of the components above are in NOTICE.

Curated and organized by Wanjun Gu, Baranzini Lab, UCSF.

License

Apache-2.0

Authors

Editors

About SPOKE

SPOKE (Scalable Precision medicine Oriented Knowledge Engine) is a large-scale biomedical knowledge graph that integrates data from multiple sources to support precision medicine research.

MCP Server · Populars

MCP Server · New

    clearframes

    MCP Observatory

    Free, MIT-licensed MCP security testing from ClearFrame. Scan, audit, compare, and review locally; continue in the ClearFrame CLI or Mac app.

    Community clearframes
    umutkeltek

    healthsave-observatory

    Self-hosted health-data observatory: sync Apple Health, early wearable plugins, and Garmin/Samsung imports into a canonical TimescaleDB record; view baseline-linked findings and query a private API. Docker-ready, local-first, default-deny egress.

    Community umutkeltek
    atilaahmettaner

    TradingMCP: Market Data & Technical Analysis for AI Assistants

    MCP server for market analysis in AI assistants: quotes, options, smart-money analysis, walk-forward backtests and news sentiment for stocks, crypto, FX and metals. 13 tools. Self-host free, or use the hosted version, TradingMCP.

    Community atilaahmettaner
    lifan-builds

    Faster Mac Use (fmu)

    Background-first, multi-cursor browser and native macOS computer-use engine for AI agents

    Community lifan-builds
    agent360dev

    Agent360 Browser MCP

    The browser tool that can stop and ask you. A 2FA code, a CAPTCHA, a choice only you can make: it asks on your screen, then carries on in the same signed-in Chrome. 41 tools, MCP clients that run local servers, MIT.

    Community agent360dev