ChatSpatial
ChatSpatial is an MCP server that lets you run reproducible spatial transcriptomics analyses through natural-language tool orchestration — 20 schema-validated tools covering 65 methods across 13 analytical categories.
Load and inspect data —
load_dataingests Visium, Xenium, Slide-seq, MERFISH, seqFISH, or generic formats and returns cell/gene counts, metadata column profiles, spatial coordinate and tissue image availability.Preprocess and embed —
preprocess_datahandles QC, filtering, normalization (Pearson residuals, log, SCTransform, scVI), doublet detection, and HVG selection;compute_embeddingsadds PCA, UMAP, neighbors, Leiden/Louvain clustering, and spatial graphs.Visualize —
visualize_dataproduces spatial, expression, deconvolution, communication, trajectory, velocity, statistics, enrichment, CNV, and integration plots (PNG/PDF/SVG/EPS/TIFF/JPG).Identify spatial domains —
identify_spatial_domainsruns SpaGCN, STAGATE, GraphST, BANKSY, AESTETIK, Leiden, or Louvain with optional label refinement.Deconvolve spots —
deconvolve_dataestimates cell-type proportions with FlashDeconv, Cell2location, RCTD, DestVI, Stereoscope, SPOTlight, Tangram, or CARD.Annotate cell types —
annotate_cell_typessupports Tangram, scANVI, CellAssign, mLLMCelltype, scType, and SingleR.Differential expression —
find_markerscompares groups within a dataset (Wilcoxon, t-test, logreg, pyDESeq2);compare_conditionsruns pseudobulk DESeq2 across samples/conditions, optionally cell-type stratified.Spatial statistics —
analyze_spatial_statisticscovers Moran's I, local Moran, Geary's C, Getis-Ord Gi*, bivariate Moran, Ripley's K, co-occurrence, neighborhood enrichment, join counts, centrality, and network properties.Spatially variable genes —
find_spatial_genesuses SpatialDE, SPARK-X, or FlashS.Trajectory and velocity —
analyze_trajectory_data(CellRank, Palantir, DPT) andanalyze_velocity_data(scVelo, VeloVI).Cell-cell communication —
analyze_cell_communicationwith LIANA+, CellPhoneDB, CellChat (R), or FastCCC for human, mouse, and zebrafish.Enrichment —
analyze_enrichmentruns GSEA, ORA, Enrichr, ssGSEA, and spatial EnrichMap against GO, KEGG, Reactome, MSigDB Hallmark, or cell-type marker databases.CNV analysis —
analyze_cnvwith InferCNVPy or Numbat.Multi-sample integration and registration —
integrate_samples(Harmony, BBKNN, Scanorama, scVI) andregister_spatial_data(PASTE, STalign).Export/reload —
export_dataandreload_datamove datasets to/from disk for external script access.
ChatSpatial
MCP server for spatial transcriptomics analysis via natural language
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 67 spatial transcriptomics methods across 13 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 once, then
register ChatSpatial without creating or managing a Python environment:
Codex:
codex mcp add chatspatial -- uvx --from chatspatial chatspatial serverClaude Code:
claude mcp add --scope user chatspatial -- \
uvx --from chatspatial chatspatial serveruvx 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:
uvx --from 'chatspatial[full]' chatspatial serverfull 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:
Run your first analysis — Quick Start
Choose optional method families or a persistent environment — Installation Guide
Configure another MCP client — Configuration Guide
Reproduce the manuscript key results without an LLM — Reproduction image
Docker quick start:
docker pull cafferyyang777/chatspatial:latestMinimal example prompt:
Load /absolute/path/to/spatial_data.h5ad and plot gene expression at the spatial coordinatesThe Quick Start provides a downloadable sample and a
Leiden workflow that runs with the standard installation. Its sample has spatial
coordinates but no H&E image. SpaGCN requires the optional spatial-domains extra.
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.
Related MCP server: Liana-MCP
Capabilities
Current coverage includes 67 methods across 13 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 ( |
Cell Type Annotation | Tangram, scANVI, CellAssign, mLLMCelltype, scType, SingleR, marker-score and threshold rules |
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... |
You need optional methods or a persistent Python environment | |
You want a reproducible container runtime or local dependency resolution fails | |
You need exact MCP client syntax or the runtime path model | |
ChatSpatial is installed and you want the first successful analysis | |
You need to choose an analysis strategy from a biological question | |
You want copy-pasteable natural-language workflow prompts | |
You need canonical tool names, method names, parameters, and defaults | |
Setup, data loading, or analysis behavior is not working | |
You want the complete documentation site |
Reproducibility
Each release publishes a reproduction image under the -repro tag. It
re-executes the DLPFC spatial-domain and OSCC CARD deconvolution tool calls
recorded during the manuscript experiments, without calling any LLM, and
compares the results with the reported values:
docker run --rm -v "$PWD/out:/outputs" \
cafferyyang777/chatspatial@sha256:ac3ba1ed8235c3d53ca72005d8ad2556cac007f5ddb932ae3e1d1241fa2cf9d8 \
chatspatial-reproducereproducibility/ contains the image definition
and describes what it checks. The experiment and analysis scripts for the
manuscript are in
ChatSpatial-Reproducibility.
Citation
If you use ChatSpatial in your research, please cite:
@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.
Available Tools
20 toolsanalyze_cell_communicationBDestructiveIdempotent
Analyze cell-cell communication and ligand-receptor interaction patterns.
Args:
data_id: Dataset ID
params: Required - species, cell_type_key, and method. For mouse with liana, set liana_resource='mouseconsensus'.
subset_key + subset_categories restrict the analysis to those observations
(e.g. tc_le_region in ['TC', 'LE']).
Inputs: params (required), data_id (required). Returns: Result of cell-cell communication analysis. All CCC results are stored in a uni…
analyze_cnvADestructiveIdempotent
Analyze copy number variations (CNVs) in spatial transcriptomics data.
Args:
data_id: Dataset identifier
params: Required - reference_key, reference_categories, and optional method/thresholds.
Gene positions missing from adata.var are annotated from bundled Ensembl 110
tables (species: human GRCh38 or mouse GRCm39). exclude_gene_classes removes
immunoglobulin, ribosomal, mitochondrial or HLA genes from the CNV input;
query_categories restricts CNV clustering to those reference_key categories.
Inputs: params (required), data_id (required). Returns: Result of Copy Number Variation (CNV) analysis Note on serialization: For consi…
analyze_enrichmentCDestructiveIdempotent
Perform gene set enrichment analysis.
Args:
data_id: Dataset ID
params: Required - species must be specified. See EnrichmentParameters for methods and gene_set_database options.
Inputs: params (required), data_id (required). Returns: Result from gene set enrichment analysis Note on serialization: To minimize MCP…
analyze_spatial_statisticsADestructiveIdempotent
Analyze spatial statistics and autocorrelation patterns.
Args:
data_id: Dataset ID
params: Analysis parameters (analysis_type, cluster_key, genes). See SpatialStatisticsParameters for all types.
gene_selection='all' computes moran/geary for every gene; the full per-gene
table (rank, statistic, p, FDR) is stored at results_key, only top genes are returned.
Inputs: data_id (required), params. Returns: Result of spatial analysis Note on serialization: To minimize MCP response size…
analyze_trajectory_dataCDestructive
Infer cellular trajectories and pseudotime ordering.
Args:
data_id: Dataset ID
params: Trajectory parameters (method, root_cell, spatial_weight, etc.)
Inputs: data_id (required), params. Returns: Result of trajectory analysis
analyze_velocity_dataBDestructive
Analyze RNA velocity to understand cellular dynamics. Requires 'spliced' and 'unspliced' layers.
Args:
data_id: Dataset ID
params: Velocity parameters (method, scvelo_mode, etc.)
Inputs: data_id (required), params. Returns: Result of RNA velocity analysis
annotate_cell_typesADestructive
Annotate cell types in spatial transcriptomics data.
Args:
data_id: Dataset ID
params: Annotation parameters (method, reference_data_id, cell_type_key, etc.)
Note: Reference methods (tangram, scanvi) require reference_data_id to be preprocessed first.
Rule-based methods: marker_score labels the groups of cluster_label (e.g. spatial
domains) by mean log-normalized marker expression; threshold labels observations
by a cutoff on a numeric obs column (e.g. deconvolution_rctd_<cell type>).
Both write to output_key.
Inputs: data_id (required), params. Returns: Result of cell type annotation Attributes: data_id: Dataset identifier method:…
compare_conditionsADestructiveIdempotent
Compare experimental conditions using pseudobulk differential expression (DESeq2).
Args:
data_id: Dataset ID
params: Required - condition_key, condition1, condition2, sample_key, etc.
Inputs: params (required), data_id (required). Returns: Result of multi-sample condition comparison analysis. Attributes: data_id: Data…
compute_embeddingsBDestructive
Compute dimensionality reduction (PCA, UMAP), clustering, and neighbor graphs.
Args:
data_id: Dataset ID
params: Embedding parameters (PCA, UMAP, clustering, etc.)
Inputs: data_id (required), params. Returns: Result of dimensionality reduction and clustering computation.
deconvolve_dataCDestructive
Deconvolve spatial spots to estimate cell type proportions.
Args:
data_id: Dataset ID
params: Required - method, cell_type_key, reference_data_id. See DeconvolutionParameters for all methods and options.
Inputs: params (required), data_id (required). Returns: Result of spatial deconvolution Note on serialization: To minimize MCP response…
export_dataADestructiveIdempotent
Export dataset to disk for external script access.
Args:
data_id: Dataset ID to export
path: Custom path (default: ~/.chatspatial/active/{data_id}.h5ad)
Returns:
Absolute path where data was exported
Inputs: data_id (required), path. Returns: result
find_markersCDestructiveIdempotent
Find differentially expressed genes between groups.
Args:
data_id: Dataset ID
params: Required - group_key and optional method, group1/group2, n_top_genes, etc.
Inputs: params (required), data_id (required). Returns: Result of differential expression analysis Note on serialization: For consisten…
find_spatial_genesCDestructiveIdempotent
Identify spatially variable genes.
Args:
data_id: Dataset ID
params: Spatial variable gene parameters (method, n_top_genes, etc.)
Inputs: data_id (required), params. Returns: Result of spatial variable genes identification. Note on serialization: To mini…
identify_spatial_domainsCDestructive
Identify spatial domains and tissue architecture.
Args:
data_id: Dataset ID
params: Spatial domain parameters (method, n_domains, resolution, etc.)
Inputs: data_id (required), params. Returns: Result of spatial domain identification Note on serialization: For consistency…
integrate_samplesBDestructive
Integrate multiple spatial transcriptomics samples into a unified dataset.
Args:
data_ids: List of dataset IDs to integrate
params: Integration parameters (method, batch_key, n_pcs, etc.)
batch_correction=False pools the samples without correction (shared genes,
counts in layers['counts'], obs and coordinates kept), e.g. to pool sections
for analyze_cell_communication.
Inputs: data_ids (required), params. Returns: Result of sample integration
load_dataA
Load spatial transcriptomics data with comprehensive metadata profile.
Args:
data_path: Path to data file or directory
data_type: 'visium', 'xenium', 'slide_seq', 'merfish', 'seqfish', or 'generic'
name: Optional dataset name
Returns:
SpatialDataset with cell/gene counts and metadata profiles
Inputs: data_path (required), data_type (required), name. Returns: Spatial transcriptomics dataset model with comprehensive metadata profile
preprocess_dataADestructive
Run QC, filtering, normalization, and highly variable gene selection.
This tool does not compute PCA, UMAP, clustering, or neighbor graphs. Run
compute_embeddings() afterward when downstream tools require those artifacts.
Args:
data_id: Dataset ID
params: Preprocessing parameters (all have sensible defaults)
Inputs: data_id (required), params. Returns: Result of data preprocessing
register_spatial_dataCDestructive
Register/align spatial transcriptomics data across sections
Args:
source_id: Source dataset ID
target_id: Target dataset ID to align to
params: Registration parameters (method, alignment settings, etc.)
Returns:
Registration result with method, dataset IDs, spot counts, and registered spatial key
Inputs: source_id (required), target_id (required), params. Returns: Result of bilateral spatial-coordinate registration.
reload_dataADestructiveIdempotent
Reload dataset from disk after external script modifications.
Args:
data_id: Dataset ID to reload (must exist in MCP memory)
path: Custom path (default: ~/.chatspatial/active/{data_id}.h5ad)
Returns:
Summary of reloaded dataset
Inputs: data_id (required), path. Returns: result
visualize_dataBDestructive
Visualize spatial transcriptomics data. Set plot_type and subtype in params; see VisualizationParameters schema for all options.
Args:
data_id: Dataset ID
params: Visualization parameters (plot_type, subtype, genes, output_format, dpi, etc.)
Inputs: data_id (required), params. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 20 tools
Most tools target clearly distinct stages of spatial transcriptomics analysis, such as loading, preprocessing, embeddings, domain detection, deconvolution, and communication. A few pairs have overlapping scope—find_markers versus compare_conditions for differential expression, and analyze_spatial_statistics versus find_spatial_genes for spatial gene statistics—but descriptions and parameter differences help distinguish them.
All tool names use snake_case and follow a verb_noun or verb_object convention (load_data, preprocess_data, find_markers, analyze_cnv, export_data). Verb choices vary appropriately by operation, with no inconsistent casing or mixed naming styles.
The suite has 20 tools, slightly above the ideal 3-15 range, but this matches a comprehensive spatial transcriptomics workflow with many distinct analysis stages. Each tool earns its place, though the surface is somewhat heavy for an MCP server.
The tools cover the full analysis lifecycle: loading, preprocessing, embeddings, visualization, spatial statistics/domains/genes, deconvolution, annotation, cell communication, CNV, velocity, trajectory, and export/reload. Minor lifecycle gaps such as listing or deleting datasets prevent a perfect completeness score.
Maintenance
Related MCP Connectors
WikiPathways MCP — open community pathway database.
cBioPortal MCP — cancer genomics portal.
Related MCP Servers
- AlicenseCqualityDmaintenanceAn MCP server that enables single-cell RNA sequencing analysis through natural language, supporting data processing, visualization, and analysis tasks without requiring coding knowledge.5212BSD 3-Clause
- FlicenseNot gradedqualityDmaintenanceEnables natural language interface for single-cell RNA-Seq analysis using Liana. Supports reading/writing scRNA-Seq data, cell-cell communication analysis, and visualization through circle plots and dotplots.1-
- AlicenseNot gradedqualityDmaintenanceAn MCP server that enables scRNA-Seq analysis through natural language, providing tools for data preprocessing, clustering, and biological visualization. It supports both predefined function execution and a flexible code mode powered by a Jupyter backend for automated single-cell transcriptomics workflows.16 PyPI16BSD 3-Clause
- FlicenseNot gradedqualityDmaintenanceProvides a natural language interface for single-cell RNA-Seq analysis using the decoupleR framework. It enables users to perform biological pathway inference, data clustering, and visualization through MCP-compatible AI clients.31 PyPI4-