Skip to main content

诊微 MCP Server — AI 病历质控能力接入

让你的 AI 智能体(Cursor、Claude Desktop、Cline、自定义 Agent 等)具备 病历质控 能力。

📦 安装

# 方式一:pip 安装
pip install zhenwei-mcp-server

# 方式二:uvx 直接运行(无需安装)
uvx zhenwei-mcp-server

🔑 获取 API Key

  1. 登录诊微平台 → MCP 服务 → 服务管理
  2. 点击「创建 API Key」
  3. 保存生成的 Key(格式: mqc_xxxx)

🔧 配置

Cursor

在 ~/.cursor/mcp.json 中添加:

{
  "mcpServers": {
    "zhenwei": {
      "command": "zhenwei-mcp",
      "env": {
        "ZHENWEI_API_URL": "https://your-server.com/api/v1",
        "ZHENWEI_API_KEY": "mqc_your_key_here"
      }
    }
  }
}

Claude Desktop

在 ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) 或 %APPDATA%\Claude\claude_desktop_config.json (Windows) 中添加:

{
  "mcpServers": {
    "zhenwei": {
      "command": "zhenwei-mcp",
      "env": {
        "ZHENWEI_API_URL": "https://your-server.com/api/v1",
        "ZHENWEI_API_KEY": "mqc_your_key_here"
      }
    }
  }
}

Cline (VS Code)

在 Cline MCP 设置中添加:

{
  "zhenwei": {
    "command": "zhenwei-mcp",
    "env": {
      "ZHENWEI_API_URL": "https://your-server.com/api/v1",
      "ZHENWEI_API_KEY": "mqc_your_key_here"
    }
  }
}

Python 代码调用

import asyncio
from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client

async def main():
    server_params = StdioServerParameters(
        command="zhenwei-mcp",
        env={
            "ZHENWEI_API_URL": "https://your-server.com/api/v1",
            "ZHENWEI_API_KEY": "mqc_your_key_here",
        },
    )
    async with stdio_client(server_params) as (read, write):
        async with ClientSession(read, write) as session:
            await session.initialize()

            # 查看可用工具
            tools = await session.list_tools()
            print(f"可用工具: {[t.name for t in tools.tools]}")

            # 调用病历质控
            result = await session.call_tool("check_medical_record", {
                "record_text": "主诉:发热伴咳嗽3天\n现病史:...",
                "record_type": "admission",
            })
            print(result)

asyncio.run(main())

🛠️ 可用工具 (12个)

核心质控

工具 说明
check_medical_record 单病历质控检查(规则引擎 + AI 语义双重检测)
batch_check_records 批量质控(最多50份)
get_qc_result 获取质控结果

统计规则

工具 说明
get_qc_rules 查询质控规则(500+条,覆盖甲乙丙级标准)
get_qc_statistics 质控统计数据

AI 辅助

工具 说明
get_suggestions AI 修改建议(针对缺陷生成示范文本)
check_icd_code ICD-10 编码校验和推荐
check_drg_grouping DRG/DIP 分组预测
check_drug_safety 用药安全检查(过敏/配伍/剂量)

数据查询

工具 说明
search_knowledge_base 知识库搜索(法规/标准/编码)
get_record_detail 获取病历详情
submit_appeal 提交缺陷申诉

💡 使用示例

配置完成后,在 Cursor 或 Claude 中直接对话:

"帮我检查这份入院记录有没有质量问题: 主诉:发热3天 现病史:患者3天前出现发热,体温38.5℃,伴咳嗽咳痰... 入院诊断:社区获得性肺炎"

AI 会自动调用 check_medical_record 工具,返回质控评分和缺陷列表。

"I25.1 这个 ICD 编码对应什么诊断?"

AI 会调用 check_icd_code 进行编码校验。

🔒 安全说明

  • 所有通信通过 HTTPS 加密
  • API Key 支持频率限制和过期时间
  • 患者姓名等 PII 字段 AES 加密存储
  • MCP 质控创建的临时数据与正式病历隔离

📋 环境变量

变量 必填 说明
ZHENWEI_API_URL 是 诊微平台 API 地址
ZHENWEI_API_KEY 是 MCP API Key

License

MIT

Release files for zhenwei-mcp-server 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for zhenwei-mcp-server 1.0.0
File Size Uploaded
zhenwei_mcp_server-1.0.0.tar.gz 8.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for zhenwei-mcp-server 1.0.0
File Interpreter ABI Platform
zhenwei_mcp_server-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 16.4 kB

Release files / zhenwei_mcp_server-1.0.0.tar.gz

Download URL zhenwei_mcp_server-1.0.0.tar.gz
Size 8.4 kB
Tags Source
SHA-256 checksum
How to use checksums
9d93220c13312eb038e3030db2a3c7686c7b64041c33aac5da24b78ed52f6c28
BLAKE2b-256 checksum
How to use checksums
ec811608bf855368f393fe70c62838936342e17b25ee624772eebec305a98c19
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.3

Release files / zhenwei_mcp_server-1.0.0-py3-none-any.whl

Download URL zhenwei_mcp_server-1.0.0-py3-none-any.whl
Size 7.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9dc6159255451e52713f003175199c190e02f180df9ced3a18a661027855a3af
BLAKE2b-256 checksum
How to use checksums
f03167dc0d22ac31a28ec41fb1afa6663575189cbb286c169c47b6b893b6871c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.3

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page