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
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.