dicom-agent-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@dicom-agent-mcp Retrieve patient Smith's latest CT study and render the first image."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
dicom-agent-mcp
An MCP (Model Context Protocol) server that gives AI agents one set of tools for both DIMSE archives (C-ECHO, C-FIND, C-GET, C-MOVE, C-STORE) and DICOMweb archives (QIDO-RS, WADO-RS, STOW-RS).
It also includes pixel and geometry tools that work on local files: rendering, statistics, measurement, geometry checks, multiplanar reconstruction (MPR) and de-identification. This is the tool layer for Topic 3 (Validated Tool Execution). The verification loop comes later; see ROADMAP.md.
Not for clinical use. This is a research scaffold. Use only with test or de-identified data.
Tools
Tool | DIMSE node | DICOMweb node | Notes |
| – | – | Lists configured nodes; secrets are never returned |
| C-ECHO |
| Connectivity check |
| C-FIND | QIDO-RS | Levels: patient, study, series, instance. Supports wildcards and date ranges. Paging uses |
| C-FIND (indexed attributes only) | WADO-RS | Returns keyword-based JSON; bulk data is summarised |
| C-GET | WADO-RS | Saves files to |
| C-MOVE | – | Destination is a node name or an AE title |
| C-STORE | STOW-RS | Accepts files or directories inside the sandbox |
| retrieve + store | retrieve + store | Works across protocols (e.g. PACS → DICOMweb) |
| – | – | Lists cached or allowed DICOM files |
| – | – | Reads a local file header without pixel data |
Pixel and geometry tools (local files)
Tool | What it does |
| Renders one frame to a PNG and returns it alongside JSON. Windowing comes from explicit centre/width values, a preset ( |
| Reports min, max, mean, standard deviation, percentiles and a voxel count for a frame or a rectangular/elliptical ROI. ROIs can be given in pixels or mm. Values are in modality units (HU for CT) and the ROI area is reported in mm² |
| Measures the in-plane distance in mm between two pixels and returns both points in patient (LPS) coordinates |
| Groups files into series and checks whether each one can be treated as a volume. Issues are reported with codes such as |
| Renders an axial, coronal or sagittal slice reformatted from a series that passes |
| Writes de-identified copies under |
Every pixel result includes an input_fingerprint: a SHA-256 hash of the decoded pixels and geometry. It does not change with the transfer syntax, and the planned verification loop will use it to bind results to their inputs.
Each tool carries MCP annotations (readOnlyHint, destructiveHint, idempotentHint) so a harness can decide which tools need approval.
Related MCP server: DICOM MCP Server
Install
python -m venv .venv
.venv\Scripts\python -m pip install -e ".[dev]"
# Optional: decoders for JPEG, JPEG-LS, JPEG 2000 and RLE compressed pixel data
.venv\Scripts\python -m pip install -e ".[codecs]"Configure
No config file is needed. Pass nodes and paths as arguments in the harness config; add a YAML file only for advanced settings.
Arguments
Argument | Meaning |
| Adds a node. Repeatable. See the node spec below |
| Local cache for retrieved files and renders. Default |
| Extra directory that the local-file and pixel tools may read. Repeatable |
| AE title this server uses for DIMSE. Default |
| Optional YAML file (see below) |
| Prints the resolved settings and exits. Useful for checking a harness setup |
Node spec: name=URL[;option;option…]
URL | Node type |
| DIMSE (C-FIND, C-GET, C-MOVE, C-STORE) |
| DICOMweb base URL (QIDO-RS, WADO-RS, STOW-RS) |
Option | Meaning |
|
|
| DICOMweb bearer token read from environment variable |
| DICOMweb basic auth; the password is read from |
| Skip TLS certificate checks (test servers only) |
| Transfer syntax requested from WADO-RS. Empty means the server default; the default |
Examples:
--node orthanc=dimse://ORTHANC@localhost:4242
--node orthanc-web=http://localhost:8042/dicom-web
--node "azure=https://<workspace>-<service>.dicom.azurehealthcareapis.com/v2;token-env=AZURE_DICOM_TOKEN;read-only"Secrets never go in arguments. Arguments are visible in process lists and are often committed in mcp.json. Put tokens and passwords in environment variables and pass only the variable name.
With no --node, the server still starts: the local-file and pixel tools work on files under the allowed paths.
Environment variables
Every argument has an environment-variable equivalent, which suits Docker and CI:
Variable | Equivalent |
|
|
|
|
|
|
|
|
|
|
Optional YAML file (advanced)
Use a file for settings that have no argument: timeouts, max_results, max_volume_voxels, deid_key_env and node descriptions. See config.example.yaml. If ./dicom-agent-mcp.yaml exists in the working directory, it is loaded automatically. Relative paths in a file resolve against the file's directory; relative paths in arguments and environment variables resolve against the working directory.
Precedence: config file, then environment variables, then arguments. Later sources override single values, nodes are merged by name (a --node with the same name replaces the file's node), and allowed paths are combined.
Run
dicom-agent-mcp --node orthanc=dimse://ORTHANC@localhost:4242 # stdio
dicom-agent-mcp --node orthanc=dimse://ORTHANC@localhost:4242 --transport streamable-http --port 8000
dicom-agent-mcp --node orthanc=dimse://ORTHANC@localhost:4242 --print-config # check settingsVS Code (.vscode/mcp.json)
{
"inputs": [
{ "id": "azureToken", "type": "promptString", "description": "Azure DICOM access token", "password": true }
],
"servers": {
"dicom": {
"type": "stdio",
"command": "${workspaceFolder}/.venv/Scripts/dicom-agent-mcp",
"args": [
"--node", "orthanc=dimse://ORTHANC@localhost:4242",
"--node", "orthanc-web=http://localhost:8042/dicom-web",
"--node", "azure=https://<workspace>-<service>.dicom.azurehealthcareapis.com/v2;token-env=AZURE_DICOM_TOKEN;read-only",
"--storage-dir", "${workspaceFolder}/dicom-cache",
"--allow-path", "${workspaceFolder}/inbox"
],
"env": { "AZURE_DICOM_TOKEN": "${input:azureToken}" }
}
}
}Claude Desktop / Copilot CLI / other harnesses
{
"mcpServers": {
"dicom": {
"command": "dicom-agent-mcp",
"args": [
"--node", "orthanc=dimse://ORTHANC@localhost:4242",
"--allow-path", "C:/data/dicom-inbox"
]
}
}
}Use absolute paths here: these harnesses may start the server in any working directory. To use a file instead, pass "args": ["--config", "C:/path/to/dicom-agent-mcp.yaml"].
Local Orthanc for testing
docker-compose up -d # DIMSE on 4242, DICOMweb on http://localhost:8042/dicom-web (compose file not yet tested)Sample prompts
These prompts assume three nodes: orthanc (DIMSE), orthanc-web (DICOMweb) and azure-dicom, for example:
--node orthanc=dimse://ORTHANC@localhost:4242 --node orthanc-web=http://localhost:8042/dicom-web
--node "azure-dicom=https://<workspace>-<service>.dicom.azurehealthcareapis.com/v2;token-env=AZURE_DICOM_TOKEN"The tool the agent is expected to call is shown after each prompt.
Nodes and connectivity
Prompt | Tool |
"Which DICOM nodes are configured, and which ones are read-only?" |
|
"Check whether |
|
Search and metadata
Prompt | Tool |
"Find all CT studies on |
|
"List the series in study |
|
"Find patients whose name starts with |
|
"Show the acquisition parameters for series |
|
Moving data
Prompt | Tool |
"Download the chest CT series from |
|
"Send study |
|
"Upload the files in |
|
"Copy series |
|
Local files
Prompt | Tool |
"What DICOM files do I have locally?" |
|
"Read the header of |
|
Pixels and geometry
Prompt | Tool |
"Show me slice 40 of that series in a lung window." |
|
"Render it again with centre 40 and width 400." |
|
"What is the mean HU in a 10 mm circle centred at row 256, column 300?" |
|
"Give me the minimum, maximum and 95th percentile for the whole frame." |
|
"How far apart in mm are pixel (120, 200) and pixel (180, 260)?" |
|
"Can this series be used as a 3D volume? Report any missing slices or uneven spacing." |
|
"Show the middle coronal slice in a bone window." |
|
"Show sagittal slice 100." |
|
De-identification
Prompt | Tool |
"De-identify the downloaded study, shift the dates and drop private tags." |
|
"De-identify it but keep the original dates and the series descriptions." |
|
Multi-step workflows
"Find the latest CT for patient MRN123 on
orthanc, download it, check its geometry, and show me an axial and a coronal view in a soft-tissue window.""Measure the mean HU of the liver at slice 60 (a 15 mm circle at row 300, column 180) and report the input fingerprint."
"Download study X from
orthanc, de-identify it, and upload the de-identified copy toazure-dicom."
Prompts the server should refuse
Prompt | Expected result |
"Store these files to | Refused because the node is read-only |
"Read | Refused because the path is outside the sandbox |
"Render a coronal MPR of a series that has missing slices." | Refused, with the geometry issues listed |
Safety
Path sandbox.
store,list_local_files,read_local_metadataand the pixel tools only accept paths understorage_dirorallowed_paths.UID validation. UIDs are checked before they are used in file paths or URLs.
read_onlynodes.store,moveandtransferrefuse to write to them.Result caps.
max_resultslimits results; truncation is reported withtruncated: true.Pixels in context only by request. Raw pixel arrays are never returned.
render_imageandrender_mprdo send a downsampled PNG to the model; a copy is saved understorage_dir/renders.Volume cap.
render_mprrefuses series larger thanmax_volume_voxels, and refuses series that failcheck_geometry.
De-identification
deidentify does the following:
removes or empties identifying attributes (Basic Profile subset, including station/detector IDs and common person-name sequences);
drops private tags and overlay or curve groups;
replaces PatientName and PatientID with pseudonyms;
remaps instance UIDs consistently;
by default, shifts dates by a per-patient offset of 1 to 730 days.
It records profile options in DeidentificationMethodCodeSequence, and returns an audit summary (elements removed/emptied, private tags, overlays, remapped UIDs, shifted dates, pixel-risk file count) plus residual-risk warnings.
To get the same pseudonyms and UIDs across runs, set a secret key in the environment variable named by deid_key_env (default DICOM_AGENT_MCP_DEID_KEY). Without a key, each call uses a random key and the result reports linkable: false.
It does not remove text burned into the pixels; BurnedInAnnotation=YES and risk modalities (e.g. US, SC) produce a warning. It is a research aid, not a certified de-identification tool.
Architecture
server.py (FastMCP tools) → service.py (routing, sandbox, paging)
├── dimse.py (pynetdicom SCU)
├── dicomweb.py (httpx QIDO/WADO/STOW)
├── imaging.py (windowing, geometry, ROI stats, MPR, fingerprints)
└── deid.py (Basic Profile subset)Tests
.venv\Scripts\python -m pytest -qThe tests run end to end against an in-process pynetdicom PACS (two AEs so C-MOVE can be tested) and a mocked DICOMweb server. They need no network. The pixel tests use a synthetic CT series with known HU values, spacing and positions.
Limitations
STOW-RS builds the whole request in memory, and WADO-RS reads the whole response into memory.
DIMSE
get_metadataonly returns attributes that the archive indexes for C-FIND.retrieveuses C-GET. Archives that only support C-MOVE needmoveto a storage SCP.No TLS for DIMSE yet.
Pixel tools have been tested on synthetic CT and pydicom sample files only. Compressed transfer syntaxes, enhanced multi-frame objects and real-world data are not yet tested.
MPR uses nearest-slice sampling and does not resample to isotropic voxels.
Pixel tools work on local files; use
retrievefirst.
Roadmap
See ROADMAP.md.
Available Tools
16 toolscheck_geometryARead-only
Check series geometry before measuring or reconstructing.
Reports orientation, spacing and extent per series, and flags missing or duplicate slices, mixed orientations, non-uniform spacing, gantry tilt and multiple frames of reference.
Inputs: paths (required). Returns: object
deidentifyAIdempotent
Write de-identified copies of local DICOM files (basic confidentiality profile subset) to the cache.
UIDs are remapped consistently, names and IDs are pseudonymised, and pixel data is not changed. The result includes an audit of scrubbed elements and residual-risk warnings (e.g. burned-in text).
Inputs: paths (required), date_mode, keep_private, keep_descriptions. Returns: object
echoARead-only
Check connectivity to a node (C-ECHO for DIMSE, a minimal QIDO-RS request for DICOMweb).
Inputs: node (required). Returns: object
get_metadataARead-only
Read instance-level metadata without downloading pixel data (WADO-RS metadata or C-FIND).
Inputs: node (required), study_uid (required), limit, fields, +2 more. Returns: object
list_local_filesBRead-only
List DICOM files in the local cache.
Inputs: limit, study_uid. Returns: object
list_nodesARead-only
List the configured DICOM nodes (PACS, VNA, DICOMweb services) and their protocols.
Inputs: no named parameters. Returns: result
measure_distanceBRead-only
Measure a distance in mm between two pixel positions and give their patient coordinates.
Inputs: end (required), path (required), start (required), frame. Returns: object
moveBIdempotent
Ask a DIMSE archive to send data to another DICOM node (C-MOVE).
Inputs: node (required), study_uid (required), destination (required), series_uid, +1 more. Returns: object
pixel_statisticsBRead-only
Pixel value statistics in modality units (HU for CT): mean, std, min, max, percentiles and area in mm2.
Inputs: path (required), roi, frame. Returns: object
read_local_metadataARead-only
Read the full header of a local DICOM file. Pixel data is not loaded.
Inputs: path (required), max_depth. Returns: object
render_imageARead-only
Render one frame of a local DICOM image as a PNG you can look at.
Applies the modality rescale (e.g. HU) and a display window, corrects non-square pixels, and reports which patient direction each image edge faces. Also returns the input fingerprint.
Inputs: path (required), frame, window, max_size, +2 more.
render_mprARead-only
Reconstruct an axial, coronal or sagittal view from a stack of slices and render it as a PNG.
Refuses series that fail check_geometry (missing slices, mixed orientations, and so on).
Inputs: paths (required), index, plane, window, +4 more.
retrieveAIdempotent
Download a study, series or instance into the local cache (C-GET or WADO-RS). Returns file paths.
Inputs: node (required), study_uid (required), series_uid, sop_instance_uid. Returns: object
searchBRead-only
Search for patients, studies, series or instances (C-FIND or QIDO-RS).
Inputs: node (required), level, limit, offset, +2 more. Returns: object
storeBIdempotent
Send local DICOM files to a node (C-STORE or STOW-RS).
Inputs: node (required), paths (required). Returns: object
transferAIdempotent
Copy data between any two nodes, including DIMSE to DICOMweb, through the local cache.
Inputs: source (required), study_uid (required), destination (required), series_uid, +1 more. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 16 tools
Most tools target distinct resources and actions, but the network-movement family (retrieve, move, store, transfer) has subtle boundaries — transfer partly subsumes move/retrieve/store combinations, and get_metadata vs read_local_metadata differ mainly by local vs node context. Descriptions do help clarify, so an agent can likely choose correctly with care.
Verb-first names dominate (list_local_files, read_local_metadata, check_geometry), but bare verbs (echo, search, retrieve, move, store, transfer, deidentify) and a noun-first name (pixel_statistics) break the pattern. The 'local' qualifier on list_local_files is not mirrored in list_nodes, adding mild inconsistency.
16 tools is slightly heavy but justified by the breadth of the domain: local cache inspection, DIMSE/DICOMweb networking, image analysis, rendering and de-identification. Each tool maps to a real operation rather than filler.
Covers discovery, connectivity, search, retrieval, transfer, storage, geometry checks, measurement, MPR rendering and de-identification — a broad lifecycle. Minor gaps exist, such as cache cleanup/deletion, browsing the local cache by patient/study hierarchy rather than flat file listing, and no export of rendered output to a path.
Maintenance
Related MCP Connectors
PDF and image tools for AI agents: compress, merge, split, OCR, sign. Runs locally, never uploads.
Image & PDF tools for AI agents: compress, convert, resize, PDF, AI vision, pipeline.
OCR, transcription, file extraction, and image generation for AI agents via MCP.
214 tools for AI agents over one MCP endpoint: image, video, audio, 3D, data, storage, mail, GPUs.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to query and analyze medical imaging metadata from DICOM servers, including patient information, studies, series, and instances, as well as extract text from encapsulated PDF documents.109MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to query, read, download, and move medical imaging data on DICOM servers (PACS, VNA) including patient searches, study retrieval, PDF report extraction, and image transfer to AI endpoints for analysis.MIT
- FlicenseNot gradedqualityDmaintenanceExposes DICOM operations as tools for AI agents to interact with medical imaging systems and PACS. It enables searching for studies and series, querying instance metadata, and retrieving pixel data from DICOM entities.-
- AlicenseAqualityDmaintenanceEnables AI assistants to query and read data on DICOM servers (PACS, VNA, etc.).91MIT