cxg-census-mcp

io.github.MaxMLang由 GitHub 帳號 MaxMLang 發布v0.1.2更新於 Oct 24, 2026

MCP server for the CZ CELLxGENE Census. Single-cell, ontology-aware. Community, unaffiliated.

已驗證STDIO僅桌面資料與分析AI 與機器學習

概覽

AI 產生的概覽

用來查詢 CZ CELLxGENE Discover 單細胞 Census 的 MCP 伺服器,具備本體感知篩選、成本上限與來源標註,讓助理以自然語言回答細胞圖譜問題。

可以做什麼
彙整 Census 版本與伺服器限制,並依篩選條件計算細胞數或列出資料集(census_summary、get_census_versions、count_cells、list_datasets、get_server_limits)。
適用情境
適合單細胞圖譜的研究與探索性問題,例如某組織的細胞類型組成,或健康與疾病樣本的比較,可在 MCP 用戶端以自然語言提問。
執行需求
以 Python 套件形式透過 uv 或 pip 安裝,作為本機程序經 stdio 執行;需要 census 附加元件才能使用真實資料,否則以固定範例的模擬模式執行。需要連線至 EBI OLS4 與 CELLxGENE Census 的網路。未宣告帳號、API 金鑰或標頭。
安裝前請注意
屬於 alpha 階段、與官方無關聯的研究工具,並非臨床或診斷工具,結果在發表前應自行核實。真實模式會下載較大的原生相依套件。可選的 CXG_CENSUS_MCP_ 環境變數用於版本固定、快取目錄、模擬模式與日誌等級。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 cxg-census-mcp,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

cxg-census-mcp

[PyPI] [PyPI downloads] [CI] [License: MIT] [Python] [Ruff] [Checked with mypy] [pre-commit] [MCP] [Status: alpha] [Last commit]

An MCP server that lets LLM agents query the CZ CELLxGENE Discover Census single-cell atlas without lying about it — ontology-aware filters, cost caps, full provenance + attribution on every response. Drop it into Cursor / Claude Desktop / Claude Code and ask questions like "Visualize the cell-type composition of the human lung" in plain English.

[demo]

Independent / unaffiliated. Not affiliated with, endorsed by, or sponsored by the Chan Zuckerberg Initiative (CZI), EMBL-EBI, the U.S. Census Bureau, or anyone else. "CELLxGENE" is a CZI mark; references here are descriptive (nominative) use only.

No warranty. MIT-licensed source, "as is". Research/exploration tool — not a clinical or diagnostic instrument. Always verify results before publication. See LICENSE for the full trademark and content attribution notice, and SECURITY.md for the threat model and known-issues policy.

Alpha (v0.1.2). CHANGELOG.md

Demos

Healthy vs COVID-19 lung, side-by-side. Two parallel queries, the disease_multi_value_v7 schema-drift rewrite kicks in for the COVID cohort, attribution from both contributing dataset sets surfaces in the same chat turn.

https://github.com/user-attachments/assets/c836f225-5075-4643-87aa-70d311bc5fd2

Cell-type composition of human lung in one query. Free-text "lung" resolved to UBERON:0002048, routed through tissue_general, every CURIE labeled, all in a single Tier-0 call.

https://github.com/user-attachments/assets/b0e10ca7-e46b-4e5f-ae63-11949d328c4d

(Videos render on GitHub. On PyPI they appear as bare URLs — head to the GitHub README to watch.)

More prompts in docs/example-questions.md.

Architecture at a glance

                 ┌──────────────────────────────────────────────┐   MCP client    │   tools/        thin MCP wrappers, no logic  │   (Claude,  ─►  │     │                                        │    Cursor,      │     ▼                                        │    Code, …)     │   planner/      FilterSpec → QueryPlan,      │                 │     │           cost estimate, tier routing  │                 │     ▼                                        │                 │   ontology/     OLS4 + hint overlay,         │                 │     │           CL/UBERON/MONDO expansion    │                 │     ▼                                        │                 │   execution/    Tier 0  facet counts         │                 │     │           Tier 1  chunked obs scan     │                 │     │           Tier 2  expression aggregate │                 │     │           Tier 9  refuse → snippet     │                 │     ▼                                        │                 │   clients/      OLS4 (HTTPS) + Census/SOMA   │                 │                                              │                 │   caches/       OLS, facet, plan, filter LRU │                 │   models/       Response envelope w/         │                 │                 attribution + provenance     │                 └──────────────────────────────────────────────┘                                    │                                    ▼                       ┌────────────────────────┐                       │ EBI OLS4 (ontology)    │                       │ CZ CELLxGENE Census    │                       │ (CC BY 4.0 data)       │                       └────────────────────────┘

Full architecture notes: docs/architecture.md. Tool reference: docs/tool-reference.md. Example questions: docs/example-questions.md.

