Connect an MCP client
The MCP adapter exposes the same resolver layer as the CLI through 19
dicom_-prefixed tools. It is intended for coding agents and other local MCP
clients that need cited, edition-aware DICOM facts.
Prerequisites
Section titled “Prerequisites”- Install the optional MCP dependency.
- Build or select a local SQLite knowledge base.
- Know the concrete edition associated with that database.
- Use an MCP client that can launch a local stdio server.
Install from a source checkout:
uv sync --extra mcpA full development environment installed with --all-extras already includes
MCP support.
Test the server command
Section titled “Test the server command”Against the synthetic fixture:
uv run dicom-kb mcp serve \ --edition 2026b \ --db /tmp/dicom-kb-fixture.sqliteAgainst a database in the default cache:
EDITION=2025e # Replace with your concrete edition.uv run dicom-kb mcp serve \ --edition "$EDITION"The process waits for MCP messages on standard input and writes protocol output on standard output. It is normally launched by the client rather than kept in an interactive terminal.
Configure the client
Section titled “Configure the client”MCP client configuration formats differ, but provide the equivalent of these launch values:
| Field | Value |
|---|---|
| Server name | dicom-standard-kb |
| Command from a source checkout | uv |
| Arguments | run, dicom-kb, mcp, serve, --edition, the concrete edition |
| Working directory | the dicom-standard-kb source checkout |
| Optional arguments | --db /absolute/path/to/database.sqlite or --cache-dir /absolute/path/to/cache |
When using a standalone uv-tool installation, configure dicom-kb as the
executable and omit uv run.
Use absolute paths in client configuration. The server resolves a missing
--db to:
<cache-dir>/db/<edition>.sqliteConfirm tool discovery
Section titled “Confirm tool discovery”The client should discover 19 tools. Representative names include:
dicom_lookup_data_elementdicom_lookup_uiddicom_lookup_ioddicom_list_modules_for_ioddicom_resolve_attribute_contextdicom_lookup_transfer_syntaxdicom_lookup_dicomweb_transactiondicom_lookup_sr_templatedicom_search_standard_textSee MCP tools for the complete list and exact arguments.
The reviewed adapter registers tools only. It does not expose MCP resources or prompts.
Route questions to the narrowest tool
Section titled “Route questions to the narrowest tool”Use structured tools before prose search:
| Question | Preferred tool |
|---|---|
| “What is the VR and VM of Modality?” | dicom_lookup_data_element |
| “Which modules are used by CT Image?” | dicom_list_modules_for_iod |
| “What type is Modality in this IOD?” | dicom_resolve_attribute_context |
| “How is this transfer syntax encoded?” | dicom_lookup_transfer_syntax |
| “What route defines RetrieveStudy?” | dicom_lookup_dicomweb_transaction |
| “What rows are in TID 1500?” | dicom_lookup_sr_template |
| “Where does the standard discuss this prose rule?” | dicom_search_standard_text, then dicom_retrieve_standard_text |
When a structured tool returns candidates, warnings, or not_found, preserve
that result. Use cited text as a bounded fallback rather than asking the model
to invent a normative fact.
Preserve the response envelope
Section titled “Preserve the response envelope”Do not reduce tool output to result alone. Pass the following into downstream
reasoning:
editionstatusresultrefswarningsclassificationparse_confidencetrace
A safe synthesis prompt should instruct the model to distinguish parsed facts, retrieved explanation, ambiguity, and unsupported claims.
Runtime and safety behavior
Section titled “Runtime and safety behavior”- The server fixes one edition and database at startup.
- Each tool call opens the SQLite database in read-only mode.
- Tools do not fetch artifacts, build databases, or mutate local content.
- An unknown tool name is rejected.
- Startup fails early when the configured database does not exist.
- The MCP transport is stdio; no network listener is started.
Troubleshooting
Section titled “Troubleshooting”Missing optional dependency
Section titled “Missing optional dependency”Resynchronize with:
uv sync --extra mcpDatabase does not exist
Section titled “Database does not exist”Build the fixture or an official-edition database, then verify the edition,
cache, and explicit --db path.
Client starts the wrong environment
Section titled “Client starts the wrong environment”Set the source checkout as the working directory or use the absolute path to a
standalone dicom-kb executable.
Tool output is being flattened
Section titled “Tool output is being flattened”Adjust the agent harness so it retains references, classification, confidence, warnings, and trace metadata. See Response evidence and confidence.