Cellpose MCP Server
This MCP server lets an AI assistant inspect microscopy images, segment cells/nuclei with Cellpose, restore images, train custom models, and save/visualize masks.
Load image metadata such as shape, dtype, channels, and dimensions.
List available Cellpose pretrained and restoration models.
Estimate typical cell diameter in pixels.
Segment cells in a single 2D image.
Segment cells in a 3D volume using full 3D or slice-and-stitch modes.
Segment every image in a batch/folder.
Denoise, deblur, or upsample microscopy images.
Restore and segment an image in one combined pipeline.
Train a custom Cellpose segmentation model from images and masks.
Save masks as TIFF, PNG, or NumPy, plus outline and overlay PNGs.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Cellpose MCP Server Segment the cells in ./data/sample.tif using the cyto2 model"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Cellpose MCP Server
An MCP server that lets an AI assistant segment cells and nuclei with Cellpose: in 2D or 3D, one image or a folder, with optional denoising, deblurring, or upsampling first, and with your own trained models.
Raw image | Segmented by the assistant |
|
|
A one-page walkthrough poster (PDF) walks you step by step from setup to your first results, for people who use AI apps but do not code.
Tools
Tool | What it does |
| Reports an image's shape, data type, and channels. |
| Lists the Cellpose models you can use. |
| Estimates the typical cell diameter, in pixels. |
| Segments cells in one 2D image. |
| Segments cells in a 3D volume. |
| Segments every image in a folder. |
| Restore an image before segmenting it. |
| Restores and segments in one step. |
| Saves masks (TIFF, PNG, or NumPy) with an outline PNG and an overlay PNG. |
| Trains a model on your own images and masks. |
For images with more than one channel, say which axis holds the channels (channel_axis) and which channels are the cell and the nuclear signal (channels, counted from 1). The server does not guess.
Related MCP server: cloudcompare-mcp
Install
Needs Python 3.10, 3.11, or 3.12. It installs Cellpose 3.1.1.2; Cellpose 4 lacks the restoration tools.
pip install cellpose-mcpConnect
Claude Code
claude mcp add cellpose -e KMP_DUPLICATE_LIB_OK=TRUE -e OMP_NUM_THREADS=1 -- cellpose-mcpCodex
codex mcp add cellpose --env KMP_DUPLICATE_LIB_OK=TRUE --env OMP_NUM_THREADS=1 -- cellpose-mcpClaude Desktop, Cursor, Gemini CLI, and Antigravity use the same entry:
{
"mcpServers": {
"cellpose": {
"command": "cellpose-mcp",
"env": { "KMP_DUPLICATE_LIB_OK": "TRUE", "OMP_NUM_THREADS": "1" }
}
}
}Client | Where the entry goes |
Claude Desktop |
|
Cursor |
|
Gemini CLI |
|
Antigravity | Agent panel |
cellpose-mcp-install cursor (or claude-desktop, antigravity, claude-code, vscode) writes the entry for you. If a client cannot find cellpose-mcp, use the full path that which cellpose-mcp prints.
Use
List the available Cellpose models, then segment the cells in
/data/sample.tifwith cyto2 and save the masks next to it.
Denoise
/data/noisy.tif, segment it, and tell me how many cells you found.
Evaluation
A Codex agent ran 12 segmentation tasks through this server on six annotated nuclei images from the public BBBC039 dataset, three times each, alongside a direct Cellpose script that does not use the server. The agent completed all 36 workflows, its masks were pixel-identical to the direct script's in all 30 paired outputs, and it asked for clarification or refused correctly whenever a task required it. Against the annotations, Cellpose reached an object F1 of 0.93–0.97 on five images and 0.44 on one sparse image, in both arms. The evaluation has the design, the per-run and per-image scores, and the limits.
Development
git clone https://github.com/surajinacademia/cellpose_mcp && cd cellpose_mcp
pip install -e '.[test,dev]'
pytest -m 'not slow'The changelog lists each release.
Credits and license
Built on Cellpose by Carsen Stringer, Marius Pachitariu, and colleagues; please cite Cellpose when you publish results. napari-mcp by the Royer lab inspired the design, and the server uses FastMCP. Written by Suraj Sahu, University of California, Merced.
The code is BSD-3-Clause; see LICENSE. The example images are Cellpose's and are for non-commercial use; see THIRD_PARTY_NOTICES.md.
Available Tools
12 toolsdeblur_imageB
Deblur a microscopy image using Cellpose restoration models.
Args: image_path: Path to input image model_type: Restoration model type (deblur_cyto2, deblur_cyto3, etc.) channels: Channel specification diameter: Expected object diameter for scaling gpu: Whether to use GPU acceleration output_path: Optional path to save deblurred image
Returns
Dictionary with deblurring resultsInputs: image_path (required), gpu, channels, diameter, +2 more. Returns: object
denoise_imageA
Denoise a microscopy image using Cellpose restoration models.
Args: image_path: Path to input image model_type: Restoration model type (denoise_cyto2, denoise_cyto3, etc.) channels: Channel specification diameter: Expected object diameter for scaling gpu: Whether to use GPU acceleration output_path: Optional path to save denoised image
Returns
Dictionary with denoising resultsInputs: image_path (required), gpu, channels, diameter, +2 more. Returns: object
estimate_cell_diameterC
Estimate cell diameter from an image using Cellpose size model.
Args: image_path: Path to input image model_type: Model type to use for estimation channels: Channel specification gpu: Whether to use GPU acceleration
Returns
Dictionary with estimated diameter and confidenceInputs: image_path (required), gpu, channels, model_type. Returns: object
list_available_modelsA
List all available pretrained Cellpose models.
Returns
Dictionary with lists of available models by categoryInputs: no named parameters. Returns: object
load_image_infoB
Get information about an image file.
Args: image_path: Path to image file
Returns
Dictionary with image metadata (shape, dtype, channels, dimensions)Inputs: image_path (required). Returns: object
restore_and_segmentC
Restore (denoise/deblur) and segment an image in one pipeline.
Args: image_path: Path to input image restoration_model: Restoration model type (oneclick_cyto3, etc.) segmentation_model: Segmentation model type (cyto3, etc.) diameter: Expected cell diameter in pixels channels: Channel specification gpu: Whether to use GPU acceleration output_path_mask: Optional path to save masks output_path_restored: Optional path to save restored image
Returns
Dictionary with combined restoration and segmentation resultsInputs: image_path (required), gpu, channels, diameter, +4 more. Returns: object
save_masksA
Save masks plus outlines and overlay visualizations.
Always writes three outputs: (1) masks in the chosen format, (2) outlines as a binary PNG, (3) overlay PNG (colored masks on image or black).
Args: mask_path: Path to existing mask file output_format: Output format for masks (tif, png, npy) output_path: Optional custom output path for the masks file image_path: Optional path to original image; if provided, overlay is drawn on it save_flows: Reserved for future use (flow fields not saved)
Returns
Dictionary with mask_path, outlines_path, overlay_path, and files_createdInputs: mask_path (required), image_path, save_flows, output_path, +1 more. Returns: object
segment_cells_2dA
Segment cells in a 2D microscopy image using Cellpose.
Args: image_path: Path to input image file (TIFF, PNG, etc.) model_type: Cellpose model type (cyto, cyto2, cyto3, nuclei, etc.) diameter: Expected cell diameter in pixels (0 = model default) channels: Channel specification [cyto, nuclei] or None for grayscale flow_threshold: Flow error threshold (lower = more masks, may be worse quality) cellprob_threshold: Cell probability threshold (higher = fewer masks) min_size: Minimum cell size in pixels gpu: Whether to use GPU acceleration augment: Use test-time augmentation (flip/rotate) normalize: Normalize image intensities invert: Invert image intensities (for bright background) output_path: Optional path to save masks (default: image_path with _masks suffix)
Returns
Dictionary with segmentation results including cells_detected, output_path, diameter, mask_shapeInputs: image_path (required), gpu, invert, augment, +8 more. Returns: object
segment_cells_3dB
Segment cells in a 3D volume using Cellpose.
Args: image_path: Path to input 3D image stack (TIFF, etc.) model_type: Cellpose model type diameter: Expected cell diameter in pixels do_3d: Use full 3D segmentation (True) or slice + stitch (False) anisotropy: Z-axis anisotropy factor (z_pixel_size / xy_pixel_size) stitch_threshold: Threshold for stitching masks across slices (if do_3d=False) flow3d_smooth: Smoothing factor for 3D flows channels: Channel specification [cyto, nuclei] or None gpu: Whether to use GPU acceleration output_path: Optional path to save masks
Returns
Dictionary with 3D segmentation resultsInputs: image_path (required), gpu, do_3d, channels, +6 more. Returns: object
segment_cells_batchB
Segment cells in multiple images in batch.
Args: image_paths: List of paths to input images model_type: Cellpose model type diameter: Expected cell diameter in pixels output_dir: Directory to save masks (default: same as input images) gpu: Whether to use GPU acceleration batch_size: Number of images to process in parallel
Returns
Dictionary with batch processing resultsInputs: image_paths (required), gpu, diameter, batch_size, +2 more. Returns: object
train_segmentation_modelA
Train a custom Cellpose segmentation model.
Args: train_dir: Directory containing training images train_labels_dir: Directory containing training masks/labels model_name: Name for the trained model model_type: Base model type (cyto, nuclei, etc.) n_epochs: Number of training epochs learning_rate: Learning rate for training batch_size: Batch size for training test_dir: Optional directory with test images test_labels_dir: Optional directory with test labels gpu: Whether to use GPU acceleration output_dir: Directory to save trained model (default: current directory)
Returns
Dictionary with training resultsInputs: train_dir (required), model_name (required), train_labels_dir (required), gpu, +7 more. Returns: object
upsample_imageB
Upsample a microscopy image using Cellpose restoration models.
Args: image_path: Path to input image model_type: Upsampling model type (upsample_cyto2, upsample_cyto3, etc.) scale_factor: Upsampling factor (typically 2 or 4) channels: Channel specification gpu: Whether to use GPU acceleration output_path: Optional path to save upsampled image
Returns
Dictionary with upsampling resultsInputs: image_path (required), gpu, channels, model_type, +2 more. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 12 tools
Each tool targets a distinct operation: 2D/3D/batch segmentation are clearly separated by dimension and scope, restoration tools (denoise, deblur, upsample) use distinct model types, and utilities like save_masks and load_image_info are independent. There is no overlapping purpose that would cause an agent to misselect.
All tool names follow consistent snake_case with a verb_noun pattern (segment_cells_2d, denoise_image, train_segmentation_model, etc.). Naming is uniform and predictable, with clear singular verbs and no mixing of conventions.
12 tools is a well-scoped set for a cell analysis server, covering segmentation, restoration, training, model listing, estimation, and utility functions. Each tool serves a clear purpose and the count is within the ideal 3-15 range.
The surface covers core workflows (segment, restore, train, estimate, save, inspect), but there is a notable gap: after training a custom model, there is no tool to apply that model for segmentation—the segmentation tools only accept pretrained model types. This creates a dead-end in the lifecycle and limits practical use.
Maintenance
Related MCP Connectors
Image and video AI tools and your own pipelines, run from any AI assistant.
LLM chat, text tools, image generation, editing, batch image jobs, and asynchronous video generation
Use your own trained text and picture classification models from any AI assistant.
Deploy, monitor, and manage your OpenClaw AI assistants via natural language.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables AI assistants to explore computer vision datasets, execute operators, and build workflows through natural language using FiftyOne's operator framework with 80+ built-in operators and plugin management capabilities.5,093 PyPI27Apache 2.0
- AlicenseAqualityDmaintenanceEnables AI assistants to process 3D point clouds and meshes using CloudCompare through natural language commands.125MIT
- AlicenseAqualityBmaintenanceEnables AI agents to control Fiji/ImageJ for microscopy image analysis through natural language commands, supporting operations like image opening, filtering, particle analysis, and automated workflows.1939 PyPI6BSD 3-Clause
- AlicenseNot gradedqualityBmaintenanceEnables natural language interaction with complex computer vision workflows such as auto-labeling, class mapping, and embedding selection through an LLM-agnostic MCP orchestration layer.3MIT

