home / mcp / chatspatial mcp server

ChatSpatial MCP Server

Provides an MCP server to run spatial transcriptomics analyses via natural language with multiple methods and data sources.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "cafferychen777-chatspatial": {
      "command": "python",
      "args": [
        "-m",
        "chatspatial",
        "server"
      ]
    }
  }
}

ChatSpatial provides an MCP server that lets you run spatial transcriptomics workflows through natural language. You can install a Python-based server and connect clients to execute spatial analyses, domain identification, deconvolution, cell-type annotation, and more, all from conversational prompts.

How to use

You interact with the MCP server through your preferred MCP client. Start the local Python server and connect your client to issue natural language requests such as loading spatial data, identifying spatial domains, finding spatially variable genes, or performing deconvolution.

How to install

Prerequisites: ensure Python is installed on your system.

Install the ChatSpatial MCP package.

pip install chatspatial

Configuration snippets you can use

You can configure the MCP client to start the ChatSpatial server as a local process. The following example shows how to run the server directly from Python using the module interface.

{
  "mcpServers": {
    "chatspatial": {
      "command": "python",
      "args": ["-m", "chatspatial", "server"]
    }
  }
}

Starter commands for common clients

For Claude Desktop, you would add the MCP server pointing to the Python module as shown above. Restart Claude after configuring.

For Claude Code, use the MCP add command with the same Python invocation.

For Codex, configure the MCP server with the same Python command and arguments.

If you are using a virtual environment, point the command to the environment’s Python executable, for example: "command": "/path/to/venv/bin/python" and keep the same arguments.

Operational tips

Verify the server starts and remains active before issuing requests. Use the MCP client to send natural language prompts such as “Load a Visium dataset and identify spatial domains” or “Find spatially variable genes and create a heatmap.”

Notes on capabilities

ChatSpatial offers extensive methods across multiple categories, including spatial domain detection, deconvolution, cell communication, cell type annotation, trajectory and velocity analysis, spatial statistics, enrichment analysis, spatial gene discovery, integration, and other supportive tools for spatial transcriptomics workflows.

Security and maintenance considerations

Run the MCP server on trusted networks and manage access to clients. Keep Python and dependencies updated, and monitor logs for unusual activity. If you need to upgrade, reinstall the package and restart the server.

Troubleshooting tips

If the server does not start, confirm that Python is available in your PATH and that the chatspatial module is installed. Check for common issues such as version conflicts or missing dependencies and reinstall if needed.

Examples of typical prompts you can use

Load /path/to/spatial_data.h5ad and identify spatial domains

Identify spatial domains using SpaGCN

Find spatially variable genes and create a heatmap

Available tools

Load spatial data

Load spatial transcriptomics data into the system and prepare it for analysis.

Identify spatial domains

Detect spatial domains using methods like SpaGCN, STAGATE, GraphST, Leiden, or Louvain.

Deconvolution

Estimate cell type proportions in spatial spots using methods such as Cell2location, Tangram, SPOTlight, and others.

Cell communication

Infer interactions between cell types using LIANA, CellPhoneDB, CellChat, or FastCCC.

Cell type annotation

Assign cell type labels to spots or cells with tools like Tangram, scANVI, CellAssign, and SingleR.

Trajectory & velocity

Compute developmental trajectories and RNA velocity with CellRank, Palantir, DPT, scVelo, and VeloVI.

Spatial statistics

Assess spatial patterns with Moran’s I, Local Moran, Geary’s C, Getis-Ord Gi*, Ripley’s K, and Neighborhood Enrichment.

Enrichment analysis

Perform gene set and enrichment analyses including GSEA, Enrichr, ssGSEA, and Spatial EnrichMap.

Spatial genes

Identify spatially variable genes using SpatialDE, SPARK-X.

Integration

Integrate datasets across batches or technologies with Harmony, BBKNN, Scanorama, and scVI.

Other analyses

Support for CNV analysis, spatial registration, and additional miscellaneous workflows.