Agent / MCP server¶
pydcm.mcp is an in-process Model Context Protocol
server: it exposes pydcm's live-object capabilities — the ones that work on
DICOM objects in memory, not just files — to any MCP-aware agent runtime, over
stdio.
Run it¶
Or embed it in your own process:
Connect an MCP client¶
Point any MCP client (Claude Desktop, Claude Code, your own runtime) at the module entry point:
Use the interpreter that has pydcm installed (e.g. the absolute path to a venv's
python). Restart the client; the tools below appear, callable by name with
schema-checked arguments.
Tools¶
The server registers the capabilities that benefit from running inside Python — structured-object reading, volume/geometry work, transforms, and the EHR bridges:
| Tool | Does |
|---|---|
dicom_content |
Semantic JSON of a structured object (SEG / RT Struct / RT Plan / RT Dose / PS / Waveform) |
rtdose_info |
RT Dose grid summary (units, scaling, geometry, stored DVHs) |
volume_info |
Assemble a series → 3-D volume; report shape / spacing / affine |
volume_to_nifti |
Series → NIfTI on disk (validated affine) |
resample_volume_to_spacing |
Resample a series to a target mm spacing → NIfTI |
bids_sidecar |
BIDS JSON sidecar (acquisition parameters) from a series |
dicom_to_fhir |
DICOM instance → FHIR R4 ImagingStudy |
hl7_parse / hl7_build_oru |
Parse an HL7 v2 message / build an ORU^R01 result |
Each tool advertises a JSON Schema (inputSchema) over tools/list, so the
agent gets argument validation for free.
When to use it¶
pydcm.mcp runs inside your Python process, so it hands back live results —
an assembled volume's geometry, a resampled NIfTI on disk, a parsed RT Dose grid
— the things that are Python objects, not just files. Reach for it when the
agent is already working in Python and you want it to drive pydcm's
volume / transform / RT / EHR capabilities directly.