TRAPI MCP
A FastMCP-based tool for writing prompts using Translator Reasoner API (TRAPI) queries. This package enables easy integration of biomedical knowledge graph queries into your LLM workflows.
Installation
You can install the package from source:
pip install -e .
Or using uv (recommended):
uv install trapi-mcp
Python API
from trapi_mcp.tools import trapi, trapi_status, trapi_results
# Submit a TRAPI query
response = trapi(
subject="MONDO:0005148", # Alzheimer's disease
object_="CHEBI:6801", # Acetylcholine
predicate="biolink:affects"
)
# Get the query ID
pk = response["pk"]
# Check status
status_response = trapi_status(pk)
print(f"Query status: {status_response.get('status')}")
# When status is "Done", get results
if status_response.get("status") == "Done":
results = trapi_results(pk)
# Process results
Developer Guide
Setup Development Environment
- Clone the repository:
git clone https://github.com/your-username/trapi-mcp.git
cd trapi-mcp
- Install development dependencies:
uv install
Architecture
The package consists of several key components:
api_utilities.py: Low-level functions for interacting with Translator API services - e.g., how to make API callstools.py: High-level functions for building and executing TRAPI queries. Currently, NameResolver, NodeNormalizer, and ARS query endpoints are all callable as MCP servers from this repository.main.py: FastMCP integration and CLI setup
Integration with Goose (Example)
Goose is a framework for building LLM applications. Here's how to integrate TRAPI MCP with Goose:
install goose:
https://block.github.io/goose/docs/getting-started/installation/
Set an LLM Provider
https://block.github.io/goose/docs/getting-started/installation/#set-llm-provider
Add TRAPI MCP as an extenstion
https://block.github.io/goose/docs/getting-started/using-extensions#adding-extensions
- Under "Advanced Settings"
- "Add custom extension"
- Name the extension "TRAPI MCP"
- For "Command", add "uvx trapi-mcp"
- "Save Changes"
- Turn "on" the extension for your session.
- Ask questions of goose like:
-
What is the relationship between Alzheimer's disease and acetylcholine?
-
How many disesaes is ABCA1 related to?
-
What treats diabetes mellitus?
Release files for trapi-mcp 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| trapi_mcp-0.1.3.tar.gz | 31.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| trapi_mcp-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 36.7 kB
Release files / trapi_mcp-0.1.3.tar.gz
| Download URL | trapi_mcp-0.1.3.tar.gz |
|---|---|
| Size | 31.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5dce2d6256bbc93fbcfc1080b3ddfc2836bb42713d29baad96e292eb97088fa8
|
|
BLAKE2b-256 checksum How to use checksums |
04cffb2436c8fee14215e8007f7a01cbd10052b5d9566de1730e0eadabd8f984
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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 Jun 16, 2025.
Transparency logRelease files / trapi_mcp-0.1.3-py3-none-any.whl
| Download URL | trapi_mcp-0.1.3-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
471fe4a94bbd645dee1a464d9591eee8306e6182a5a0eb4977f170e76ed89e12
|
|
BLAKE2b-256 checksum How to use checksums |
038e7d77984d3d0c3006b4dcc9d98391fee81a9afc242a2f02701f533e69555f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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 Jun 16, 2025.
Transparency log