Skip to main content
Glama

ChatSpatial

MCP server for spatial transcriptomics analysis via natural language

Paper MLGenX @ ICLR 2026 ENAR 2026 IBC 2026 CI PyPI Python 3.11-3.14 License: MIT Docs Docker

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 server

Claude Code:

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:

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

  2. Choose optional method families or a persistent environment — Installation Guide

  3. Configure another MCP client — Configuration Guide

  4. Reproduce the manuscript key results without an LLM — Reproduction image

Docker quick start:

docker pull cafferyyang777/chatspatial:latest

Minimal example prompt:

Load /absolute/path/to/spatial_data.h5ad and plot gene expression at the spatial coordinates

The 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 (cellchat_r), FastCCC

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...

Installation

You need optional methods or a persistent Python environment

Docker

You want a reproducible container runtime or local dependency resolution fails

Configuration

You need exact MCP client syntax or the runtime path model

Quick Start

ChatSpatial is installed and you want the first successful analysis

Concepts

You need to choose an analysis strategy from a biological question

Examples

You want copy-pasteable natural-language workflow prompts

Methods Reference

You need canonical tool names, method names, parameters, and defaults

Troubleshooting

Setup, data loading, or analysis behavior is not working

Full Docs

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-reproduce

reproducibility/ 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.

MIT License · GitHub · Issues

Available Tools

20 tools
analyze_cell_communicationB
DestructiveIdempotent

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_cnvA
DestructiveIdempotent

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_enrichmentC
DestructiveIdempotent

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_statisticsA
DestructiveIdempotent

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_dataC
Destructive

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_dataB
Destructive

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_typesA
Destructive

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_conditionsA
DestructiveIdempotent

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_embeddingsB
Destructive

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_dataC
Destructive

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_dataA
DestructiveIdempotent

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_markersC
DestructiveIdempotent

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_genesC
DestructiveIdempotent

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_domainsC
Destructive

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_samplesB
Destructive

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_dataA
Destructive

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_dataC
Destructive

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_dataA
DestructiveIdempotent

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_dataB
Destructive

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

    B3.4/5.0

    Scored across 20 tools

    Disambiguation4/5

    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.

    Naming Consistency5/5

    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.

    Tool Count4/5

    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.

    Completeness4/5

    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

    ActivityMaintained
    ResponsivenessLimited data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      C
      quality
      D
      maintenance
      An MCP server that enables single-cell RNA sequencing analysis through natural language, supporting data processing, visualization, and analysis tasks without requiring coding knowledge.
      52
      12
      BSD 3-Clause
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables 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
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      An 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 PyPI
      16
      BSD 3-Clause
    • F
      license
      Not graded
      quality
      D
      maintenance
      Provides 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 PyPI
      4
      -