Skip to content

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.

  • 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:

Terminal window
uv sync --extra mcp

A full development environment installed with --all-extras already includes MCP support.

Against the synthetic fixture:

Terminal window
uv run dicom-kb mcp serve \
--edition 2026b \
--db /tmp/dicom-kb-fixture.sqlite

Against a database in the default cache:

Terminal window
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.

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>.sqlite

The client should discover 19 tools. Representative names include:

dicom_lookup_data_element
dicom_lookup_uid
dicom_lookup_iod
dicom_list_modules_for_iod
dicom_resolve_attribute_context
dicom_lookup_transfer_syntax
dicom_lookup_dicomweb_transaction
dicom_lookup_sr_template
dicom_search_standard_text

See MCP tools for the complete list and exact arguments.

The reviewed adapter registers tools only. It does not expose MCP resources or prompts.

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.

Do not reduce tool output to result alone. Pass the following into downstream reasoning:

  • edition
  • status
  • result
  • refs
  • warnings
  • classification
  • parse_confidence
  • trace

A safe synthesis prompt should instruct the model to distinguish parsed facts, retrieved explanation, ambiguity, and unsupported claims.

  • 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.

Resynchronize with:

Terminal window
uv sync --extra mcp

Build the fixture or an official-edition database, then verify the edition, cache, and explicit --db path.

Set the source checkout as the working directory or use the absolute path to a standalone dicom-kb executable.

Adjust the agent harness so it retains references, classification, confidence, warnings, and trace metadata. See Response evidence and confidence.