vghsdk-mcp
# vghsdk_mcp
VGH 榮總內網爬蟲 MCP Server - 使用 [FastMCP](https://gofastmcp.com) 框架。
> ⚠️ **注意**: 僅能在 VGH 內網環境中使用。
## 功能
- 🔧 **27 個 MCP Tools** - 病人、手術、門診、住院、同意書、IVI 查詢
- 🔐 **統一認證** - 每次呼叫提供 EIP 帳密
- ⚡ **Session 共享** - 同一帳號重用 session
- 📅 **統一日期格式** - 所有日期參數使用 ISO `YYYY-MM-DD` 格式
## 需求
- Python ≥ 3.10
- [uv](https://docs.astral.sh/uv/getting-started/installation/)
- VGH 內網
## 安裝
```bash
git clone https://github.com/eyeduck-ai/vghsdk-mcp.git
cd vghsdk-mcp
uv sync
```
## 啟動
```bash
uv run python -m vghsdk_mcp
```
## MCP Client 設定
支援 Claude Desktop、ChatGPT、Google CLI 等 MCP 客戶端,設定格式相同:
```json
{
"mcpServers": {
"vghsdk": {
"command": "uv",
"args": ["--directory", "/path/to/vghsdk-mcp", "run", "python", "-m", "vghsdk_mcp"]
}
}
}
```
**設定檔位置**:
- Claude Desktop: `~/Library/Application Support/Claude/claude_desktop_config.json`
- Cursor: `.cursor/mcp.json` (專案根目錄)
## 認證
所有 Tools 需要:
| 參數 | 說明 |
|------|------|
| `eip_id` | EIP 帳號 |
| `eip_password` | EIP 密碼 |
## 日期格式
**統一規則**: 所有日期參數使用 `YYYY-MM-DD` 格式 (ISO 8601)。
```python
# 所有函數都使用相同格式
await surgery_doc_schedule_list(..., date='2025-12-30')
await doc_opd_patient_list_previous(..., date='2025-12-19')
await patient_op_note(..., dt='2025-11-04')
await patient_ad_note(..., adidate='2025-09-30')
```
函數會自動轉換為內網 API 需要的格式 (民國/西元)。
## 可用 Tools (27 個)
### Patient (15)
| Tool | 說明 |
|------|------|
| `patient_search` | 搜尋病人 |
| `patient_info` | 基本資料 |
| `patient_opd_list` | 門診清單 |
| `patient_opd_note` | 門診 SOAP |
| `patient_opd_list_search` | 門診搜尋 (regex) |
| `patient_op_list` | 已完成手術紀錄 |
| `patient_op_schedule` | 預定手術排程 |
| `patient_op_note` | 手術病歷 |
| `patient_ad_list` | 住院清單 |
| `patient_ad_note` | 住院病歷 |
| `patient_drug_list` | 用藥清單 |
| `patient_drug_content` | 用藥詳細 |
| `patient_consult_list` | 會診清單 |
| `patient_consult_note` | 會診內容 |
| `patient_scaned_note` | 掃描病歷 |
### Surgery (3)
| Tool | 說明 |
|------|------|
| `surgery_doc_schedule_list` | 醫師手術排程 |
| `surgery_dept_schedule_list` | 科別手術排程 |
| `surgery_schedule_detail` | 手術詳細 |
### Doctor (4)
| Tool | 說明 |
|------|------|
| `doc_opd_patient_list_previous` | 過去看診名單 (僅限過去日期) |
| `doc_opd_schedule` | 未來門診清單 |
| `doc_opd_patient_list_appointment` | 掛號名單 |
| `doc_batch_opd_note` | 批次門診病歷 (含防護機制) |
### Consent (4)
| Tool | 說明 |
|------|------|
| `consent_opschedule` | 手術排程 |
| `consent_list` | 同意書清單 |
| `consent_search` | 搜尋同意書 |
| `consent_pdf_bytes` | 下載 PDF |
### IVI (1)
| Tool | 說明 |
|------|------|
| `ivi_fetch_schedule` | IVI 排程 |
## 回傳格式
```json
{
"success": true,
"data": [...],
"message": "",
"count": 15
}
```
## 專案結構
```
vghsdk-mcp/
├── vghsdk_mcp.py # FastMCP 入口
├── pyproject.toml
└── vghsdk/
├── core.py # SessionManager, VghClient
├── utils.py # 日期轉換
└── tools/ # 27 個 MCP Tools
├── patient.py
├── surgery.py
├── doctor.py
├── consent.py
└── ivi.py
```
## 測試
### MCP Inspector
```bash
npx @modelcontextprotocol/inspector uv --directory /path/to/vghsdk run python -m vghsdk_mcp
```
## 授權
Private - Internal Use Only
## 作者
ZMH
TDQS
Scored across 27 tools
Most tools have clear list/detail pairings (e.g., patient_drug_list vs patient_drug_content), but there is potential confusion between consent_list and consent_search, and between patient_op_schedule and consent_opschedule. patient_opd_list_search also overlaps with patient_opd_list.
Tool names mostly follow a snake_case pattern with domain prefixes (e.g., patient_*, surgery_*, doc_*). Minor deviations like consent_opschedule and ivi_fetch_schedule break the noun_verb pattern, but overall the convention is consistent.
27 tools is heavy, but the server covers multiple hospital subsystems (patient records, surgery, OPD, drugs, consents, schedules). The count feels justified for the broad scope, though some consolidation could reduce redundancy.
The surface covers most hospital workflows: patient demographics, OPD/admission notes, surgery records and schedules, drug lists, consult notes, and consent management. Minor gaps exist (e.g., no lab results or allergy data), but the core needs are well covered.