用于医学成像系统的 DICOM MCP 服务器🏥

dicom-mcp服务器使 AI 助手能够查询、读取和移动 DICOM 服务器(PACS、VNA 等)上的数据。
🤝**贡献• 📝报告错误• 📝博客文章**
✨ 核心能力
dicom-mcp提供的工具可以:
🔍 查询元数据:使用各种标准搜索患者、研究、系列和实例。
📄 阅读 DICOM 报告(PDF) :检索包含封装 PDF(例如临床报告)的 DICOM 实例并提取文本内容。
➡️ 发送 DICOM 图像:将系列或研究发送到其他 DICOM 目的地,例如用于图像分割、分类等的 AI 端点。
⚙️ 实用程序:管理连接并了解查询选项。
Related MCP server: DICOM-MCP
🚀 快速入门
📥 安装
使用 uv 或 pip 安装:
uv tool install dicom-mcp
或者通过克隆存储库:
# Clone and set up development environment
git clone https://github.com/ChristianHinge/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]"
⚙️ 配置
dicom-mcp需要一个 YAML 配置文件( config.yaml或类似文件)来定义 DICOM 节点并调用 AE 标题。请调整配置或保持原样,以兼容示例 ORTHANC 服务器。
nodes:
main:
host: "localhost"
port: 4242
ae_title: "ORTHANC"
description: "Local Orthanc DICOM server"
current_node: "main"
calling_aet: "MCPSCU"
注意:DICOM-MCP 是一个开源项目,不适用于临床用途,因此不应将其与医院的实时数据库或包含患者敏感数据的数据库连接。这样做可能会导致患者数据丢失,以及患者数据泄露到互联网上。
(可选)示例 ORTHANC 服务器
如果您没有可用的 DICOM 服务器,则可以使用 Docker 运行本地 ORTHANC 服务器:
克隆存储库并安装测试依赖项pip install -e ".[dev]
cd tests
docker ocmpose up -d
cd ..
pytest # uploads dummy pdf data to ORTHANC server
sh upload_dummy_data.sh
用户界面:http://localhost:8042
🔌 MCP 集成
添加到您的客户端配置(例如claude_desktop_config.json ):
{
"mcpServers": {
"dicom": {
"command": "uv",
"args": ["tool","dicom-mcp", "/path/to/your_config.yaml"]
}
}
}
对于开发:
{
"mcpServers": {
"arxiv-mcp-server": {
"command": "uv",
"args": [
"--directory",
"path/to/cloned/dicom-mcp",
"run",
"dicom-mcp",
"/path/to/your_config.yaml"
]
}
}
}
🛠️ 工具概述
dicom-mcp提供了四类工具用于与 DICOM 服务器和 DICOM 数据交互。
🔍 查询元数据
query_patients :根据姓名、ID 或出生日期等条件搜索患者。
query_studies :使用患者 ID、日期、方式、描述、登录号或研究 UID 查找研究。
query_series :使用模态、系列编号/描述或系列 UID 在特定研究中定位系列。
query_instances :使用实例编号或 SOP 实例 UID 查找系列中的单个实例(图像/对象)
📄 阅读 DICOM 报告(PDF)
➡️ 发送 DICOM 图像
⚙️ 实用工具
list_dicom_nodes :显示当前活动的 DICOM 节点并列出所有配置的节点。
switch_dicom_node :更改活动的 DICOM 节点以进行后续操作。
verify_connection :使用 C-ECHO 测试与当前活动节点的 DICOM 网络连接。
get_attribute_presets :列出元数据查询结果的可用详细程度(最低、标准、扩展)。
交互示例
这些工具可以链接在一起来回答复杂的问题:
---------------------------------------------------------------------
🧑⚕️ 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³"
---------------------------------------------------------------------
📈 贡献
运行测试
测试需要运行 Orthanc DICOM 服务器。您可以使用 Docker:
# Navigate to the directory containing docker-compose.yml (e.g., tests/)
cd tests
docker-compose up -d
使用 pytest 运行测试:
# From the project root directory
pytest
停止 Orthanc 容器:
cd tests
docker-compose down
调试
使用 MCP Inspector 调试服务器通信:
npx @modelcontextprotocol/inspector uv run dicom-mcp /path/to/your_config.yaml --transport stdio
🙏 致谢