slicer-mcp
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
slicer-eval-mcp
slicer-eval-mcp is an MCP server through which vision-language model agents operate 3D Slicer.
The model examines a volumetric scan using tools for controlling the 3D view, selecting rendering presets,
clipping, viewing slices, taking measurements and displaying segmentations. The tools do not execute model-generated
code. Every tool call is logged with its arguments, the resulting state and the images, so a session can be
audited, replayed and scored.
Its command and Python package are named slicer-mcp.

The images below show example views returned to the model: segmentation shells in 3D, an isolated structure, and sagittal and coronal slices.

MCP client ──stdio──► slicer-mcp serve --profile P ──HTTP 127.0.0.1 + token──► 3D Slicer + SlicerMCPBridge
(validates and clamps arguments, (renders 3D, axial, sagittal,
enforces the tool allowlist, writes the trace) coronal views)The current version is 0.1.0. The tool definitions are fixed for this version to support reproducible evaluations.
Features
Defined tools: Clients control Slicer through the available tools. Arbitrary code execution is not supported.
Scan formats: Load scans from DICOM folders, NIfTI files or NRRD files.
Custom task profiles: Choose the tools, image size, presets, argument bounds and optional report format for your task. Profiles make it easy to compare different evaluation settings without modifying the server.
Reproducible sessions: Traces record each tool call, its results and the profile's hashes. Use
replayto render the recorded views again, compare frames and inspect what happened during a session.Headless and parallel operation: Run evaluations on a Linux server without a screen or GPU. Run multiple Slicer instances in parallel to test different cases or models at the same time.
Related MCP server: CBCTScope MCP Server
Requirements
Linux or macOS
3D Slicer 5.10.0 (macOS: the x86_64 build). On a Linux server,
setup-headlessinstalls it for you (Headless Linux).
Install
git clone https://github.com/Maitri-Labs-Amrita/slicer-eval-mcp.git
cd slicer-eval-mcp
uv sync --inexactCreate a local runtime configuration and select it for the current shell:
cp config/runtime.json config/runtime.local.json # your copy (gitignored)
export SLICER_MCP_RUNTIME=config/runtime.local.json # every slicer-mcp command now reads itIn config/runtime.local.json, set slicer_executable to the path of your Slicer executable, for example
"/Applications/Slicer.app/Contents/MacOS/Slicer" (macOS, the default) or
"/opt/Slicer-5.10.0-linux-amd64/Slicer" (Linux). The file also sets the local port Slicer listens on
(bridge_port, 2017) and the folders for prepared cases (cases_dir) and run traces (traces_dir).
Use in a benchmark
The package includes the Slicer bridge and its helper scripts, so you can use it as a dependency in your own benchmark. Your runner manages cases and model calls, while slicer-eval-mcp provides the Slicer tools and session traces. CHD-Bench uses this structure to evaluate agents on cardiac CT and MRI scans.
For example, run the following command from your benchmark project to add slicer-eval-mcp as a dependency. Replace
<commit> with the commit you want to use so your benchmark uses a fixed version:
uv add "slicer-mcp @ git+https://github.com/Maitri-Labs-Amrita/slicer-eval-mcp@<commit>"Quick start
The steps below use a Linux desktop with Slicer installed and configured as described above. For a server without a display, first follow Headless Linux.
Start Slicer with the bridge and prepare a scan:
uv run slicer-mcp launch --profile ct_basic uv run slicer-mcp case prepare --volume /path/to/scan.nii.gzFor a DICOM folder, replace
--volume /path/to/scan.nii.gzwith--dicom /path/to/dicom_folder. The preparation command prints acase_idand alease. Keep both values for the following steps.Run the scripted client to test the tools without a model. Replace
<case_id>with the value printed above:uv run python examples/scripted_episode.py out/ <case_id> slicer_mcp/ -- \ uv run slicer-mcp serve --profile ct_basic --runtime config/runtime.local.jsonThe client starts the MCP server and calls every tool. The
ct_basicprofile excludes the five segmentation tools, so calls to those tools are rejected as expected. To connect a model, use your own runner or an MCP host as described in the following sections.Replies are saved in
out/. Session traces are saved intraces/<episode_id>/, includingsteps.jsonl, aframes/directory and the report. Theslicer_mcp/argument sets the prefix for extra fields logged with each call.When you have finished, remove the prepared case and stop Slicer. Replace
<case_id>and<lease>with the values from step 1:uv run slicer-mcp case remove <case_id> --lease <lease> uv run slicer-mcp launch --stop
Use from your own runner
For evaluations, use a runner that starts the MCP server, loads a case and forwards the model's tool calls to the
server. After running launch and case prepare, use the following example to connect the runner:
import asyncio, json
from mcp import Client, StdioServerParameters
async def main():
server = StdioServerParameters(command="uv", args=["run", "slicer-mcp", "serve", "--profile", "ct_basic",
"--runtime", "config/runtime.local.json"])
async with Client(server) as c:
tools = [t for t in (await c.list_tools()).tools
if not (t.meta or {}).get("slicer_mcp/runner_only")] # give only these to the model
await c.call_tool("reset_episode", {"case_id": "<case_id>"}) # load the case (runner only)
res = await c.call_tool("orbit", {"azimuth_deg": 30}) # a model's tool call
print(json.loads(res.content[0].text)["state"])
await c.call_tool("end_episode", {}) # close the episode (runner only)
asyncio.run(main())Each tool result contains one JSON text block with the fields step_index, state, result, warnings, error
and frames, followed by one PNG image for each view listed in frames.
The model submits its final report with submit_report, which accepts any JSON object by default. To define and
validate a custom report format, provide a report plugin with serve --report plugin.py. See
examples/report_plugin.py for an example.
Use from an MCP host
To use the server interactively in an MCP host such as Claude Desktop, VS Code or Cursor, run launch and
case prepare first. Then add the server to the host's MCP configuration. For example, add the following to
Claude Desktop's claude_desktop_config.json:
{
"mcpServers": {
"slicer": {
"command": "uv",
"args": ["--directory", "/path/to/slicer-eval-mcp", "run", "slicer-mcp", "serve",
"--profile", "ct_basic", "--runtime", "config/runtime.local.json"]
}
}
}In this configuration, the host exposes every tool to the model, including tools intended for the runner. The model
must call reset_episode with the case_id to load the case. For evaluations, use your own runner to handle these
calls and hide the runner-only tools from the model.
Tools
The ct_segments profile exposes all 22 model tools. The ct_basic profile exposes 17 tools and excludes the
segmentation tools. The full descriptions and argument schemas provided to the model are documented in
docs/tools/ct_basic.md and docs/tools/ct_segments.md.
Group | Tool | What it does |
Slices |
| Move one slice view to a position in mm along its axis |
| Scroll one slice view by a number of slices | |
| Set the grey-scale window/level of the slice views to a preset | |
| Move all three slice views through a point [R, A, S] | |
| Return the position and intensity of a pixel in a slice image | |
| Measure the distance in mm between two pixels of a slice image | |
3D view |
| Rotate the 3D camera about its focal point |
| Look at the patient from one side (anterior, left, superior, ...) | |
| Zoom the 3D view, or the slice views with | |
| Move the 3D camera's focal point to a point | |
| Change the volume-rendering preset | |
| Crop the 3D rendering to a box | |
| Cut away one side of the 3D rendering with a plane | |
| Remove the clip box or plane | |
Segmentation ( |
| Show or hide individual structure shells |
| Set the 3D opacity of one or all structure shells | |
| Show the shells alone, inside the CT, or the CT alone | |
| Turn the structure outlines on the slices on or off | |
| Centre the 3D view on chosen structures | |
Episode |
| Save the current view as evidence ( |
| Restore the initial view | |
| Submit the final report (JSON) | |
Runner only |
| Load a case and start an episode |
| Close the open episode | |
| Capture the current views without changing them |
Profiles
Use a profile to configure Slicer for your evaluation. You can choose which tools the model uses, set image sizes and argument bounds, and supply presets for slice display and volume rendering. You can also choose which segmentation structures to display and define a report format for the model's answer.
To compare evaluation settings, create a profile for each setting and select it when launching Slicer and starting the MCP server. No server changes are needed. Each trace records the profile's hashes so you can identify the configuration used in a run.
For example, CHD-Bench uses separate profiles for its full configuration, its evaluation without a 3D view and its evaluation without segmentation.
Each profile is a folder containing the following files:
File | Purpose |
| the tool allowlist, argument bounds, presets, image size and segmentation structures |
| the profile's own volume-rendering presets, added to Slicer's stock ones |
| the report format |
This repository includes two example profiles. The ct_basic profile provides 17 tools without segmentation.
The ct_segments profile provides 22 tools and displays a label map as hollow shells. For a profile that uses
segmentation, provide the label map when preparing the case:
uv run slicer-mcp case prepare --profile ct_segments --volume ct.nii.gz --labels labels.nii.gz \
--label-map 1=liver,2=spleen,3=kidney_left,4=kidney_right,5=aorta,6=pancreasTo use your own profile, pass --profile /path/to/profile. See docs/CLI.md for all commands and options.
Headless Linux
Install Slicer, Xvfb and the required libraries without sudo, then open a shell on a virtual display:
uv run slicer-mcp setup-headless # Xvfb, Slicer 5.10.0 and missing libraries, no sudo; writes config/runtime.local.json
uv run slicer-mcp xvfb-session --runtime config/runtime.local.json -- bash # a shell on a virtual displayFor parallel runs, give each job its own runtime copy with "bridge_port": "auto" and its own state file, cases and
traces folders. Frames rendered by Mesa on the CPU differ slightly from frames rendered on a GPU. Use the same
rendering hardware for runs whose frames you intend to compare.
Security
The MCP client can call the tools enabled by the profile and the runner-only tools for managing episodes. The evaluation runner is responsible for hiding runner-only tools from the model. Arbitrary code execution is not supported.
Every argument is validated against its schema and the profile's bounds; out-of-range values are clamped, with a warning in the result.
The bridge listens only on 127.0.0.1 and requires the token generated for the current launch.
You are responsible for de-identifying scans before use, including any identifying text burned into the images.
Report plugins (
serve --report) execute Python code in the server. Use only plugins you trust.
Tests
Run the unit tests without Slicer. The live tests require a running Slicer instance started with launch and the
SLICER_MCP_TEST_VOLUME environment variable set to the path of a CT file, such as a NIfTI file.
uv run pytest -q # unit tests, no Slicer
uv run pytest -m slicer tests/slicer # live tests: a running launch and SLICER_MCP_TEST_VOLUME=<a CT file, e.g. NIfTI>See CONTRIBUTING.md.
License
This repository is licensed under Apache-2.0. See LICENSE.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Permission checks, human approval cards, and signed audit trails for AI agent tool calls.
Plan, run and inspect AI-agent drills with synthetic users, hosted tools and cloud worlds.
See, price, and control every tool call your AI agents make: policy checks, cost, and audit tools.
Build, validate, and deploy multi-agent AI solutions from any AI environment.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceProvides AI-powered medical image analysis tools for LLM agents, enabling tasks such as X-ray classification, interactive segmentation, and visual question answering. It supports multi-step diagnostic reasoning and clinical workflows through a suite of specialized medical AI models.1MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to control a local CBCT viewer for dental and maxillofacial scans, with navigation verbs like open scan, set window, navigate slices, and snapshot, without executing code or returning interpretations.9AGPL 3.0
- AlicenseNot gradedqualityBmaintenanceEnables AI coding agents to perform end-to-end medical image analysis locally, from inspecting CT/MRI/X-ray studies and running containerized segmentation models like MedSAM2, TotalSegmentator, and HD-BET to refining masks, measuring volumes, and writing reports. It pairs preset or custom guideline protocols with a code-customizable viewer that renders images back to agents as annotated PNGs and to humans as interactive HTML.2Apache 2.0
- AlicenseAqualityCmaintenanceLets agents see and drive a live 3D application session through its addon socket: viewport screenshots, turntable and multi-mode renders, scene and object inspection, arbitrary Python execution, GLB import/export and asset validation, plus rig, pose-deformation and silhouette-likeness checks. This lets an agent visually judge a 3D result instead of guessing.25MIT