vClinic MCP Server
Enables AI agents to manage virtual clinic data including patients, visits, diagnoses, treatments, lab/radiology orders, and search medical literature and internal knowledge base.
README
vClinic MCP Server
A Model Context Protocol (MCP) server that exposes a virtual clinic's clinical data and knowledge base as tools for AI agents. Agents can manage patients, visits, diagnoses, treatments, lab orders, radiology orders, and search both external medical literature and an internal RAG knowledge base.
Features
| Category | Tools |
|---|---|
| Patients | create_patient, get_patient, search_patients |
| Visits | create_visit, get_visit, get_visits_for_patient, update_visit |
| Diagnoses | create_diagnosis, update_diagnosis, get_diagnoses_for_visit |
| Treatments | create_treatment, update_treatment, get_treatments_for_visit |
| Lab | create_lab_order, get_lab_order, get_pending_lab_orders, update_lab_order_status, create_lab_result, get_lab_results, update_lab_result |
| Radiology | create_radiology_order, get_radiology_order, get_pending_radiology_orders, update_radiology_order_status, create_radiology_report, get_radiology_report, update_radiology_report |
| Knowledge search | search_pubmed, get_clinical_guidelines, search_clinic_knowledge |
| Staff | seed_staff |
All tool calls are audit-logged to data/audit.log (HIPAA § 164.312(b)).
Project Structure
vClinic-mcp-server/
├── server.py # MCP server entry point
├── audit_logger.py # HIPAA audit log decorator
├── sample_client.py # Test client using langchain-mcp-adapters
├── requirements.txt
├── backend/
│ ├── db.py # SQLite connection & init
│ └── schema.sql # Synthea-aligned schema + operational tables
├── tools/
│ ├── patient_tools.py
│ ├── visit_tools.py
│ ├── diagnosis_tools.py
│ ├── treatment_tools.py
│ ├── lab_tools.py
│ ├── radiology_tools.py
│ ├── medical_search_tools.py
│ └── ...
├── rag_tools/
│ └── rag_tools.py # Pinecone RAG — indexes knowledge_base/
├── knowledge_base/
│ ├── drug_formulary.md
│ ├── clinical_protocols.md
│ └── clinic_sops.md
└── data/
├── vclinic.db # SQLite database (created on first run)
└── audit.log # Append-only CSV audit trail
Requirements
- Python 3.11+
- Pinecone local dev server running on
http://localhost:5080 - OpenAI API key (for
text-embedding-3-smallembeddings and agent LLM calls)
Setup
# 1. Create and activate a virtual environment
python -m venv .venv
source .venv/bin/activate
# 2. Install dependencies
pip install -r requirements.txt
# 3. Set your OpenAI API key
export OPENAI_API_KEY=sk-...
Running the Server
# Normal start — creates the DB on first run, loads the Pinecone index
python -m server
# Wipe and recreate the database (drops all patient data)
python -m server --reinit
On startup the server will:
- Create
data/vclinic.dband seed default staff (first run only, or with--reinit). - Build or load the Pinecone knowledge-base index (
vclinic-knowledge).
Running the Sample Client
The sample client connects to the server over stdio and lists all registered tools:
python sample_client.py
# Start the server with a fresh database
VCLINIC_REINIT=1 python sample_client.py
Knowledge Base (RAG)
Internal clinic documents in knowledge_base/ are indexed into Pinecone at server startup:
| File | Content |
|---|---|
drug_formulary.md |
Approved medications, dosing, formulary tiers, contraindications |
clinical_protocols.md |
CAP, AGE, HTN, T2DM, fever treatment protocols |
clinic_sops.md |
Registration, vitals, lab/radiology ordering, discharge SOPs |
The search_clinic_knowledge tool performs semantic search over these documents. If the Pinecone index already exists and contains vectors it is reused; otherwise it is built from scratch (requires an active OpenAI API key).
To force a re-index, delete the Pinecone index and restart the server.
Audit Logging
Every tool call is appended to data/audit.log as a CSV row containing:
| Field | Description |
|---|---|
event_id |
UUID per call |
timestamp |
UTC ISO-8601 |
tool |
Tool function name |
args |
JSON-encoded arguments |
outcome |
SUCCESS or ERROR |
detail |
Error message (if any) |
VS Code / Claude Desktop Configuration
{
"mcpServers": {
"vclinic": {
"command": "python",
"args": ["-m", "server"],
"cwd": "/path/to/vClinic-mcp-server",
"env": {
"OPENAI_API_KEY": "sk-..."
}
}
}
}
⚠️ License & Disclaimer
This project is a Proof of Concept (POC) and is intended solely for demonstration and educational purposes.
- No Liability: The code owner accepts no responsibility for any damages, data loss, or issues caused by running this software.
- As-Is: This software is provided as-is, without warranty of any kind, express or implied, including but not limited to warranties of merchantability, fitness for a particular purpose, or non-infringement.
- Not for Clinical Use: This system must not be used to inform, support, or replace real clinical decisions, diagnoses, or patient care of any kind. All data used is fully synthetic and has no connection to real patients or medical records.
- License: Distributed under the MIT License.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。