home / mcp / scvi mcp server

scvi MCP Server

An MCP (Model Context Protocol) server for deep probabilistic analysis of single-cell omics data using scvi-tools with natural language!

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "hyennnnnnn-scvi-mcp": {
      "command": "/path/to/scvi-mcp/venv/bin/python",
      "args": [
        "-m",
        "scvi_mcp",
        "run",
        "--data",
        "/path/to/data.h5ad"
      ]
    }
  }
}

You can run an MCP server for deep probabilistic analysis of single-cell omics data using scvi-tools, exposing powerful modeling and annotation capabilities through an MCP client. This server enables you to train models, extract latent representations, annotate cell types, and integrate multi-modal data with a streamlined, scalable interface.

How to use

You will connect your MCP client to the scvi MCP server to perform common workflows. Start by ensuring your server is running, then initiate actions through the client that map to the available analysis tools. Typical use cases include training an SCVI model, obtaining latent representations, performing differential expression, annotating cell types with SCANVI, and integrating protein data with TOTALVI or PEAKVI analysis for chromatin accessibility.

How to install

# Prerequisites
- Python 3.8+ and a virtual environment tool (venv)
- Access to the MCP server command via the config block below

# Install the MCP server package
cd /path/to/scvi-mcp
python3 -m venv venv
source venv/bin/activate
pip install -e .

# Start the server (example for the provided MCP command is shown in the configuration)

Configuration and usage example

Configure your MCP client to reach the scvi MCP server using the stdio method shown below. This uses a local Python environment to invoke the MCP runner and pass the required data file path.

{
  "mcpServers": {
    "scvi": {
      "command": "/path/to/scvi-mcp/venv/bin/python",
      "args": ["-m", "scvi_mcp", "run", "--data", "/path/to/data.h5ad"]
    }
  }
}

Notes and best practices

- Use a dedicated virtual environment for the MCP server to keep dependencies isolated from your system Python. - Point the --data argument to an H5AD file containing your single-cell data with the appropriate pre-processing steps. - When you train models or run analyses, save outputs (latents, residuals, predictions) to deterministic locations to enable reproducibility.

Security and maintenance

- Limit access to the MCP server to trusted clients and consider authenticating client requests if you expose the server over a network. - Regularly update the scvi-tools MCP package to incorporate fixes and improvements, and rebuild the environment as needed.

Troubleshooting

If the MCP server cannot start: verify that the Python path in the command exists, the virtual environment is activated, and the data file path is correct. Check that the specified data file is readable and that dependencies installed with pip install -e . completed successfully.

Tools and capabilities

The server exposes tools spanning SCVI, SCANVI, TOTALVI, and PEAKVI for single-cell analysis and multi-modal data. See the tool list in the metadata for the exact tool names and how they map to model setup, training, evaluation, and prediction.

Example workflows

Basic SCVI workflow: setup data, create an SCVI model with latent dimensions, train, extract latent representations, and run differential expression between cell types.

SCANVI cell type annotation: setup with labeled cell types, create a SCANVI model from a trained SCVI model, train SCANVI, and predict cell types.

License

MIT License.

Related projects

scvi-tools and Scanpy.

Available tools

scvi_setup_anndata

Prepare AnnData objects for SCVI analyses, including basic preprocessing and metadata alignment.

scvi_create_model

Instantiate an SCVI model with chosen latent dimensionality and architecture.

scvi_train_model

Train the SCVI model on the prepared dataset and monitor convergence.

scvi_get_latent_representation

Extract the learned latent representation for downstream analyses and visualization.

scvi_get_normalized_expression

Compute normalized expression values from the SCVI model outputs.

scvi_differential_expression

Perform differential expression analysis between specified cell groups.

scvi_save_model

Persist the trained SCVI model to disk for later reuse.

scvi_load_model

Load a previously saved SCVI model for inference or continuation.

scanvi_setup_anndata

Prepare AnnData for SCANVI semi-supervised annotation, aligning labels and features.

scanvi_create_model

Create a SCANVI model using a trained SCVI backbone.

scanvi_from_scvi_model

Create a SCANVI model from an existing SCVI model to enable semi-supervised labeling.

scanvi_predict

Predict cell types for unlabeled cells using the SCANVI model.

totalvi_setup_anndata

Prepare AnnData for TOTALVI, integrating RNA and protein modalities.

totalvi_create_model

Create a TOTALVI model for joint RNA-protein analysis.

totalvi_get_protein_foreground_prob

Estimate protein foreground probabilities for denoising protein measurements.

peakvi_setup_anndata

Prepare AnnData for PEAKVI to analyze scATAC-seq data.

peakvi_create_model

Create a PEAKVI model for chromatin accessibility analysis.

peakvi_differential_accessibility

Identify differential chromatin accessibility between groups.

scvi_get_elbo

Compute the Evidence Lower Bound for model evaluation.

scvi_get_reconstruction_error

Assess reconstruction error as a model diagnostic.