Skip to main content
Glama
ShaikHafiz-1

Hospital Clinical Intelligence MCP Platform

by ShaikHafiz-1

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 string

  • DATABASE_POOL_SIZE: Connection pool size (default: 20)

Redis

  • REDIS_URL: Redis connection string

  • REDIS_CACHE_TTL: Cache time-to-live in seconds (default: 3600)

RabbitMQ

  • RABBITMQ_URL: RabbitMQ connection string

  • RABBITMQ_QUEUE_*: Queue names for different data sources

Authentication

  • JWT_SECRET_KEY: Secret key for JWT tokens

  • JWT_EXPIRATION_HOURS: Token expiration time (default: 24)

  • OAUTH2_PROVIDER_URL: OAuth2 provider URL

  • LDAP_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:

  1. get_patient_clinical_context: Retrieve comprehensive clinical context for a patient

  2. get_care_unit_summary: Get summary of all patients in a care unit

  3. get_device_events_by_patient: Retrieve device events and alarms for a patient

  4. get_diagnostic_exam_context: Get diagnostic exam context with findings

  5. get_patient_event_timeline: Retrieve chronological timeline of clinical events

  6. get_alarm_context: Get detailed context for a specific alarm event

  7. get_imaging_study_summary: Retrieve imaging study summaries with findings

  8. get_anesthesia_case_context: Get comprehensive anesthesia case context

  9. get_neuro_event_context: Retrieve neurological event context

  10. 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

  1. Create a feature branch: git checkout -b feature/your-feature

  2. Commit changes: git commit -am 'Add your feature'

  3. Push to branch: git push origin feature/your-feature

  4. 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

A
license - permissive license
-
quality - not tested
C
maintenance

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ShaikHafiz-1/HIS_Infra_MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server