cyto-mcp
A Model Context Protocol (MCP) server that brings flow cytometry analysis to any MCP-capable AI assistant — locally, privately, and for free.
Why cyto-mcp?
Flow cytometry analysis (FCS files, gating, compensation, clustering) is tedious, error-prone, and hard to script. cyto-mcp lets an AI assistant like Claude or GitHub Copilot drive the entire analysis pipeline through natural language — while keeping every byte of your data on your own machine.
Cloud LLM ──HTTPS──► MCP Client (Claude Desktop / VS Code / Cursor)
│ stdio / local HTTP
▼
cyto-mcp server ──► FCS files on your disk
No data leaves your machine. The LLM only sees compact summaries, statistics, and images that the server sends back.
Features
| Category | Tools |
|---|---|
| File I/O | List, load, validate FCS files; read FCS keywords |
| Preprocessing | Apply compensation matrix; Logicle / asinh / biexp transform |
| Subsampling | Reproducible down-sampling for fast exploration |
| Statistics | Per-channel percentile stats; cross-sample comparison |
| Gating | Rectangle and threshold gates; population frequency & MFI |
| Visualization | Scatter plots and histograms — returned as PNG + structured JSON |
Quality control (time-drift, saturation flagging), polygon/ellipse gates, reporting, and clustering (FlowSOM, UMAP) are planned for v0.2.
Quickstart
Prerequisites
- Python 3.11+
- An MCP-capable client: Claude Desktop, VS Code + GitHub Copilot, or Cursor
Install from PyPI (recommended)
pip install cyto-mcp
cyto-mcp --help # verify it works
Or with uv (faster, isolated):
uv tool install cyto-mcp
cyto-mcp --help
Install from source (for contributors / development)
git clone https://github.com/luangxiao/cyto-mcp.git
cd cyto-mcp
uv sync # creates .venv and installs all deps
uv run cyto-mcp --help # verify it works
Configure your MCP client
Claude Desktop — edit claude_desktop_config.json:
{
"mcpServers": {
"flow": {
"command": "cyto-mcp",
"args": ["serve", "--data-dir", "/path/to/your/fcs/files"]
}
}
}
VS Code — create .vscode/mcp.json in your workspace:
{
"servers": {
"flow": {
"type": "stdio",
"command": "cyto-mcp",
"args": ["serve", "--data-dir", "/path/to/your/fcs/files"]
}
}
}
Note for VS Code: if
cyto-mcpis not on VS Code's PATH, use the full path to the executable (e.g.C:/Users/you/AppData/Roaming/Python/Scripts/cyto-mcp.exeon Windows, or runwhich cyto-mcpon macOS/Linux to find it).
Try it
In your AI assistant, ask:
"List FCS files in my data directory and load the first one. Show me the panel channels and a scatter plot of FSC-A vs SSC-A."
Architecture
See ARCHITECTURE.md for a detailed description of the codebase layout, design decisions, and extension guide.
src/cyto_mcp/
├── server.py # FastMCP app wiring and startup
├── cli.py # click CLI entry point (`cyto-mcp serve`)
├── config.py # Pydantic settings (data-dir, output-dir, cache size)
├── errors.py # Typed error hierarchy
├── cache.py # LRU in-memory sample cache
├── tools/
│ ├── io.py # load_fcs, list_fcs, fcs_keywords, validate_fcs
│ ├── preprocess.py # apply_compensation, transform, subsample
│ ├── stats.py # channel_stats, compare_samples
│ ├── gating.py # gate_rectangle, gate_threshold, population_stats
│ └── plots.py # scatter_plot, histogram
└── utils/
├── image.py # fig → PNG bytes helper
└── paths.py # safe path resolution within data-dir sandbox
Design principles
- Data never leaves the machine. The server only reads files from the configured
--data-dirand writes outputs to--output-dir. No network calls. - Return references, not raw data. Large artefacts (PNG plots, reports) are written to disk and referenced by URI. Tool responses stay small enough to fit in any context window.
- Dual return for plots. Every plot tool returns both a PNG image (for the human) and a structured JSON summary (for the LLM to reason about numerically).
- Sandboxed file access. All path arguments are resolved relative to
--data-dirand validated to prevent path traversal attacks. - Stateless tools, stateful cache. Each tool call is self-contained; the LRU sample cache is an optimisation, not a requirement for correctness.
Community & Discussion
I'm a solo developer building this in my spare time — I'd genuinely love to hear from you, whether you're a researcher, clinician, bioinformatician, or just curious.
- Questions / ideas? → open a Discussion — no question is too basic.
- Found a bug? → open an Issue with steps to reproduce.
- Want to share a use-case or analysis workflow? → post it in Show and Tell, I genuinely enjoy seeing real-world applications.
Contributing
All contributions are welcome — from typo fixes to new tools. Here's how to get started:
- Fork the repository and clone it locally
- Create a feature branch:
git checkout -b feat/my-feature - Install dev dependencies:
uv sync --extra dev - Run tests:
uv run pytest - Lint:
uv run ruff check src tests - Open a pull request with a clear description of what and why
For anything non-trivial, please open an issue or discussion first so we can align on approach before you invest time coding. I'll do my best to review PRs promptly and give constructive feedback.
License
Apache 2.0 — see LICENSE.
Metadata
Release files for cyto-mcp 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cyto_mcp-0.2.0.tar.gz | 196.6 kB | Without provenance | Details for cyto_mcp-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cyto_mcp-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for cyto_mcp-0.2.0-py3-none-any.whl |
Total release size: 230.4 kB
Release files / cyto_mcp-0.2.0.tar.gz
| Download URL | cyto_mcp-0.2.0.tar.gz |
|---|---|
| Size | 196.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4f9a086ad732ef7dd96caebe8fdded90c44bdbab5d5007e08cc848e998e842d1
|
|
BLAKE2b-256 checksum How to use checksums |
7932028b1fc6943776007088daf517971fa31483a6fc5e9addd3a11d2d3da99d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / cyto_mcp-0.2.0-py3-none-any.whl
| Download URL | cyto_mcp-0.2.0-py3-none-any.whl |
|---|---|
| Size | 33.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9f4b5d0f9f94c91da89e0300dcd2ecca9514a534558b398db0a7c320c9fd253f
|
|
BLAKE2b-256 checksum How to use checksums |
e3a47e8e559b1cd14c1200c81cad2dfb355ae3836851b1c964ac2fabef36b4f3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for cyto-mcp 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.