just-prs-mcp

just-prs-mcp

MCP server for polygenic risk score analysis, wrapping just-prs to enable catalog search, PRS computation, VCF normalization, percentile and risk estimation, and quality assessment.

Category
访问服务器

README

just-prs-mcp

An MCP server that wraps just-prs — a Polars-based tool for Polygenic Risk Scores (PRS) from the PGS Catalog. It exposes catalog search, PRS computation, VCF/array normalization, percentile & absolute-risk estimation, quality assessment, and (in extended mode) bulk downloads and reference-panel / pgen scoring as MCP tools.

Built on uv + FastMCP.

Agents: start with AGENTS.md.

Highlights

  • Hybrid tool registration with modes — a small always-on essentials surface (catalog lookup + the core compute/analyze workflow) plus an extended surface (batch, bulk downloads, HuggingFace upload, reference/pgen scoring) registered on opt-in. Keeps the default tool list small.
  • Real background tasks — slow operations (normalize_vcf, compute_prs_batch, downloads, reference scoring) run as @mcp.tool(task=True) with FastMCP's in-memory backend (no Redis); FASTMCP_DOCKET_URL switches to Redis for scale.
  • Structured I/O via Pydantic models + tool annotations — just-prs's own PRSResult / AbsoluteRisk / TraitInfo are returned directly where they fit.
  • Boot-safe — the server starts with no environment configured; no API key is required for any core feature.
  • In-memory test harness (Client(transport=server)) — fast, deterministic, network-free.

Quickstart

uv sync                                  # install deps (incl. dev)
uv sync --extra reference                # + pgenlib for reference/pgen tools (Linux/WSL)
uv run pytest                            # tests, all in-memory (no network)
uv run just-prs-mcp stdio                # run over stdio
uv run just-prs-mcp stdio --mode extended  # expose the full tool surface
uv run just-prs-mcp http                 # run over HTTP (default :3011)
uv run fastmcp dev fastmcp.json          # MCP Inspector

The server boots with no environment configured.

Tools

Tool Tier Notes
search_scores essentials Search the PGS Catalog by free text
score_info essentials Cleaned metadata for one PGS ID
best_performance essentials Best evaluation metrics (OR/HR/AUROC/C-index)
search_traits essentials REST trait search
trait_info essentials Trait by EFO ID + associated PGS IDs
normalize_vcf essentials VCF → genotype Parquet (background task)
compute_prs essentials Score one VCF against one PGS
percentile essentials Percentile of a PRS value (reference/theoretical/AUROC)
absolute_risk essentials Absolute disease risk from a PRS z-score
assess_quality essentials Quality label + interpretation (pure logic)
compute_prs_batch extended Score one VCF against many PGS (background task)
normalize_array extended 23andMe / AncestryDNA → Parquet (background task)
download_scoring_file extended One harmonized scoring file from EBI FTP
list_pgs_ids extended All PGS IDs on EBI FTP
download_all_metadata extended All metadata sheets as Parquet (background task)
bulk_download_scores extended Many/all scoring files (background task)
push_catalog_to_hf extended Upload cleaned catalog to HuggingFace (needs token)
download_reference_panel extended Fetch 1000G / HGDP+1kGP panel (background task)
reference_score / reference_score_batch extended Score against a panel (needs pgenlib)
pgen_read_pvar / pgen_read_psam / pgen_score extended PLINK2 binary ops (needs pgenlib)

Plus a resource (resource://prs/panels) and a prompt (compute_prs_for_trait).

File paths: computation tools take local paths (VCF / normalized Parquet / .pgen dir) on the server's filesystem. Over stdio that's your machine. Reference / pgen tools need the optional native pgenlib (Linux/WSL — uv sync --extra reference); without it they return a clear install hint.

Modes

PRS_MCP_MODE (env) or --mode (CLI), default essentials:

  • essentials — catalog lookup + the core compute/analyze workflow.
  • extended — everything (batch, bulk downloads, HF upload, reference/pgen).

Configuration

All PRS_MCP_* env vars are optional (see .env.example and settings.py): PRS_MCP_MODE, PRS_MCP_CACHE_DIR, PRS_MCP_DEFAULT_GENOME_BUILD, PRS_MCP_DEFAULT_PANEL, PRS_MCP_DUCKDB_MEMORY_LIMIT, PRS_MCP_HF_TOKEN, PRS_MCP_TRANSPORT, PRS_MCP_HOST, PRS_MCP_PORT, PRS_MCP_LOG_LEVEL.

PRS_MCP_CACHE_DIR sets the root for cached catalog metadata, scoring files, and reference panels; if unset, just-prs uses its own default (PRS_CACHE_DIR / platformdirs). The HuggingFace upload tool reads PRS_MCP_HF_TOKEN or the native HF_TOKEN.

Using with coding agents

.mcp.json (Claude Code) launches uv run just-prs-mcp stdio. For Codex (~/.codex/config.toml):

[mcp_servers.just-prs]
command = "uv"
args = ["run", "just-prs-mcp", "stdio"]

Deployment

  • Docker: docker build -t just-prs-mcp . && docker run -p 3011:3011 just-prs-mcp (defaults to HTTP).
  • Smithery: uv sync --extra smithery; entrypoint in pyproject.toml [tool.smithery] + smithery.yaml.
  • Declarative: fastmcp.json drives fastmcp run / fastmcp dev.

Project layout

src/just_prs_mcp/
  server.py        build_server(), CLI, graceful shutdown, Smithery entrypoint
  settings.py      pydantic-settings (PRS_MCP_*), safe defaults
  client.py        shared PRSCatalog / REST-client construction + adapters
  models.py        Pydantic tool I/O models (+ reused just-prs models)
  logging_setup.py stdlib logging -> stderr
  tools/
    catalog.py       essentials — PGS Catalog lookup
    compute.py       essentials — normalize / compute / analyze
    extended.py      extended — batch, downloads, HF upload
    reference.py     extended — reference-panel / pgen scoring (pgenlib)
tests/             in-memory client tests (wiring, not just-prs correctness)

License

MIT — see LICENSE.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选