Install

From PyPI (recommended):

bash
uv tool install "cxg-census-mcp[census]"cxg-census-mcp                       # speaks MCP over stdio

Or with pip:

bash
pip install "cxg-census-mcp[census]"

Without the [census] extra you get mock mode (deterministic fixtures) — handy for offline demos and verifying your MCP client config without pulling tiledbsoma's ~1 GB of native deps.

From source (for development):

bash
git clone https://github.com/MaxMLang/cxg-census-mcpcd cxg-census-mcpuv sync --extra dev --extra censusuv run cxg-census-mcp

MCP client config

Cursor (~/.cursor/mcp.json) and Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json on macOS) both expect the same shape. Cleanest is uvx once installed from PyPI:

json
{  "mcpServers": {    "cxg-census": {      "command": "/absolute/path/to/uvx",      "args": ["--from", "cxg-census-mcp[census]", "cxg-census-mcp"]    }  }}

Use the absolute path to uvx (which uvx from your shell). MCP clients spawn the server in a non-interactive subprocess that doesn't source your shell rc, so a bare "uvx" will fail with No such file or directory.

If you cloned from source instead, point at the checkout:

json
{  "mcpServers": {    "cxg-census": {      "command": "/absolute/path/to/uv",      "args": ["--directory", "/path/to/cxg-census-mcp", "run", "cxg-census-mcp"]    }  }}

Claude Code:

bash
claude mcp add cxg-census -- /absolute/path/to/uvx --from "cxg-census-mcp[census]" cxg-census-mcp

Quit + relaunch your client (⌘Q on macOS — closing the window isn't enough) and the server should show up in the MCP panel with 13 tools.

Tools (13 total)

Workflow: census_summary, get_census_versions, count_cells, list_datasets, gene_coverage, aggregate_expression, preview_obs, export_snippet, get_server_limits.

Inspection: resolve_term, expand_term, term_definition, list_available_values.

Plus MCP resources (markdown docs at cxg-census-mcp://docs/{slug}), prompts (census_workflow, disambiguation), and cooperative progress / cancellation notifications. Details in docs/tool-reference.md.

Configuration

All env vars use the CXG_CENSUS_MCP_ prefix. Most useful:

VariableDefaultPurpose
CXG_CENSUS_MCP_CENSUS_VERSIONstableCensus release to pin
CXG_CENSUS_MCP_CACHE_DIRplatformdirs defaultDisk cache root
CXG_CENSUS_MCP_MOCK_MODE0If 1, never opens a real Census handle
CXG_CENSUS_MCP_LOG_LEVELWARNINGstdlib log level

Full list and validation: src/cxg_census_mcp/config.py.

Development & operations

Quick loop:

bash
make install-all                 # uv sync --extra dev --extra censusmake lint typecheck test         # ruff + mypy + pytest (mock mode)make cov                         # tests + coverage HTML in ./htmlcovmake audit                       # pip-audit on locked production deps

Operational tasks (cache pre-warm, schema diff, container build, metrics dump, plan-cache vacuum, weekly hint/facet refresh) live in the Makefile and are documented in docs/operational-playbook.md.

Documentation index

TopicWhere
System architecturedocs/architecture.md
Tool referencedocs/tool-reference.md
Example agent questionsdocs/example-questions.md
Ontology resolutiondocs/ontology-resolution.md
Schema-drift handlingdocs/schema-drift-format.md
Census version pinningdocs/version-pinning.md
Progress / cancellationdocs/progress-and-cancellation.md
Error modeldocs/error-model.md
Known limitationsdocs/limitations.md
Ops runbookdocs/operational-playbook.md
ChangelogCHANGELOG.md

License & attribution

Source code: MIT. The MIT license covers only the code in this repository, not the upstream data, ontologies, or third-party trademarks.

  • Data. Tool responses are derived (filtered/aggregated) from the CZ CELLxGENE Discover Census, distributed by the Chan Zuckerberg Initiative under CC BY 4.0. Every response carries an attribution field; downstream users must preserve attribution and indicate that changes were made.
  • Ontologies are fetched via EBI Ontology Lookup Service (OLS4) from CL, UBERON, MONDO, EFO, HANCESTRO, and others; each carries its own license.
  • Trademarks ("CELLxGENE", "Cursor", "Claude", "Anthropic", "Model Context Protocol", …) belong to their respective owners. Use here is descriptive only and does not imply affiliation.

This project is a client of the CZ CELLxGENE Discover Census; it does not host, mirror, or redistribute Census data.

Full notice in LICENSE.

來源:README.md,提交 ffcddcd

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.1.2最新Sep 16, 2026

評分

已滿足適用檢查項的 40%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分

    請在儲存庫或註冊中心條目中宣告授權條款。