logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

medical-imaging-data-interface

Facilitates secure interchange and manipulation of medical imagery data conforming to the DICOM standard. This utility is crucial for AI systems needing to interrogate patient records, analyze metadata derived from medical scans, and parse textual insights embedded within encapsulated Portable Document Format (PDF) archives found within DICOM objects to support clinical decision-making.

Author

medical-imaging-data-interface logo

ChristianHinge

MIT License

Quick Info

GitHub GitHub Stars 66
NPM Weekly Downloads 0
Tools 1
Last Updated 2026-02-19

Tags

dicommetadataclinicaldocuments dicomdicom formatdicom servers

Medical Imaging Data Interface (MIDI) Server for Clinical AI 🏥

License: MIT Python Version PyPI Version PyPI Downloads

The medical-imaging-data-interface server empowers intelligent agents to initiate queries, retrieve records, and relocate datasets held on Picture Archiving and Communication Systems (PACS), Vendor Neutral Archives (VNA), or other DICOM repositories.

🤝 **[Collaborate](#contributing)** • 📝 **[Submit Issue](https://github.com/ChristianHinge/dicom-mcp/issues)** • 📝 **[Read Overview](https://www.christianhinge.com/projects/dicom-mcp/)**

text

🧑‍⚕️ Clinician: "Can you surface any significant findings documented for patient John Doe's prior examinations?"

🧠 AI Agent → ⚙️ Operations: fetch_patient_registry → retrieve_diagnostic_sessions → enumerate_image_sets → extract_embedded_document_text_from_dicom

💬 AI Response: "The consultation record dated 2025-03-26 indicates a documented history suggestive of splenomegaly (an enlarged spleen)."

🧑‍⚕️ Clinician: "Determine the precise volume measurement of the spleen from the most recent scan, and compare it to today's acquired data."

🧠 AI Agent → ⚙️ Operations: (retrieve_diagnostic_sessions → enumerate_image_sets → transfer_image_set → retrieve_image_sets → extract_embedded_document_text_from_dicom) x2 (The transfer_image_set operation forwards the current CT series to a specialized node for volumetric segmentation, which subsequently yields a volumetric PDF analysis.)

💬 AI Response: "Historical measurement 2024-03-26: 412 cubic centimeters; Current measurement 2025-04-10: 350 cubic centimeters."

✨ Principal Capabilities

medical-imaging-data-interface furnishes a suite of operational tools to:

  • 🔍 Inspect MetaData: Systematically search across patient demographics, imaging studies, series groupings, and individual image instances using diverse filtering parameters.
  • 📄 Decipher DICOM Reports (PDF): Access DICOM objects that contain embedded Portable Document Format files (e.g., radiology reports) and perform optical character recognition/text retrieval to materialize the content.
  • ➡️ Forward DICOM Imagery: Transmit entire studies or defined series to auxiliary DICOM endpoints, such as those dedicated to advanced image analysis, AI segmentation, or classification tasks.
  • ⚙️ System Utilities: Manage connection profiles and gain insight into the available metadata retrieval granularity.

🚀 Rapid Deployment Guide

📥 Installation

Install utilizing either the 'uv' package manager or standard 'pip':

bash uv tool install dicom-mcp

Alternatively, by cloning the source repository:

bash

Duplicate the repository and configure the workspace

git clone https://github.com/ChristianHinge/dicom-mcp cd dicom mcp

Establish and activate a virtual environment

uv venv source .venv/bin/activate

Install in editable mode with development dependencies

uv pip install -e ".[dev]"

⚙️ Configuration Protocol

medical-imaging-data-interface mandates a YAML configuration file (e.g., config.yaml) detailing the necessary DICOM network endpoints (nodes) and the Application Entity Titles (AE Titles) to be invoked. Adjust this configuration or retain the defaults for interoperability with the example ORTHANC instance.

yaml nodes: main: host: "localhost" port: 4242 ae_title: "ORTHANC" description: "Local Orthanc DICOM repository"

current_node: "main" calling_aet: "MCPSCU"

[!CAUTION] MIDI is strictly intended for research and development purposes and must NEVER be linked to operational clinical systems or databases containing sensitive patient health information (PHI). Connection to live hospital systems risks significant patient data compromise and public exposure. MIDI is optimally utilized alongside locally deployed, open-weight large language models to ensure absolute data sovereignty.

(Optional) Provisioning a Sample ORTHANC Server

Should a local DICOM server not be available, an ORTHANC instance can be instantiated via Docker:

Clone the repository and install testing prerequisites (pip install -e ".[dev])

bash cd tests docker-compose up -d cd .. pytest # Executes tests and populates ORTHANC with synthetic PDF data

Access the Web Interface at http://localhost:8042

🔌 MCP Integration Method

Incorporate this tool via your client's operational configuration file (e.g., claude_desktop_config.json):

{ "mcpServers": { "dicom": { "command": "uv", "args": ["tool","dicom-mcp", "/path/to/your_config.yaml"] } } }

For development environment setup:

{ "mcpServers": { "arxiv-mcp-server": { "command": "uv", "args": [ "--directory", "path/to/cloned/dicom-mcp", "run", "dicom-mcp", "/path/to/your_config.yaml" ] } } }

🛠️ Operational Tool Registry

medical-imaging-data-interface exposes four primary functional groupings for DICOM system interaction.

🔍 Metadata Retrieval Tools

  • query_patients: Initiates searches for patient records based on identifiers such as name, unique ID, or date of birth.
  • query_studies: Locates diagnostic study records referencing patient ID, acquisition date, imaging modality, descriptive text, Accession Number, or the Study Unique Identifier (UID).
  • query_series: Pinpoints image series within a study utilizing modality type, series sequencing number/description, or the Series UID.
  • query_instances: Finds singular instances (e.g., individual images or objects) residing within a series, referenced by instance sequence number or SOP Instance UID.

📄 Embedded Report Analysis Tools

  • extract_pdf_text_from_dicom: Fetches a designated DICOM instance known to contain an encapsulated PDF object and performs textual content extraction.

➡️ Image Data Transfer Tools

  • move_series: Executes a C-MOVE operation to transmit a specified DICOM series to an alternative, pre-configured network destination.
  • move_study: Executes a C-MOVE operation to transmit an entire DICOM study to a pre-configured network destination.

⚙️ System Administration Utilities

  • list_dicom_nodes: Displays the currently active DICOM endpoint and lists all defined endpoints in the configuration.
  • switch_dicom_node: Modifies the active DICOM endpoint for subsequent tool executions.
  • verify_connection: Executes a C-ECHO command to confirm network reachability and responsiveness of the active endpoint.
  • get_attribute_presets: Enumerates the predefined schema levels (e.g., minimum, standard, comprehensive) available for metadata query outputs.

Example Workflow

The underlying mechanisms permit chaining operations to resolve intricate clinical data requirements:

📈 Contribution Guidelines

Executing Automated Validation Checks

Validation requires an operational Orthanc DICOM platform. Deployment via Docker is recommended:

bash

Traverse to the directory holding docker-compose.yml (e.g., tests/)

cd tests docker-compose up -d

Run the validation suite using pytest:

bash

From the project root directory

pytest

To decommission the Orthanc container instance:

bash cd tests docker-compose down

Debugging Diagnostics

Employ the MCP Inspector utility to trace server communications:

bash npx @modelcontextprotocol/inspector uv run dicom-mcp /path/to/your_config.yaml --transport stdio

🙏 Credits and Dependencies

  • Developed leveraging the robustness of pynetdicom
  • Utilizes PyPDF2 for processing and extracting text from PDF payloads WIKIPEDIA DEEP DIVE: XMLHttpRequest (XHR) represents an application programming interface embodied by a JavaScript object, whose methods are designed to dispatch HTTP requests from a web browser environment to a remote web server. These methods permit web-based applications to asynchronously submit queries to the server subsequent to page rendering, and subsequently receive data in return. XHR is a fundamental constituent of the Ajax programming paradigm. Before the advent of Ajax, the primary means for server interaction relied upon traditional hyperlink navigation and standard form submissions, actions which typically mandated a full page reload.

== Historical Context == The foundational concept for XMLHttpRequest was conceived around the year 2000 by developers associated with Microsoft Outlook. This notion was subsequently actualized within the Internet Explorer 5 browser release (1999). Nevertheless, the initial syntactic implementation did not employ the 'XMLHttpRequest' identifier. Instead, the developers utilized constructor calls such as 'ActiveXObject("Msxml2.XMLHTTP")' and 'ActiveXObject("Microsoft.XMLHTTP")'. By the time Internet Explorer 7 was released (2006), comprehensive support for the standardized 'XMLHttpRequest' identifier was achieved across the platform. The 'XMLHttpRequest' identifier has since become the universally accepted convention across all major web browser engines, including Mozilla's Gecko (2002), Safari 1.2 (2004), and Opera 8.0 (2005).

=== Standardization Efforts === The World Wide Web Consortium (W3C) published an initial Working Draft specification detailing the XMLHttpRequest object on April 5, 2006. Subsequently, on February 25, 2008, the W3C issued the Level 2 specification Working Draft. Level 2 introduced enhancements for monitoring request progression events, enabling cross-origin communications, and facilitating the handling of raw byte streams. By the close of 2011, the Level 2 feature set was integrated back into the primary specification document. At the culmination of 2012, development stewardship transitioned to the WHATWG, which now maintains the specification as a living document utilizing the Web IDL specification language.

== Operational Usage == The standard procedure for dispatching a query using XMLHttpRequest involves several distinct programming stages.

Instantiation of an XMLHttpRequest object via invocation of its constructor is the first step: Subsequently, call the 'open' method to define the request methodology (GET, POST, etc.), specify the target resource URI, and declare whether the operation should proceed synchronously or asynchronously: If an asynchronous operation is chosen, a listener function must be assigned to monitor state transitions of the request: Initiation of the actual network transmission is performed by calling the 'send' method, optionally providing payload data: Event handlers must process state changes. Upon successful completion of the server transaction, the response data is typically accessible via the 'responseText' property when the object reaches state 4, designated as the 'done' state. Beyond these fundamental steps, XMLHttpRequest offers extensive configuration parameters to govern request transmission and response interpretation. Custom HTTP headers can be injected into the request to instruct the server on fulfillment requirements, and data can be transmitted server-side via parameters within the 'send' call. The server response can be automatically parsed from JSON format into a native, immediately usable JavaScript object, or processed sequentially as data streams arrive, avoiding wait times for the entire payload. Furthermore, requests can be halted prematurely or configured with time-out constraints.

See Also

`