Hospital Clinical Intelligence MCP Platform
Integrates healthcare data from multiple sources (HL7 v2, FHIR, DICOM, device telemetry) and provides clinicians with secure, role-based access to patient context, care unit summaries, device events, diagnostic exams, and other clinical data through specialized MCP tools.
README
Hospital Clinical Intelligence MCP Platform
A comprehensive clinical data integration and retrieval system built on the Model Context Protocol (MCP). This platform ingests healthcare data from multiple sources (HL7 v2, FHIR, DICOM, device telemetry), normalizes and contextualizes it, and provides secure, role-based access through standardized MCP tools.
Features
- Multi-Source Data Ingestion: HL7 v2, FHIR, DICOM, and device telemetry
- Data Normalization: Unified patient, encounter, and device ID mapping
- Clinical Context Engine: Event classification, timeline building, and confidence scoring
- 10 Specialized MCP Tools: Patient context, care unit summary, device events, diagnostic exams, and more
- Role-Based Access Control: Physician, nurse, technician, and administrator roles
- Comprehensive Audit Logging: Full compliance with healthcare regulations
- PHI Protection: Automatic masking and encryption of sensitive data
- High Performance: Sub-second response times with caching and optimization
System Requirements
- Python 3.11 or higher
- PostgreSQL 13 or higher
- Redis 6.0 or higher
- RabbitMQ 3.8 or higher
Installation
1. Clone the Repository
git clone https://github.com/hospital/clinical-mcp.git
cd clinical-mcp
2. Create Virtual Environment
python3.11 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
3. Install Dependencies
pip install -r requirements.txt
4. Configure Environment
cp .env.example .env
# Edit .env with your configuration
5. Initialize Database
# Run migrations
alembic upgrade head
Configuration
All configuration is managed through environment variables in the .env file. Key settings include:
Database
DATABASE_URL: PostgreSQL connection stringDATABASE_POOL_SIZE: Connection pool size (default: 20)
Redis
REDIS_URL: Redis connection stringREDIS_CACHE_TTL: Cache time-to-live in seconds (default: 3600)
RabbitMQ
RABBITMQ_URL: RabbitMQ connection stringRABBITMQ_QUEUE_*: Queue names for different data sources
Authentication
JWT_SECRET_KEY: Secret key for JWT tokensJWT_EXPIRATION_HOURS: Token expiration time (default: 24)OAUTH2_PROVIDER_URL: OAuth2 provider URLLDAP_SERVER_URL: LDAP server URL
Data Ingestion
HL7_LISTENER_PORT: HL7 listener port (default: 2575)DICOM_LISTENER_PORT: DICOM listener port (default: 11112)FHIR_SERVER_URL: FHIR server URL
Running the Application
Development
python main.py
The API will be available at http://localhost:8000
Production
uvicorn main:app --host 0.0.0.0 --port 8000 --workers 4
API Documentation
Once the application is running, visit:
- Swagger UI:
http://localhost:8000/api/docs - ReDoc:
http://localhost:8000/api/redoc
Project Structure
hospital-clinical-mcp/
├── main.py # FastAPI application entry point
├── config.py # Configuration management
├── requirements.txt # Python dependencies
├── pyproject.toml # Project metadata
├── .env.example # Environment variables template
├── .gitignore # Git ignore rules
│
├── mcp_server/
│ ├── __init__.py
│ ├── routers/ # API route handlers
│ ├── models/ # Database models and schemas
│ ├── tools/ # MCP tool implementations
│ ├── ingestion/ # Data ingestion modules
│ ├── normalization/ # Data normalization and mapping
│ ├── context_engine/ # Clinical context engine
│ ├── security/ # Authentication and authorization
│ ├── database/ # Database connection and migrations
│ └── utils/ # Utility modules
│
└── tests/ # Test suite
├── unit/ # Unit tests
├── integration/ # Integration tests
└── fixtures/ # Test fixtures and data
Development
Running Tests
# Run all tests
pytest
# Run with coverage
pytest --cov=mcp_server
# Run specific test file
pytest tests/unit/test_validators.py
# Run with verbose output
pytest -v
Code Quality
# Format code
black mcp_server tests
# Check code style
flake8 mcp_server tests
# Type checking
mypy mcp_server
# Sort imports
isort mcp_server tests
MCP Tools
The platform provides 10 specialized MCP tools:
- get_patient_clinical_context: Retrieve comprehensive clinical context for a patient
- get_care_unit_summary: Get summary of all patients in a care unit
- get_device_events_by_patient: Retrieve device events and alarms for a patient
- get_diagnostic_exam_context: Get diagnostic exam context with findings
- get_patient_event_timeline: Retrieve chronological timeline of clinical events
- get_alarm_context: Get detailed context for a specific alarm event
- get_imaging_study_summary: Retrieve imaging study summaries with findings
- get_anesthesia_case_context: Get comprehensive anesthesia case context
- get_neuro_event_context: Retrieve neurological event context
- get_cardiology_event_context: Get cardiac event context
Security
- Authentication: OAuth2/JWT with LDAP integration
- Authorization: Role-based access control (RBAC)
- Encryption: TLS for data in transit, encryption at rest for sensitive data
- Audit Logging: Comprehensive logging of all data access
- PHI Protection: Automatic masking of protected health information
Performance
- Response Times: < 500ms for patient context queries
- Concurrency: Support for 100+ concurrent clinicians
- Caching: Redis-based caching for frequently accessed data
- Indexing: Optimized database indexes for fast retrieval
Compliance
- HIPAA: Full compliance with HIPAA regulations
- Data Retention: 7-year retention policy for clinical data and audit logs
- Audit Trail: Complete audit trail of all data access
- Consent Management: Patient consent checking before data access
Troubleshooting
Database Connection Issues
# Check PostgreSQL connection
psql -h localhost -U user -d hospital_clinical_mcp
# Check connection string in .env
DATABASE_URL=postgresql+asyncpg://user:password@localhost:5432/hospital_clinical_mcp
Redis Connection Issues
# Check Redis connection
redis-cli ping
# Check Redis URL in .env
REDIS_URL=redis://localhost:6379/0
RabbitMQ Connection Issues
# Check RabbitMQ connection
rabbitmqctl status
# Check RabbitMQ URL in .env
RABBITMQ_URL=amqp://guest:guest@localhost:5672/
Contributing
- Create a feature branch:
git checkout -b feature/your-feature - Commit changes:
git commit -am 'Add your feature' - Push to branch:
git push origin feature/your-feature - Submit a pull request
License
MIT License - See LICENSE file for details
Support
For support, contact the Hospital IT Team at it@hospital.local
Changelog
Version 0.1.0 (Initial Release)
- FastAPI project structure and dependencies
- Configuration management with environment variables
- Basic health check endpoints
- Logging and validation utilities
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。