DICOM MCP Server

DICOM MCP Server

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

Category
访问服务器

README

DICOM MCP Server for Medical Imaging Systems 🏥

License: MIT Python Version PyPI Version PyPI Downloads

The dicom-mcp server enables AI assistants to query, read, and move data on DICOM servers (PACS, VNA, etc.).

<div align="center">

🤝 Contribute • 📝 Report Bug

</div>

---------------------------------------------------------------------
🧑‍⚕️ User: "Any significant findings in John Doe's previous CT report?"

🧠 LLM → ⚙️ Tools:
   query_patients → query_studies → query_series → extract_pdf_text_from_dicom

💬 LLM Response: "The report from 2025-03-26 mentions a history of splenomegaly (enlarged spleen)"

🧑‍⚕️ User: "What's the volume of his spleen at the last scan and the scan today?"

🧠 LLM → ⚙️ Tools:
   (query_studies → query_series → move_series → query_series → extract_pdf_text_from_dicom) x2
   (The move_series tool sends the latest CT to a DICOM segmentation node, which returns volume PDF report)

💬 LLM Response: "last year 2024-03-26: 412cm³, today 2025-04-10: 350cm³"
---------------------------------------------------------------------

✨ Core Capabilities

dicom-mcp provides tools to:

  • 🔍 Query Metadata: Search for patients, studies, series, and instances using various criteria.
  • 📄 Read DICOM Reports (PDF): Retrieve DICOM instances containing encapsulated PDFs (e.g., clinical reports) and extract the text content.
  • 📥 Download DICOM Files: Download DICOM instances from the server to a local directory using C-GET. Retrieve entire series or specific instances for local analysis and processing.
  • ➡️ Send DICOM Images: Send series or studies to other DICOM destinations, e.g. AI endpoints for image segmentation, classification, etc.
  • ⚙️ Utilities: Manage connections and understand query options.

🚀 Quick Start

📥 Installation

Install using uv or pip:

uv tool install dicom-mcp

Or by cloning the repository:

# Clone and set up development environment
git clone https://github.com/Y5ive9ine/dicom-mcp
cd dicom mcp

# Create and activate virtual environment
uv venv
source .venv/bin/activate

# Install with test dependencies
uv pip install -e ".[dev]"

⚙️ Configuration

dicom-mcp requires a YAML configuration file (config.yaml or similar) defining DICOM nodes and calling AE titles. Adapt the configuration or keep as is for compatibility with the sample ORTHANC Server.

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

current_node: "main"
calling_aet: "MCPSCU" 

[!WARNING] DICOM-MCP is not meant for clinical use, and should not be connected with live hospital databases or databases with patient-sensitive data. Doing so could lead to both loss of patient data, and leakage of patient data onto the internet. DICOM-MCP can be used with locally hosted open-weight LLMs for complete data privacy.

(Optional) Sample ORTHANC server

If you don't have a DICOM server available, you can run a local ORTHANC server using Docker:

Clone the repository and install test dependencies pip install -e ".[dev]

cd tests
docker ocmpose up -d
cd ..
pytest # uploads dummy pdf data to ORTHANC server

UI at http://localhost:8042

🔌 MCP Integration

Add to your client configuration (e.g. claude_desktop_config.json):

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

For development:

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

🛠️ Tools Overview

dicom-mcp provides four categories of tools for interaction with DICOM servers and DICOM data.

🔍 Query Metadata

  • query_patients: Search for patients based on criteria like name, ID, or birth date.
  • query_studies: Find studies using patient ID, date, modality, description, accession number, or Study UID.
  • query_series: Locate series within a specific study using modality, series number/description, or Series UID.
  • query_instances: Find individual instances (images/objects) within a series using instance number or SOP Instance UID

📄 Read DICOM Reports (PDF)

  • extract_pdf_text_from_dicom: Retrieve a specific DICOM instance containing an encapsulated PDF and extract its text content.

📥 Download DICOM Files

  • retrieve_dicom_instances: Download DICOM instances from the server to a local directory using C-GET. Retrieve entire series or specific instances for local analysis and processing.

➡️ Send DICOM Images

  • move_series: Send a specific DICOM series to another configured DICOM node using C-MOVE.
  • move_study: Send an entire DICOM study to another configured DICOM node using C-MOVE.

⚙️ Utilities

  • list_dicom_nodes: Show the currently active DICOM node and list all configured nodes.
  • switch_dicom_node: Change the active DICOM node for subsequent operations.
  • verify_connection: Test the DICOM network connection to the currently active node using C-ECHO.
  • get_attribute_presets: List the available levels of detail (minimal, standard, extended) for metadata query results.<p>

Example interaction

The tools can be chained together to answer complex questions:

<div align="center"> <img src="images/example.png" alt="My Awesome Diagram" width="700"> </div>

📈 Contributing

Running Tests

Tests require a running Orthanc DICOM server. You can use Docker:

# Navigate to the directory containing docker-compose.yml (e.g., tests/)
cd tests
docker-compose up -d

Run tests using pytest:

# From the project root directory
pytest

Stop the Orthanc container:

cd tests
docker-compose down

Debugging

Use the MCP Inspector for debugging the server communication:

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

🙏 Acknowledgments

Usage Examples

Basic Patient Query

# Find all patients with name starting with "SMITH"
patients = query_patients(name_pattern="SMITH*")

Study Query with Date Range

# Find CT studies from January 2023
studies = query_studies(
    modality_in_study="CT", 
    study_date="20230101-20230131"
)

Download DICOM Files

# Download entire series to local directory
result = retrieve_dicom_instances(
    series_instance_uid="1.2.840.113619.2.1.1.322.1600364094.412.2005",
    output_directory="/path/to/local/dicom/files"
)

# Download specific instance only
result = retrieve_dicom_instances(
    series_instance_uid="1.2.840.113619.2.1.1.322.1600364094.412.2005",
    sop_instance_uid="1.2.840.113619.2.1.1.322.1600364094.412.3001",
    output_directory="/path/to/local/dicom/files"
)

print(f"Downloaded {result['total_files']} files ({result['total_size_mb']} MB)")
print(f"Files saved to: {result['output_directory']}")

# Files will be named with meaningful information like:
# "12345_SMITH_20230215_CT_CHEST_AXIAL_Inst001.dcm"
# "12345_SMITH_20230215_CT_CHEST_AXIAL_Inst002.dcm"

Extract PDF Reports

# Extract text from a DICOM PDF report
result = extract_pdf_text_from_dicom(
    study_instance_uid="1.2.840.113619.2.1.1.322.1600364094.412.1009",
    series_instance_uid="1.2.840.113619.2.1.1.322.1600364094.412.2005", 
    sop_instance_uid="1.2.840.113619.2.1.1.322.1600364094.412.3001"
)

if result["success"]:
    print("Report text:", result["text_content"])

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选