cooler-mcp
LocalA Model Context Protocol (MCP) server that exposes Cooler (open2c/cooler — Hi-C contact matrix toolkit) for use with Claude or any MCP-compatible client.
Add to your MCP Client
Add the following to your claude_desktop_config.json (or equivalent MCP config file):
{
"mcpServers": {
"cooler-mcp": {
"command": "uv",
"args": [
"run",
"--directory",
"/absolute/path/to/cooler-mcp",
"main.py"
]
}
}
}Cooler MCP Server
A Model Context Protocol (MCP) server that exposes Cooler (open2c/cooler — Hi-C contact matrix toolkit) for use with Claude or any MCP-compatible client.
Tools
| Tool | Description |
|---|---|
check_cooler_installed | Check whether cooler is on PATH and return its version |
install_cooler | Install cooler via pip on macOS or Linux |
install_cooler_windows | Install cooler on Windows via WSL + pip |
uninstall_cooler | Uninstall cooler via pip on macOS or Linux |
cooler_info | Display metadata and info about a .cool or .mcool file |
cooler_ls | List all cooler URIs (resolutions) inside a .cool or .mcool file |
cooler_dump | Dump pixels, bins, or chroms table to a TSV file (background) |
cooler_balance | Run iterative correction (matrix balancing) in-place (background) |
cooler_zoomify | Generate a multi-resolution .mcool file from a base .cool (background) |
cooler_merge | Merge multiple cooler files with identical axes (background) |
cooler_cload | Create a .cool file from a pairs file and bins specification (background) |
cooler_makebins | Generate fixed-width genomic bins from a chromsizes file (synchronous) |
cooler_coarsen | Coarsen a cooler to a lower resolution by a given factor (background) |
cooler_report | Generate a self-contained HTML Hi-C QC report (synchronous) |
check_job_status | Poll the status of a background cooler job |
list_jobs | List all background jobs submitted in the current session |
Background execution: Long-running operations (
cooler_dump,cooler_balance,cooler_zoomify,cooler_merge,cooler_cload,cooler_coarsen) run in the background and return ajob_idimmediately — no timeout risk for large files. Callcheck_job_status(job_id)to poll until the job is"completed"or"failed".
cooler_info,cooler_ls,cooler_makebins, andcooler_reportrun synchronously and return results directly.
Requirements
- Python 3.13+
- uv
- macOS / Linux:
pip install cooler - Windows: WSL — run
wsl --installin PowerShell as Administrator, then restart your computer
Local Setup
1. Clone the repository
git clone https://github.com/JesKwek/cooler-mcp.git
cd cooler-mcp
2. Add to Claude Desktop
Open your Claude Desktop config file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
Add the following — replace the path with the actual location where you cloned the repo:
{
"mcpServers": {
"cooler-mcp": {
"command": "uv",
"args": [
"run",
"--directory",
"/absolute/path/to/cooler-mcp",
"main.py"
]
}
}
}
Save the file and restart Claude Desktop. The cooler tools will be available in your next conversation.
Usage Examples
1. Check if cooler is installed
"Is cooler installed on my system?"
See JSON output
Found:
{
"installed": true,
"path": "/usr/local/bin/cooler",
"version": "cooler, version 0.10.2",
"via_wsl": false,
"error": null
}
Not found:
{
"installed": false,
"path": null,
"version": null,
"via_wsl": false,
"error": null
}
2. Install cooler on macOS or Linux
"Install cooler on my Mac."
"Install cooler on my Linux machine."
Claude will use pip to install the cooler package into the current Python environment.
See JSON output
{
"success": true,
"message": "Cooler installed successfully. Binary at: /usr/local/bin/cooler",
"version": "Successfully installed cooler-0.10.2",
"error": null
}
3. Install cooler on Windows
"Install cooler on Windows."
Cooler is installed on Windows through WSL (Windows Subsystem for Linux). If WSL is not yet set up, Claude returns step-by-step instructions.
See JSON output
WSL not installed:
{
"success": false,
"message": "WSL (Windows Subsystem for Linux) is not installed.\n\nTo install WSL:\n1. Open PowerShell or Command Prompt as Administrator\n2. Run: wsl --install\n3. Restart your computer when prompted\n4. After restart, WSL will finish setting up...",
"error": "WSL not installed"
}
Success:
{
"success": true,
"message": "Cooler installed successfully inside WSL via pip.",
"error": null
}
4. Inspect a .cool or .mcool file
"Show me the metadata for /data/contacts.cool"
"What resolutions are available in /data/contacts.mcool?"
See JSON output — cooler_info
{
"success": true,
"output": "{\n \"bin-size\": 10000,\n \"bin-type\": \"fixed\",\n \"genome-assembly\": \"hg38\",\n \"nchroms\": 25,\n \"nbins\": 318535,\n \"nnz\": 48291034\n}",
"error": null
}
See JSON output — cooler_ls
{
"success": true,
"uris": [
"/resolutions/1000",
"/resolutions/5000",
"/resolutions/10000",
"/resolutions/25000"
],
"output": "/resolutions/1000\n/resolutions/5000\n/resolutions/10000\n/resolutions/25000",
"error": null
}
5. Create a .cool file from pairs (background)
"Create a cooler from /data/sample.pairs.gz using bins at 10 kb resolution with hg38 chromsizes."
See JSON output
Job started:
{
"job_id": "a3f8b201",
"pid": 61200,
"status": "running",
"message": "cload (pairix) started in the background. Call check_job_status('a3f8b201') to monitor progress.",
"output_cool": "/data/sample.10kb.cool",
"format": "pairix",
"error": null
}
6. Generate a multi-resolution .mcool file (background)
"Zoomify /data/sample.10kb.cool into an .mcool with resolutions 1000, 5000, 10000, 25000."
See JSON output
Job started:
{
"job_id": "d92c4e77",
"pid": 61400,
"status": "running",
"message": "Zoomify started in the background. Call check_job_status('d92c4e77') to monitor progress.",
"output_path": "/data/sample.mcool",
"error": null
}
Polling — complete:
{
"job_id": "d92c4e77",
"status": "completed",
"pid": 61400,
"operation": "cooler_zoomify",
"started_at": "2024-06-01T12:00:00",
"stderr": null,
"error": null
}
7. Run matrix balancing (background)
"Balance /data/sample.10kb.cool using 4 processes."
See JSON output
{
"job_id": "f1b9a034",
"pid": 61550,
"status": "running",
"message": "Balancing started in the background. Call check_job_status('f1b9a034') to monitor progress.",
"cool_uri": "/data/sample.10kb.cool",
"error": null
}
8. Dump pixels to TSV (background)
"Dump all cis pixels from /data/sample.10kb.cool to /data/pixels.tsv"
"Extract chr1 contacts from /data/sample.mcool::10000 into /data/chr1.tsv"
See JSON output
{
"job_id": "b4e70c11",
"pid": 61700,
"status": "running",
"message": "Dump started in the background. Call check_job_status('b4e70c11') to monitor progress.",
"output_path": "/data/pixels.tsv",
"error": null
}
9. Generate a Hi-C QC HTML report
"Generate a QC report for /data/sample.mcool::10000 and save it to /data/report.html"
Produces a self-contained HTML file with summary metrics, cis/trans breakdown, distance decay curve, per-chromosome contact density, and an interactive contact matrix heatmap for a representative chromosome.
See JSON output
{
"success": true,
"output_html": "/data/report.html",
"sample": "sample",
"genome": "hg38",
"resolution": 10000,
"total_contacts": 482910340,
"cis_ratio": 0.8312,
"qc_summary": "Excellent library quality (cis ratio ≥80%): 83.1%\nDistance decay shows expected power-law behaviour.\nNo chromosomes with unusually high or low contact density detected.",
"error": null
}
10. List all background jobs
"Show me all cooler jobs running right now."
See JSON output
{
"jobs": [
{
"job_id": "d92c4e77",
"status": "running",
"operation": "cooler_zoomify",
"pid": 61400,
"started_at": "2024-06-01T12:05:00",
"cool_uri": "/data/sample.10kb.cool",
"output_path": "/data/sample.mcool"
},
{
"job_id": "a3f8b201",
"status": "completed",
"operation": "cooler_cload",
"pid": 61200,
"started_at": "2024-06-01T12:00:00",
"cool_uri": null,
"output_path": "/data/sample.10kb.cool"
}
],
"total": 2
}
Background Job Workflow
cooler_dump / cooler_balance / cooler_zoomify /
cooler_merge / cooler_cload / cooler_coarsen
│
▼
returns job_id ←── no timeout risk
│
▼
check_job_status(job_id)
│
status = "running"? ──► poll again later
│
status = "completed" ──► output file is ready
status = "failed" ──► check stderr field
cooler_info / cooler_ls / cooler_makebins / cooler_report
│
▼
returns result inline ←── synchronous, typically fast
Note: The job registry is in-memory. Jobs are lost if the MCP server process restarts. Always call
check_job_statusin the same session that launched the job.
cooler_cload Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
pairs_path | str | required | Path to the input pairs file |
bins_path | str | required | BED bins file, or chromsizes:resolution string e.g. /path/hg38.chrom.sizes:10000 |
output_cool | str | required | Destination .cool file path |
assembly | str | "" | Genome assembly name stored in cooler metadata |
format | str | "pairix" | cload sub-command: "pairix", "tabix", or "pairs" |
chrom1_col | int | 2 | 1-based column index of chrom1 (used by pairs format) |
pos1_col | int | 3 | 1-based column index of pos1 (used by pairs format) |
chrom2_col | int | 4 | 1-based column index of chrom2 (used by tabix/pairs) |
pos2_col | int | 5 | 1-based column index of pos2 (used by tabix/pairs) |
extra_flags | str | "" | Additional cooler cload flags |
cooler_zoomify Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
cool_uri | str | required | Input cooler URI |
output_path | str | required | Destination .mcool file path |
resolutions | str | "" | Comma-separated resolutions e.g. "1000,5000,10000". Omit to use cooler defaults |
balance | bool | true | Run matrix balancing at each resolution |
nproc | int | 1 | Number of parallel processes for balancing |
extra_flags | str | "" | Additional cooler zoomify flags |
Platform Support
| Platform | Status |
|---|---|
| macOS | Tested — installs via pip |
| Windows | Supported via WSL — tested on Windows 10/11 with WSL2 |
| Linux | Supported — installs via pip (not yet tested) |