Metadata-Version: 2.4
Name: chatspatial
Version: 1.5.3
Summary: ChatSpatial: Natural language-driven spatial transcriptomics analysis via Model Context Protocol (MCP) integration
Author-email: Chen Yang <cafferychen777@tamu.edu>
License-Expression: MIT
Project-URL: Homepage, https://github.com/cafferychen777/ChatSpatial
Project-URL: Documentation, https://docs.cafferyang.com/
Project-URL: Repository, https://github.com/cafferychen777/ChatSpatial
Project-URL: Issues, https://github.com/cafferychen777/ChatSpatial/issues
Keywords: spatial-transcriptomics,single-cell,mcp,llm,bioinformatics,scanpy,squidpy
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: MacOS
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Requires-Python: <3.15,>=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: mcp<3.0,>=2.0.0
Requires-Dist: anyio<5.0,>=4.9.0
Requires-Dist: numpy>=1.21.0
Requires-Dist: pandas>=1.3.0
Requires-Dist: scipy>=1.7.0
Requires-Dist: scikit-learn>=1.0.0
Requires-Dist: statsmodels<1.0,>=0.13.0
Requires-Dist: certifi>=2024.2.2
Requires-Dist: cloudpickle>=2.2.0
Requires-Dist: typing-extensions>=4.12.0
Requires-Dist: zarr<4.0,>=2.18.0
Requires-Dist: matplotlib>=3.5.0
Requires-Dist: seaborn>=0.11.0
Requires-Dist: Pillow>=8.0.0
Requires-Dist: scanpy<2.0,>=1.11.0
Requires-Dist: anndata>=0.11.0
Requires-Dist: squidpy<2.0,>=1.6.0
Requires-Dist: flashs<0.3,>=0.2.1
Requires-Dist: umap-learn>=0.5.0
Requires-Dist: igraph>=0.9.0
Requires-Dist: leidenalg>=0.8.0
Requires-Dist: pydantic<3.0,>=2.12.0
Requires-Dist: click>=8.0.0
Provides-Extra: deep-learning
Requires-Dist: torch<3.0,>=2.0.0; extra == "deep-learning"
Requires-Dist: scvi-tools<2.0,>=1.0.0; extra == "deep-learning"
Provides-Extra: velocity
Requires-Dist: scvelo-modern<0.4,>=0.3.4.post2; extra == "velocity"
Provides-Extra: trajectory
Requires-Dist: cellrank<3.0,>=2.3.2; python_version >= "3.12" and extra == "trajectory"
Requires-Dist: palantir>=1.0.0; extra == "trajectory"
Provides-Extra: cell-communication
Requires-Dist: liana<2.0,>=1.4.0; python_version < "3.14" and extra == "cell-communication"
Requires-Dist: cellphonedb<6.0,>=5.0.0; extra == "cell-communication"
Provides-Extra: fastccc
Requires-Dist: fastccc-modern<1.1,>=1.0.1.post1; extra == "fastccc"
Provides-Extra: integration
Requires-Dist: harmonypy>=0.0.9; extra == "integration"
Requires-Dist: bbknn>=1.5.0; extra == "integration"
Requires-Dist: scanorama>=1.7.0; extra == "integration"
Provides-Extra: spatial-stats
Requires-Dist: esda>=2.4.0; extra == "spatial-stats"
Requires-Dist: libpysal>=4.6.0; extra == "spatial-stats"
Requires-Dist: networkx>=2.6.0; extra == "spatial-stats"
Provides-Extra: deconvolution
Requires-Dist: flashdeconv>=0.1.0; extra == "deconvolution"
Requires-Dist: cell2location>=0.1.4; extra == "deconvolution"
Provides-Extra: annotation
Requires-Dist: tangram-sc>=1.0.0; extra == "annotation"
Requires-Dist: singler>=0.4.0; sys_platform != "win32" and extra == "annotation"
Requires-Dist: singlecellexperiment>=0.4.0; sys_platform != "win32" and extra == "annotation"
Requires-Dist: celldex>=0.3.0; sys_platform != "win32" and extra == "annotation"
Requires-Dist: mllmcelltype>=0.1.0; extra == "annotation"
Provides-Extra: enrichment
Requires-Dist: gseapy>=1.0.0; extra == "enrichment"
Requires-Dist: enrichmap>=0.1.0; extra == "enrichment"
Requires-Dist: requests<3.0,>=2.31.0; extra == "enrichment"
Provides-Extra: cnv
Requires-Dist: infercnvpy>=0.4.0; extra == "cnv"
Provides-Extra: differential
Requires-Dist: pydeseq2>=0.4.0; extra == "differential"
Provides-Extra: registration
Requires-Dist: torch<3.0,>=2.0.0; extra == "registration"
Requires-Dist: POT>=0.9.0; extra == "registration"
Requires-Dist: paste-modern<1.5,>=1.4.0.post1; extra == "registration"
Requires-Dist: stalign-modern<1.1,>=1.0.post1; extra == "registration"
Provides-Extra: spatial-genes
Requires-Dist: spatialde-modern<1.2,>=1.1.3.post2; extra == "spatial-genes"
Provides-Extra: rctd-python
Requires-Dist: rctd-py<0.4,>=0.3.7; extra == "rctd-python"
Provides-Extra: r-backends
Requires-Dist: rpy2<3.7,>=3.6.7; extra == "r-backends"
Requires-Dist: anndata2ri>=1.3.0; extra == "r-backends"
Provides-Extra: full
Requires-Dist: torch<3.0,>=2.0.0; extra == "full"
Requires-Dist: scvi-tools<2.0,>=1.0.0; extra == "full"
Requires-Dist: scvelo-modern<0.4,>=0.3.4.post2; extra == "full"
Requires-Dist: cellrank<3.0,>=2.3.2; python_version >= "3.12" and extra == "full"
Requires-Dist: palantir>=1.0.0; extra == "full"
Requires-Dist: liana<2.0,>=1.4.0; python_version < "3.14" and extra == "full"
Requires-Dist: cellphonedb<6.0,>=5.0.0; extra == "full"
Requires-Dist: fastccc-modern<1.1,>=1.0.1.post1; extra == "full"
Requires-Dist: harmonypy>=0.0.9; extra == "full"
Requires-Dist: bbknn>=1.5.0; extra == "full"
Requires-Dist: scanorama>=1.7.0; extra == "full"
Requires-Dist: esda>=2.4.0; extra == "full"
Requires-Dist: libpysal>=4.6.0; extra == "full"
Requires-Dist: networkx>=2.6.0; extra == "full"
Requires-Dist: flashdeconv>=0.1.0; extra == "full"
Requires-Dist: cell2location>=0.1.4; extra == "full"
Requires-Dist: tangram-sc>=1.0.0; extra == "full"
Requires-Dist: singler>=0.4.0; sys_platform != "win32" and extra == "full"
Requires-Dist: singlecellexperiment>=0.4.0; sys_platform != "win32" and extra == "full"
Requires-Dist: celldex>=0.3.0; sys_platform != "win32" and extra == "full"
Requires-Dist: mllmcelltype>=0.1.0; extra == "full"
Requires-Dist: gseapy>=1.0.0; extra == "full"
Requires-Dist: enrichmap>=0.1.0; extra == "full"
Requires-Dist: requests<3.0,>=2.31.0; extra == "full"
Requires-Dist: infercnvpy>=0.4.0; extra == "full"
Requires-Dist: pydeseq2>=0.4.0; extra == "full"
Requires-Dist: graphst-modern<1.2,>=1.1.1.post3; extra == "full"
Requires-Dist: stagate-modern<1.1,>=1.0.0.post1; extra == "full"
Requires-Dist: spagcn-modern<1.4,>=1.3.0; extra == "full"
Requires-Dist: pybanksy<2.0,>=1.3.5; python_version < "3.14" and extra == "full"
Requires-Dist: spatialde-modern<1.2,>=1.1.3.post2; extra == "full"
Requires-Dist: POT>=0.9.0; extra == "full"
Requires-Dist: paste-modern<1.5,>=1.4.0.post1; extra == "full"
Requires-Dist: stalign-modern<1.1,>=1.0.post1; extra == "full"
Provides-Extra: spatial-domains
Requires-Dist: torch<3.0,>=2.0.0; extra == "spatial-domains"
Requires-Dist: graphst-modern<1.2,>=1.1.1.post3; extra == "spatial-domains"
Requires-Dist: stagate-modern<1.1,>=1.0.0.post1; extra == "spatial-domains"
Requires-Dist: spagcn-modern<1.4,>=1.3.0; extra == "spatial-domains"
Requires-Dist: pybanksy<2.0,>=1.3.5; python_version < "3.14" and extra == "spatial-domains"
Provides-Extra: aestetik
Requires-Dist: aestetik<0.4,>=0.3.1; python_version < "3.14" and extra == "aestetik"
Provides-Extra: reproducibility
Requires-Dist: requests<3.0,>=2.31.0; extra == "reproducibility"
Requires-Dist: statsmodels<1.0,>=0.13.0; extra == "reproducibility"
Provides-Extra: dev
Requires-Dist: pytest>=8.0.0; extra == "dev"
Requires-Dist: pytest-asyncio<2.0,>=0.23.0; extra == "dev"
Requires-Dist: black==25.12.0; extra == "dev"
Requires-Dist: mypy<2.0,>=1.0.0; extra == "dev"
Requires-Dist: types-requests>=2.31.0; extra == "dev"
Requires-Dist: ruff==0.14.11; extra == "dev"
Requires-Dist: isort==7.0.0; extra == "dev"
Requires-Dist: pre-commit<5.0,>=3.0.0; extra == "dev"
Provides-Extra: release
Requires-Dist: build==1.5.0; extra == "release"
Requires-Dist: twine==7.0.0; extra == "release"
Dynamic: license-file

