Relion Mcp Server — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited Relion Mcp Server (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
An MCP (Model Context Protocol) server that lets AI agents drive RELION 5.x — the gold-standard software for cryo-EM structure determination.
Tested and verified against RELION 5.0.1 on Ubuntu 24.04 (WSL2). All CLI flags validated against actual --help output.An AI agent (Claude Code, OpenClaw, NemoClaw, etc.) can process cryo-EM data through natural language:
You: "Import the movies from Movies/*.tiff, 200 kV, pixel size 0.885 Å, then run motion correction"
Agent: → relion_import(..., confirm=False) → shows parameter preview
You: "Looks good, launch it"
Agent: → relion_import(..., confirm=True) → job runs (instant)
→ relion_motioncorr(..., confirm=False) → preview
You: "Ok go"
Agent: → relion_motioncorr(..., confirm=True) → 🚀 Launched (PID 12345)
→ relion_job_status("MotionCorr/job001") → 🔄 RUNNING
→ relion_job_status("MotionCorr/job001") → ✅ COMPLETEDThe server exposes 42 tools covering the complete single-particle analysis pipeline, the RELION 5 tomography (subtomogram-averaging) pipeline, results-interpretation tools that let an agent make its own decisions, and STAR/image utilities.
Every pipeline tool: confirm=False shows all parameters (✏️ user / 📋 tutorial default / ❌ missing / ⬜ optional), confirm=True launches the job.
All long-running jobs launch via detached Popen and return immediately with PID. Monitor with relion_job_status and relion_job_logs.
Class2D, InitialModel, Class3D, and Refine3D all expose --gpu for GPU acceleration.
RELION 5's neural-network prior is available on Class3D and Refine3D via use_blush=True.
Class2D and InitialModel support the VDAM gradient algorithm via use_vdam=True, with MPI=1 validation.
relion_help runs relion_* --help in real time with keyword filtering.
Every launched job is registered in the project's default_pipeline.star — with the correct RELION 5 process/node type labels, live status, and input/output edges — so a project driven by this server opens cleanly in the RELION GUI with a connected job graph. Best-effort and atomic; disable with RELION_WRITE_PIPELINE=0.
The full RELION 5 STA numerical pipeline — import tilt series, reconstruct tomograms, extract pseudo-subtomograms, reconstruct particle, tomo CTF-refine and frame-align — is exposed as dedicated relion_tomo_* tools that build on the tomography optimisation-set data model and register with the correct tomo pipeline labels.
Instead of forcing the agent to hand-parse STAR files, relion_job_results returns the metrics that actually drive the next decision (resolution, ranked class distributions), relion_select_classes acts on them numerically, and relion_render_classes lets a vision-capable agent see the 2D classes. Failed jobs come back with an actionable hint rather than a raw traceback.
AI Agent (Claude Code / OpenClaw / NemoClaw)
│
│ stdio or HTTP
▼
RELION MCP Server v3 (Python)
│
│ Popen (detached) subprocess.run (short jobs)
▼ ▼
RELION 5.x binaries relion_import, relion_help
(background, non-blocking) (synchronous, fast)| Tool | Binary |
|---|---|
relion_import | relion_import |
relion_motioncorr | relion_run_motioncorr |
relion_ctffind | relion_run_ctffind |
relion_autopick | relion_autopick |
relion_extract | relion_preprocess |
relion_class2d | relion_refine |
relion_select | relion_class_ranker |
relion_initial_model | relion_refine --denovo_3dref |
relion_class3d | relion_refine |
relion_refine3d | relion_refine |
relion_mask_create | relion_mask_create |
relion_postprocess | relion_postprocess |
relion_ctf_refine | relion_ctf_refine |
relion_bayesian_polishing | relion_motion_refine |
relion_blush | relion_python_blush |
relion_local_resolution | relion_postprocess --locres |
relion_modelangelo | relion_python_modelangelo |
| Tool | Description |
|---|---|
relion_project_info | Project overview |
relion_read_star | Parse STAR files (multi-block aware) |
relion_job_status | Job status + PID detection + stderr tail |
relion_job_logs | Read stdout/stderr from background jobs |
relion_suggest_next_step | Recommend next step (15-step pipeline) |
relion_run_command | Run any relion_* binary (escape hatch) |
relion_help | Parse --help output from any RELION binary |
| Tool | Description |
|---|---|
relion_wait_for_job | Wait for a background job to finish and return its final status plus its metrics. Declared as an MCP task |
relion_abort | Stop a running background job (RELION_JOB_ABORT_NOW + SIGTERM to the process group) |
Based on the RELION 5 subtomogram-averaging tutorial. 3D refinement/classification of the pseudo-subtomograms reuses the existing relion_class3d / relion_refine3d tools.
| Tool | Binary |
|---|---|
relion_tomo_import | relion_tomo_import_tomograms |
relion_tomo_import_coords | relion_tomo_import_particles |
relion_tomo_reconstruct_tomogram | relion_tomo_reconstruct_tomogram |
relion_tomo_subtomo | relion_tomo_subtomo (make pseudo-subtomograms) |
relion_tomo_reconstruct_particle | relion_tomo_reconstruct_particle |
relion_tomo_ctf_refine | relion_tomo_refine_ctf |
relion_tomo_align | relion_tomo_align (frame align / Bayesian polishing) |
relion_tomo_suggest_next_step | (read-only) STA pipeline progress |
Tilt-series alignment (AreTomo2/IMOD), denoising (cryoCARE) and template-match picking are external-tool steps in RELION 5 and are not wrapped as dedicated tools — run them with their native tools or via relion_run_command. The RELION-native numerical path (import → reconstruct particle, plus tomo CTF-refine and frame-align) is fully covered.>
Tomo flags are taken from the RELION 5 reference docs (generated from each program's--help) but were not validated against a live binary; verify withrelion_help(program="relion_tomo_…")on your build if a run fails.
Turn the agent from a blind operator into a decision-maker: read metrics and select classes without hand-parsing STAR files.
| Tool | Description |
|---|---|
relion_job_results | Auto-detect job type and return key metrics — PostProcess resolution + B-factor, Refine3D current resolution, Class2D/3D per-class distribution & estimated resolution (ranked), CtfFind/MotionCorr stats |
relion_select_classes | Select 2D/3D classes by numeric criteria (rlnClassDistribution ≥, rlnEstimatedResolution ≤, or explicit list) and write a particles.star — deterministic complement to relion_select |
relion_render_classes | Render a .mrcs class-averages stack as a PNG montage returned inline, so a vision-capable agent can see which classes are good (needs numpy + pillow) |
| Tool | Binary |
|---|---|
relion_star_handler | relion_star_handler (select/filter/join/drop columns) |
relion_image_handler | relion_image_handler (rescale, resize, low/high-pass, B-factor) |
relion_subtract | relion_particle_subtract (partial signal subtraction) |
relion_symmetry_expand | relion_particle_symmetry_expand |
relion_tomo_latest_optimisation_set | (read-only) locate the newest tomo optimisation_set.star |
Also: relion_read_star now has a summary=true mode returning per-column count/min/mean/max instead of dumping rows, and job errors come with an actionable Hint (out-of-memory, GPU, missing path, MPI, STAR-label, binary-not-found).
All defaults match the RELION 5 beta-galactosidase tutorial:
| Step | Key defaults |
|---|---|
| Import | 200 kV, 0.885 Å, Cs 1.4, Q0 0.1 |
| MotionCorr | dose 1.277, patches 5×5, bfactor 150, float16, save_ps |
| CTF | Box 512, 30-5 Å, dF 5000-50000, dAst 100, use_given_ps=True |
| AutoPick | LoG, 150-180 Å, upper_threshold=5, maxres=20 |
| Extract | box 256 → 64, invert, bg_radius 200 |
| Class2D | K=50, T=2, mask 200, CTF, center |
| InitialModel | VDAM 100 mini-batches, T=4, C1 + apply_sym_later |
| Class3D | K=4, T=4, C1, ini_high 50, healpix 2 |
| Refine3D | D2, ini_high 50, MPI=3 (odd≥3), pool 30 |
| Mask | lowpass 15, threshold 0.01, extend 3, soft_edge 8 |
| PostProcess | auto B-factor, autob_lowres 10 |
| CTF Refine | All flags off by default (multi-pass workflow) |
| Polishing | Train/Polish modes, sigma vel/div/acc, float16 |
PATHrequirements.txt): pip install -r requirements.txtmcp SDK and uvicorn for HTTP mode)git clone https://github.com/kdursunnizam-art/relion-mcp-server.git
cd relion-mcp-server
pip install -r requirements.txtOptionally, use a virtual environment (recommended for HTTP mode):
cd relion-mcp-server
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt#### stdio (local) From your terminal:
claude mcp add-json relion '{"command":"python3","args":["/path/to/relion-mcp-server/relion_mcp.py"],"env":{"RELION_PROJECT_DIR":"/path/to/data/relion_tutorial"}}' --scope userVerify:
claude mcp listRemove / reconfigure:
claude mcp remove relionNote: --scope user makes the server available in all your projects.
#### HTTP (remote) — EXPERIMENTAL
cd /path/to/relion-mcp-server
source venv/bin/activate
export RELION_PROJECT_DIR=/path/to/data/relion_tutorial
python relion_mcp.py --transport http --port 8000 --host 0.0.0.0Keep this terminal open.
claude mcp add --transport http relion http://YOUR.IP.ADDRESS:8000/mcp --scope userclaude mcp listIt should show relion with the HTTP transport and URL http://YOUR.IP.ADDRESS:8000/mcp.
Then in Claude Code:
> Use relion_project_info to show the project status
> Import movies from Movies/*.tiff with pixel size 0.885, 200 kV, Cs 1.4
> Run motion correction with dose 1.277 e-/Ų/frame and gain ref Movies/gain.mrc
> Show me the Class2D parameters before running (agent calls with confirm=False)
> Change threads to 8 and launch (agent calls with confirm=True)Claude Desktop only supports stdio servers via manual config. Edit claude_desktop_config.json:
%APPDATA%\Claude\claude_desktop_config.json~/Library/Application Support/Claude/claude_desktop_config.json{
"mcpServers": {
"relion": {
"command": "python3",
"args": ["/path/to/relion-mcp-server/relion_mcp.py"],
"env": {
"RELION_PROJECT_DIR": "/path/to/data/projet_relion",
"RELION_THREADS": "4",
"RELION_MPI": "1"
}
}
}
}On Windows with WSL2, set "command": "wsl" and prepend python3 to args:
{
"mcpServers": {
"relion": {
"command": "wsl",
"args": ["python3", "/home/you/relion-mcp-server/relion_mcp.py"],
"env": { "RELION_PROJECT_DIR": "/home/you/relion_tutorial" }
}
}
}Restart Claude Desktop after editing the config.
#### stdio (local)
openclaw mcp add --transport stdio --scope user relion --cmd python3 --args "/path/to/relion-mcp-server/relion_mcp.py" --env RELION_PROJECT_DIR="/path/to/data/relion_tutorial"Verify:
openclaw mcp list#### HTTP (remote) Start the server:
cd /path/to/relion-mcp-server
source venv/bin/activate
export RELION_PROJECT_DIR=/data/my_project
python relion_mcp.py --transport http --port 8000 --host 0.0.0.0Register:
openclaw mcp add --transport http --scope user relion http://YOUR.IP.ADDRESS:8000/mcpOr configure openclaw.json manually (both stdio and HTTP):
{
"skills": {
"install": { "nodeManager": "npm" },
"entries": {
"mcp-integration": {
"enabled": true,
"config": {
"servers": [
{
"name": "relion-stdio",
"transport": "stdio",
"command": "python3",
"args": ["/path/to/relion-mcp-server/relion_mcp.py"],
"env": { "RELION_PROJECT_DIR": "/path/to/data/projet_relion" }
},
{
"name": "relion-http",
"transport": "streamable-http",
"url": "http://YOUR.IP.ADDRESS:8000/mcp"
}
],
"toolPrefix": true
}
}
}
}
}| Environment Variable | Description | Default |
|---|---|---|
RELION_PROJECT_DIR | RELION project directory | Current directory |
RELION_BIN | Path prefix for RELION binaries | (uses PATH) |
RELION_THREADS | Default thread count | 4 |
RELION_MPI | Default MPI processes | 1 |
RELION_CONFINE_PATHS | If 1, reject any file path that resolves outside the project dir | 0 (off) |
RELION_WRITE_PIPELINE | If 1, register jobs in default_pipeline.star for RELION GUI integration | 1 (on) |
| CLI Flag | Description | Default |
|---|---|---|
--transport | stdio or http | stdio |
--port | HTTP port | 8000 |
--host | HTTP host (use 0.0.0.0 for remote access) | 127.0.0.1 |
--project-dir | Override RELION_PROJECT_DIR | (env or cwd) |
relion_* executables can be run (validated)subprocess.run with an argument list (no shell=True). Background jobs run through a generated run.sh, but every argument and path is escaped with `shlex.quote`, so filenames containing spaces or shell metacharacters are passed literally and can never be executed.RELION_CONFINE_PATHS=1 to additionally reject any path that resolves outside the project directory (off by default, since raw movies/gain refs often live on a separate scratch disk).127.0.0.1 by default. For remote access set --host 0.0.0.0 — the server then prints a warning, because this exposes tools that can launch RELION binaries (including relion_run_command). Only do this on a trusted, firewalled network, ideally behind an authenticating reverse proxy.relion_abort can stop a running job.Built on standalone [FastMCP](https://github.com/PrefectHQ/fastmcp) 4.x (fastmcp[tasks]>=4.0), which targets the current MCP specification 2026-07-28 (stateless core, extensions framework).
from fastmcp import FastMCP.title alongside its machine name.relion_job_results returns structured output (structuredContent + outputSchema).relion_wait_for_job, relion_run_command, relion_import) use the`io.modelcontextprotocol/tasks` extension: the client receives a durable task handle and polls tasks/get instead of holding a request open for hours. Requires the [tasks] extra; without it those tools degrade to ordinary blocking calls.
mcp.run(transport="stdio") or mcp.run(transport="streamable-http", host=..., port=...).async and take a single Pydantic model parameter; FastMCP builds the JSON schema from it.python3 -m py_compile cleanly and the tests/ suite (pytest).Migrated from the FastMCP 1.x bundled inside the officialmcpSDK (mcp.server.fastmcp). That module was removed when the official SDK reached 2.0 (renamed toMCPServer), so this server now depends on the standalone package instead.
name).relion_job_results now returns structuredContent with anoutputSchema instead of a Markdown string.
io.modelcontextprotocol/tasks) enabled, plus a newrelion_wait_for_job tool — the natural fit for refinements that run for hours.
relion_job_results (auto-detecting metrics extractor: resolution, per-class distribution/estimated-resolution ranking, CTF/motion stats), relion_select_classes (deterministic numeric class selection → particles.star), and relion_render_classes (2D class-average montage returned as an inline image).relion_star_handler, relion_image_handler, relion_subtract (signal subtraction), relion_symmetry_expand.relion_read_star summary mode (per-column stats), and relion_tomo_latest_optimisation_set.numpy + pillow (only for relion_render_classes).relion_tomo_import, relion_tomo_import_coords, relion_tomo_reconstruct_tomogram, relion_tomo_subtomo, relion_tomo_reconstruct_particle, relion_tomo_ctf_refine, relion_tomo_align, relion_tomo_suggest_next_step), following the RELION 5 subtomogram-averaging tutorial. Flags taken from the RELION 5 reference docs.default_pipeline.star integration with authoritative tomo labels (relion.importtomo, relion.pseudosubtomo, relion.ctfrefinetomo, relion.framealigntomo, …). 33 tools total.from fastmcp import FastMCP, fastmcp>=3.0) — the actively-developed, community-standard framework — replacing the FastMCP 1.x bundled in the official mcp SDK (removed in SDK 2.0). Tool schemas, annotations and behaviour are unchanged; host/port are now passed to mcp.run(...).run.sh is now generated with shlex.join/shlex.quote, closing a shell-injection hole and fixing jobs breaking on paths/filenames containing spaces.relion_read_star now parses all data blocks and selects the correct one (auto-picks the main table, or an explicit data_particles/particles). Previously it merged data_optics + data_particles and returned garbage on standard particle files.default_pipeline.star (processes, nodes, input/output edges) so jobs created by this server appear — correctly typed, connected, and status-tracked — when the project is opened in the RELION GUI. Label strings are taken verbatim from RELION 5 src/pipeline_jobs.h. Writes are atomic (.bak kept), merge-safe with existing pipelines, and best-effort (never block a launch). Toggle with RELION_WRITE_PIPELINE=0.job001, job002, …), matching RELION's own scheme.relion_select (auto class selection via relion_class_ranker) and relion_abort (stop a running job).RELION_CONFINE_PATHS, PID-file based liveness (no more pgrep), unauthenticated-HTTP warning on non-local bind.mcp>=1.26,<2.0, added a pytest suite. 25 tools total.--gpu) on Class2D, InitialModel, Class3D, Refine3D--pool, --preread_images, --scratch_dir, --skip_paddingrelion_local_resolution, relion_modelangeloPopen(start_new_session=True) and return immediately with PID. No more agent blocking.relion_* --help and parse all flags live, with keyword filteringrun.sh) in each job_dir auto-creates SUCCESS/FAILURE markersrelion_initial_model, relion_mask_create, relion_ctf_refine, relion_bayesian_polishing, relion_helpMIT — RELION itself is GPLv2. This server interacts with RELION solely through its CLI.
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.