mgi-link
# mgi-link
[](https://www.python.org/)
[](https://github.com/berntpopp/mgi-link/actions/workflows/ci.yml)
[](https://github.com/berntpopp/mgi-link/actions/workflows/conformance.yml)
[](LICENSE)
An **MCP (Model Context Protocol)** server that grounds mouse-genetics work in
**Mouse Genome Informatics** ([informatics.jax.org](https://www.informatics.jax.org/)).
It reproduces the data on an MGI gene/marker page — especially **Mutations,
Alleles, and Phenotypes** — as structured tools an agent can call.
> [!IMPORTANT]
> Research use only. Not clinical decision support. Do not use for diagnosis,
> treatment, triage, or patient management.
## Why
The MGI gene page (e.g. [Wt1, MGI:98968](https://www.informatics.jax.org/marker/MGI:98968))
is a rich JS app with **no clean JSON API**. The data behind it exists only as
bulk TSV reports and an OBO ontology file — no endpoint answers "what phenotypes
does knocking out this gene cause?".
`mgi-link` rebuilds that surface from MGI's canonical bulk reports into a fast,
offline, deterministic SQLite index and exposes it as MCP tools with structured
outputs, `response_mode` verbosity control, and `_meta.next_commands` chaining.
It also closes the mouse↔human gap: pass a **human** symbol or HGNC or NCBI Gene id to any
marker tool and it resolves through the ortholog.
## Quick start
Hosted — no install:
```bash
claude mcp add --transport http mgi-link https://mgi-link.genefoundry.org/mcp
```
Locally (Python 3.14+, [uv](https://github.com/astral-sh/uv)). **`make data` is
required**: the server has no data until the MGI reports are downloaded and the
index is built.
```bash
make install # uv sync --group dev
make data # REQUIRED: download the MGI bulk reports, build the SQLite index
make dev # unified server: FastAPI /health + MCP /mcp on 127.0.0.1:8000
make mcp-serve # or: the stdio MCP server
```
```bash
claude mcp add mgi-link -- uv run mgi-link-mcp # stdio
```
Deploying behind a reverse proxy? `MGI_LINK_ALLOWED_HOSTS` must list the public
hostname — see [configuration.md](docs/configuration.md).
## Tools
| Tool | Purpose |
|------|---------|
| `resolve_marker` | Resolve a mouse symbol / MGI id / **human ortholog** → canonical marker |
| `get_marker` | Full marker record: location, xrefs, ortholog, summary counts |
| `search_markers` | Full-text search over marker symbol / name / synonyms |
| `get_marker_alleles` | Mutations & Alleles + generation-method category counts |
| `get_marker_phenotypes` | MP annotations (allelic composition, background, PubMed) + summary |
| `get_phenotype_overview` | The 27-system MGI **Phenotype Overview** grid |
| `get_marker_diseases` | Human–mouse disease models (DO/OMIM) |
| `get_marker_ortholog` | Mouse ↔ human ortholog (HGNC/Entrez/Ensembl/OMIM) |
| `get_mp_term` | Mammalian Phenotype ontology term (parents/children/systems) |
| `search_phenotype_terms` | Full-text search over MP terms |
| `find_markers_by_phenotype` | Reverse lookup: MP term → mouse genes (descendants included) |
| `get_server_capabilities` | Discovery: the tool surface, vocabularies, limits, citation |
| `get_diagnostics` | Health and provenance: the loaded MGI release |
Leaf names are intentionally **unprefixed** per the GeneFoundry
[Tool-Naming Standard v1](https://github.com/berntpopp/genefoundry-router). The
canonical gateway namespace token is `mgi`: behind
[`genefoundry-router`](https://github.com/berntpopp/genefoundry-router) these
surface as `mgi_<tool>` (e.g. `mgi_get_marker`), with `get_marker_phenotypes`
pinned as the entry point. Worked call sequences: [usage.md](docs/usage.md).
## Data & provenance
The index is built from the MGI bulk reports at
[informatics.jax.org/downloads/reports](https://www.informatics.jax.org/downloads/reports/):
`MRK_List2`, `MGI_PhenotypicAllele`, `MGI_GenePheno`, `VOC_MammalianPhenotype`,
`MPheno_OBO.ontology`, `HOM_MouseHumanSequence`, `MGI_DO` and `MRK_ENSEMBL`. A
live MouseMine (InterMine) enrichment client exists but is off by default and
reserved for v2.
Every successful result names its origin in `_meta`: `source` (`mgi`), `data_version`
(the MGI release of the index) and `retrieved_at` (when the index was built).
MGI publishes roughly weekly. A weekly workflow builds the reports reproducibly into
a content-addressed `data-mgi-<sha16>` GitHub release (owner-reviewed); containers
restore the release pinned in the image, never contact MGI, and report the served
release in `/health`. A source checkout refreshes with `mgi-link-data refresh`
(conditional, cron). Full model: [data.md](docs/data.md).
**Data licence.** MGI data and annotations are licensed **CC BY 4.0**
([terms](https://www.informatics.jax.org/mgihome/other/copyright.shtml)); the
**Mammalian Phenotype Ontology is also CC BY 4.0**. Attribute as MGI asks:
"Mouse Genome Database (MGD) at the Mouse Genome Informatics website, The Jackson
Laboratory, Bar Harbor, Maine. World Wide Web (URL: https://www.informatics.jax.org)."
plus the month and year of retrieval. Images on the MGI website are excluded (their
authors' or publishers' copyright) and are not served.
**Cite** (served verbatim at `mgi://citation`): Baldarelli RM, Smith CL, Bello SM,
et al. Mouse Genome Informatics: an integrated knowledgebase system for the
laboratory mouse. *Genetics*. 2024;227(1):iyae031. doi:10.1093/genetics/iyae031.
RRID:SCR_006460.
## Documentation
- [Usage](docs/usage.md) — canonical workflows, the tool reference, and what is out of scope in v1.
- [Configuration](docs/configuration.md) — every `MGI_LINK_*` variable, the entry points, and the Host/Origin allowlists.
- [Data](docs/data.md) — the source reports, the refresh model, licensing and citation.
- [Deployment](docs/deployment.md) — cron, systemd, Docker, and running behind a proxy.
- [Architecture](docs/architecture.md) — the data plane, the SQLite schema, and the MCP plane.
- [AGENTS.md](AGENTS.md) — engineering conventions and architecture invariants.
## Contributing
See [AGENTS.md](AGENTS.md) for engineering conventions and the invariants not to
break. `make ci-local` is the definition-of-done gate: format, lint, line budget,
README standard, mypy strict, and tests. It must be green before a change lands.
## License
Code: [MIT](LICENSE) © mgi-link contributors. Data: MGI data and the Mammalian
Phenotype Ontology are CC BY 4.0 (attribute MGI / The Jackson Laboratory; images
excluded) — see [Data & provenance](#data--provenance).
TDQS
Scored across 13 tools
The set is largely clean: marker-centric tools (get_marker, get_marker_alleles, get_marker_phenotypes, get_marker_ortholog, get_marker_diseases) each target a distinct facet, and the description text explicitly contrasts search_markers, resolve_marker, and get_marker. The only residual overlap is resolve_marker vs get_marker, which both accept the same reference forms and differ mainly in payload size/verbosity, so an agent must read descriptions to pick correctly.
Every tool follows a snake_case verb_noun convention (get_marker_alleles, search_phenotype_terms, find_markers_by_phenotype, resolve_marker), with a small, predictable verb vocabulary of get/search/find/resolve. Noun ordering varies slightly (get_phenotype_overview vs get_marker_phenotypes) but the pattern remains readable and predictable.
13 tools sit comfortably in the well-scoped 3-15 band for a domain-specific data server. Each tool covers a meaningful slice (diagnostics, discovery, marker facets, MP term work) rather than being redundant duplication.
The surface covers the core MGI workflow end to end: discovery, resolution, marker records, alleles, phenotypes (per-marker and per-system), orthologs, disease models, and phenotype-to-gene reverse lookup. Gaps are minor but real: there is no disease-term lookup or markers-by-disease reverse path, and no allele-level detail tool, which leaves some returned identifiers as dead ends.