<div align="center">

# ChatSpatial

**MCP server for spatial transcriptomics analysis via natural language**

[![Paper](https://img.shields.io/badge/bioRxiv-2026.02.26.708361-b31b1b.svg)](https://doi.org/10.64898/2026.02.26.708361)
[![MLGenX @ ICLR 2026](https://img.shields.io/badge/MLGenX%20@%20ICLR%202026-Oral-blue.svg)](https://openreview.net/forum?id=xZ814yNaUW)
[![ENAR 2026](https://img.shields.io/badge/ENAR%202026-Oral-blue.svg)](https://www.enar.org/meetings/spring2026/)
[![IBC 2026](https://img.shields.io/badge/IBC%202026-Oral-blue.svg)](https://www.ibc2026.org/home)
[![CI](https://github.com/cafferychen777/ChatSpatial/actions/workflows/ci.yml/badge.svg)](https://github.com/cafferychen777/ChatSpatial/actions/workflows/ci.yml)
[![PyPI](https://img.shields.io/pypi/v/chatspatial)](https://pypi.org/project/chatspatial/)
[![Python 3.11-3.14](https://img.shields.io/badge/python-3.11--3.14-blue.svg)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Docs](https://img.shields.io/badge/docs-available-blue)](https://docs.cafferyang.com/)
[![Docker](https://img.shields.io/badge/docker-ghcr.io-blue)](https://github.com/users/cafferychen777/packages/container/package/chatspatial)

</div>

<p align="center">
  <img src="assets/images/overview.jpg" alt="ChatSpatial Overview" width="900">
</p>

ChatSpatial replaces ad-hoc LLM code generation with **schema-enforced orchestration**. Instead of generating arbitrary scripts, the LLM selects tools and parameters from a curated registry, making spatial transcriptomics workflows more reproducible across sessions and clients.

ChatSpatial exposes **20 schema-validated MCP tools** that orchestrate **66 spatial transcriptomics methods** across **15 analytical categories**. The tools are the stable natural-language interface; the methods are the analysis backends selected through tool parameters.

The server implements MCP `2026-07-28` through the official Python SDK v2 and
continues to serve `2025-11-25` clients through SDK-managed protocol negotiation.
STDIO remains the secure local default; Streamable HTTP is available for
explicitly configured HTTP deployments.

---

## Start Here

Install [`uv`](https://docs.astral.sh/uv/getting-started/installation/) once, then
register ChatSpatial without creating or managing a Python environment:

**Codex:**

```bash
codex mcp add chatspatial -- uvx --from chatspatial chatspatial server
```

**Claude Code:**

```bash
claude mcp add --scope user chatspatial -- \
  uvx --from chatspatial chatspatial server
```

`uvx` creates an isolated environment on first launch and reuses its cache on
later launches. Restart the MCP client after adding the server.

The command above installs the standard runtime. To make all 15 composable
Python method families available in the same isolated MCP environment, use:

```bash
uvx --from 'chatspatial[full]' chatspatial server
```

`full` includes CellRank, FastCCC, the maintained spatial-domain and
registration backends, annotation, enrichment, and the other portable Python
families. R bridges, AESTETIK, and rctd-py remain separate because they have
system, platform, or large-runtime requirements. See the installation guide
before enabling those families.

Then:

1. **Run your first analysis** — [Quick Start](docs/quickstart.md)
2. **Choose optional method families or a persistent environment** — [Installation Guide](docs/installation.md)
3. **Configure another MCP client** — [Configuration Guide](docs/advanced/configuration.md)
4. **Inspect or reproduce the manuscript results** — [Reproducibility workspace](reproducibility/README.md)

**Docker quick start:**

```bash
docker pull ghcr.io/cafferychen777/chatspatial:v1.4.0
```

**Minimal example prompt:**

```text
Load /absolute/path/to/spatial_data.h5ad and show me the tissue structure
```

If you use Docker, mount host data to `/data` and prompt with the container path, for example `/data/spatial_data.h5ad`.

> ChatSpatial works with **any MCP-compatible client** — Claude Code, Claude Desktop, Codex, OpenCode, and other MCP-capable tools.

---

## Capabilities

Current coverage includes 66 methods across 15 analytical categories, exposed through 20 MCP tools. Supports 10x Visium, Xenium, Slide-seq v2, MERFISH, seqFISH.

| Category | Example methods |
|----------|---------|
| **Data Loading & Preprocessing** | Scanpy I/O, QC, Normalization, HVG, PCA, Neighbors |
| **Visualization** | Spatial plots, Embedding plots, Gene expression overlays |
| **Spatial Domain Identification** | SpaGCN, STAGATE, GraphST, BANKSY, AESTETIK, Leiden, Louvain |
| **Deconvolution** | FlashDeconv, Cell2location, RCTD (spacexr or rctd-py), DestVI, Stereoscope, SPOTlight, Tangram, CARD |
| **Cell-Cell Communication** | LIANA+, CellPhoneDB, CellChat (`cellchat_r`), FastCCC |
| **Cell Type Annotation** | Tangram, scANVI, CellAssign, mLLMCelltype, scType, SingleR |
| **Differential Expression** | Wilcoxon, t-test, Logistic Regression, pyDESeq2 |
| **Trajectory Inference** | CellRank, Palantir, DPT |
| **RNA Velocity** | scVelo, VeloVI |
| **Spatial Statistics** | Moran's I, Local Moran, Geary's C, Getis-Ord Gi*, Ripley's K, Co-occurrence, Neighborhood Enrichment, Centrality Scores, Local Join Count, Network Properties |
| **Enrichment Analysis** | GSEA, ORA, Enrichr, ssGSEA, Spatial EnrichMap |
| **Spatially Variable Genes** | SpatialDE, SPARK-X, FlashS |
| **Multi-sample Integration** | Harmony, BBKNN, Scanorama, scVI |
| **CNV Analysis** | InferCNVPy, Numbat |
| **Spatial Registration** | PASTE, STalign |

---

## Documentation

| Guide | Use this when... |
|-------|------------------|
| [Installation](docs/installation.md) | You need optional methods or a persistent Python environment |
| [Docker](docs/docker.md) | You want a reproducible container runtime or local dependency resolution fails |
| [Configuration](docs/advanced/configuration.md) | You need exact MCP client syntax or the runtime path model |
| [Quick Start](docs/quickstart.md) | ChatSpatial is installed and you want the first successful analysis |
| [Concepts](docs/concepts.md) | You need to choose an analysis strategy from a biological question |
| [Examples](docs/examples.md) | You want copy-pasteable natural-language workflow prompts |
| [Methods Reference](docs/advanced/methods-reference.md) | You need canonical tool names, method names, parameters, and defaults |
| [Troubleshooting](docs/advanced/troubleshooting.md) | Setup, data loading, or analysis behavior is not working |
| [Full Docs](https://docs.cafferyang.com/) | You want the complete documentation site |

---

## Reproducibility

The manuscript experiment scripts, small aggregate result tables, and
supplementary tables are versioned in [`reproducibility/`](reproducibility/README.md).
Large datasets, raw provider checkpoints, generated analysis directories, and
manuscript source files are intentionally kept outside Git. The reproducibility
workspace documents both the manuscript-era package baseline and the
current-checkout development workflow so historical evidence is not silently
regenerated with a different ChatSpatial release.

---

## Citation

If you use ChatSpatial in your research, please cite:

```bibtex
@article{Yang2026.02.26.708361,
  author = {Yang, Chen and Zhang, Xianyang and Chen, Jun},
  title = {ChatSpatial: Schema-Enforced Agentic Orchestration for Reproducible and Cross-Platform Spatial Transcriptomics},
  elocation-id = {2026.02.26.708361},
  year = {2026},
  doi = {10.64898/2026.02.26.708361},
  publisher = {Cold Spring Harbor Laboratory},
  URL = {https://www.biorxiv.org/content/early/2026/03/01/2026.02.26.708361},
  journal = {bioRxiv}
}
```

ChatSpatial orchestrates many excellent third-party methods. **Please also cite the original tools your analysis used.**

---

## Contributing

Documentation improvements, bug reports, and new analysis methods are all welcome. See [CONTRIBUTING.md](CONTRIBUTING.md).

<div align="center">

**MIT License** · [GitHub](https://github.com/cafferychen777/ChatSpatial) · [Issues](https://github.com/cafferychen777/ChatSpatial/issues)

</div>

<!-- mcp-name: io.github.cafferychen777/chatspatial -->
