Cellpose MCP Server
Cellpose-mcp is a Model Context Protocol (MCP) server that enables AI assistants like Claude, Cursor IDE, etc. to perform cell segmentation through natural language commands. This tool exposes comprehensive Cellpose functionality through 13+ MCP tools, including 2D/3D segmentation, batch processing, image restoration (denoising, deblurring, upsampling), and custom model training. The system integrates seamlessly with Napari, enabling complete workflows from segmentation to interactive visualization.
📌 Note: This project started as a fun project inspired by napari-mcp and adapted for Cellpose segmentation workflows. If you would like to contribute then please get in touch with me at ssahu2@ucmerced.edu.
🚀 Quick Start
Requirements: Python 3.10, 3.11, or 3.12 and Cellpose 3.1.1.2.
Cellpose 4 does not include the restoration API used by this server. The package pins the final Cellpose 3 release until restoration has a tested replacement.
Install from PyPI:
pip install cellpose-mcp
Install and configure for Cursor in one go:
pip install cellpose-mcp && cellpose-mcp-install cursor
The installer uses the Python that runs the command (or a conda env named Cellpose_mcp if present). Restart Cursor after configuring.
Development install (from source):
git clone https://github.com/surajinacademia/cellpose_mcp.git
cd cellpose_mcp
pip install -e .
Auto-Configure Your AI Application
After pip install cellpose-mcp, run the installer for your app. It writes to the correct MCP config file using your current Python.
| Application | Command | Notes |
|---|---|---|
| Cursor IDE | cellpose-mcp-install cursor |
Writes to ~/.cursor/mcp.json |
| Claude Desktop | cellpose-mcp-install claude-desktop |
Adds to Claude Desktop config |
| Antigravity | cellpose-mcp-install antigravity |
Configures Antigravity MCP |
| VS Code (Cline/Roo Cline) | cellpose-mcp-install vscode |
Configures Cline/Roo Cline extension |
| Claude Code | Manual only | See Manual Configuration below |
Options: --python-path /path/to/python to use a specific Python; --env-name NAME to use a conda env (default: Cellpose_mcp).
Manual Configuration for Claude Code
If you prefer manual setup (or use Claude Code), create a .mcp.json file in your project root. Use the full path to your Python executable if python is not the one that has cellpose-mcp installed (e.g. a venv or conda):
{
"mcpServers": {
"cellpose": {
"command": "python",
"args": ["-m", "cellpose_mcp"],
"env": {
"KMP_DUPLICATE_LIB_OK": "TRUE",
"OMP_NUM_THREADS": "1"
}
}
}
}
For Cursor, use the same structure in ~/.cursor/mcp.json (global) or .cursor/mcp.json in your project.
After installation, restart your AI app and try asking:
"Can you list available Cellpose models?"
"Segment the cells in ./data/sample.tif using the cyto2 model"
🎯 What Can You Do?
Example: Cell Segmentation in Action
|
Original Image: Fluorescence microscopy with green-stained cytoplasm and blue-stained nuclei |
Segmented Result: Cells automatically detected with boundaries and labels |
Basic Cell Segmentation
"Segment the cells in ./data/sample.tif using the cyto2 model"
"List available Cellpose models"
"Estimate cell diameter from ./data/image.tif"
Advanced Workflows
"Segment all TIFF files in ./data/images/ and save masks to ./output/"
"Train a custom segmentation model using images in ./train/images/ and masks in ./train/masks/"
"Restore and segment the noisy image in ./data/noisy.tif using oneclick_cyto3"
Batch Processing
"Process all images in ./data/ with the cyto2 model and save results to ./output/"
🛠 Available MCP Tools
The server exposes 13+ tools for complete Cellpose functionality:
Segmentation Tools
segment_cells_2d- Segment cells in 2D imagessegment_cells_3d- Segment cells in 3D volumessegment_cells_batch- Batch process multiple images
Image Restoration Tools
denoise_image- Denoise microscopy imagesdeblur_image- Deblur microscopy imagesupsample_image- Upsample low-resolution imagesrestore_and_segment- Combined restoration + segmentation
Training Tools
train_segmentation_model- Train custom segmentation modeltrain_restoration_model- Train custom restoration model
Utility Tools
list_available_models- List all pretrained modelsestimate_cell_diameter- Estimate cell diameter from imagesave_masks- Save masks in various formatsload_image_info- Get image metadata
📖 Documentation
- Quick Start Guide - Get running in 3 steps
- Available Tools - Complete tool list
- Release Notes - Detailed v0.1.0 release information
- Changelog - Version history and changes
📋 Architecture
- FastMCP Server: Handles MCP protocol communication
- Cellpose Integration: Manages model loading and segmentation operations
- Tool Layer: Exposes Cellpose functionality as MCP tools
- File I/O: Handles image reading, writing, and mask generation
Key features:
- Thread-safe: All operations are properly serialized
- Non-blocking: Async operations for better performance
- Napari Integration: Integration with Napari for visualization and analysis
Author: Suraj Sahu
Affiliation: Department of Physics, University of California Merced, CA, USA
Email: ssahu2@ucmerced.edu
📄 License
BSD-3-Clause License - see LICENSE file for details.
🙏 Acknowledgments
- Napari MCP by royerlab
- Cellpose team for the excellent segmentation library
- FastMCP for the MCP framework
- Anthropic for Claude and MCP development
- Model Context Protocol - Open standard for AI-tool integration
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cellpose_mcp-0.1.5.tar.gz.
File metadata
- Download URL: cellpose_mcp-0.1.5.tar.gz
- Upload date:
- Size: 24.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5f33c28ed93a42a01b6957b3d096dae6b2967fcea2b9178084a9f8226602aeb4
|
|
| MD5 |
43a2fc5214b0c857906b9844082381b9
|
|
| BLAKE2b-256 |
ca2e6d9782d5c8430e3aa1a09d474b63e4570370f456f581b6184b5b9593f41d
|
Provenance
The following attestation bundles were made for cellpose_mcp-0.1.5.tar.gz:
Publisher:
publish-pypi.yml on surajinacademia/cellpose_mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cellpose_mcp-0.1.5.tar.gz -
Subject digest:
5f33c28ed93a42a01b6957b3d096dae6b2967fcea2b9178084a9f8226602aeb4 - Sigstore transparency entry: 2500263816
- Sigstore integration time:
-
Permalink:
surajinacademia/cellpose_mcp@fa94d223cd28bb9519ba5aa950f331bbbe6d1990 -
Branch / Tag:
refs/tags/v0.1.5 - Owner: https://github.com/surajinacademia
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@fa94d223cd28bb9519ba5aa950f331bbbe6d1990 -
Trigger Event:
push
-
Statement type:
File details
Details for the file cellpose_mcp-0.1.5-py3-none-any.whl.
File metadata
- Download URL: cellpose_mcp-0.1.5-py3-none-any.whl
- Upload date:
- Size: 18.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
71a6c1df7245b4cddfa655047083335b03a61956485a6e8c061611790f24470c
|
|
| MD5 |
e598377d6dda8077ebd19ff956069ebf
|
|
| BLAKE2b-256 |
54f8ccc381c1879424932931f0c7f44007af70f5e73806060a58a47a712c3f9f
|
Provenance
The following attestation bundles were made for cellpose_mcp-0.1.5-py3-none-any.whl:
Publisher:
publish-pypi.yml on surajinacademia/cellpose_mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cellpose_mcp-0.1.5-py3-none-any.whl -
Subject digest:
71a6c1df7245b4cddfa655047083335b03a61956485a6e8c061611790f24470c - Sigstore transparency entry: 2500263835
- Sigstore integration time:
-
Permalink:
surajinacademia/cellpose_mcp@fa94d223cd28bb9519ba5aa950f331bbbe6d1990 -
Branch / Tag:
refs/tags/v0.1.5 - Owner: https://github.com/surajinacademia
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@fa94d223cd28bb9519ba5aa950f331bbbe6d1990 -
Trigger Event:
push
-
Statement type: