Skip to main content

Add your description here

Project description

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

  1. Clone the repository:
git clone https://github.com/your-username/trapi-mcp.git
cd trapi-mcp
  1. 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 calls
  • tools.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?
      

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

trapi_mcp-0.1.3.tar.gz (31.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

trapi_mcp-0.1.3-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file trapi_mcp-0.1.3.tar.gz.

File metadata

  • Download URL: trapi_mcp-0.1.3.tar.gz
  • Upload date:
  • Size: 31.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for trapi_mcp-0.1.3.tar.gz
Algorithm Hash digest
SHA256 5dce2d6256bbc93fbcfc1080b3ddfc2836bb42713d29baad96e292eb97088fa8
MD5 ea5b7abefe4f353154c9682430620b8a
BLAKE2b-256 04cffb2436c8fee14215e8007f7a01cbd10052b5d9566de1730e0eadabd8f984

See more details on using hashes here.

Provenance

The following attestation bundles were made for trapi_mcp-0.1.3.tar.gz:

Publisher: pypi-publish.yaml on sierra-moxon/trapi-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file trapi_mcp-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: trapi_mcp-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for trapi_mcp-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 471fe4a94bbd645dee1a464d9591eee8306e6182a5a0eb4977f170e76ed89e12
MD5 1b31e84ac5a17e5cedf8454960bf0ed3
BLAKE2b-256 038e7d77984d3d0c3006b4dcc9d98391fee81a9afc242a2f02701f533e69555f

See more details on using hashes here.

Provenance

The following attestation bundles were made for trapi_mcp-0.1.3-py3-none-any.whl:

Publisher: pypi-publish.yaml on sierra-moxon/trapi-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page