MedBridge

Inspiration

Nurses spend 30-45 minutes per shift manually compiling patient handover reports across multiple EHR screens. This time sink contributes to burnout and creates opportunities for communication errors during shift changes. We wanted to give nurses that time back by automating the handover workflow through an AI assistant that could directly access live FHIR data.

What it does

MedBridge is an MCP (Model Context Protocol) server that exposes 8 clinical tools to AI assistants:

Read tools:

  • get_patient_vitals - Retrieves vital signs with trend analysis
  • get_recent_nurse_notes - Accesses nursing documentation from previous shifts
  • handover_summary - Generates SBAR-format handover reports for single patients
  • batch_handover - Creates risk-prioritized summaries for multiple patients at once

Write tools:

  • log_vitals - Records new vital observations back to the EHR
  • escalate_to_attending - Triggers clinical escalation workflows with audit trails

UI tools (MCP Apps):

  • vital_trends_dashboard - Renders interactive charts via MCP resource protocol
  • patient_education_generator - Creates personalized patient education materials

The server runs on Cloudflare Workers at the edge, returning sub-100ms response times.

How we built it

Architecture:

  • TypeScript on Cloudflare Workers for edge deployment
  • MCP JSON-RPC 2.0 protocol for standardized tool interfaces
  • FHIR R4 client for universal healthcare data access (works with Epic, Cerner, any FHIR server)
  • SHARP (Secure Healthcare Access and Retrieval Protocol) for credential management

SHARP Protocol: Instead of hardcoding credentials, we extract four headers from every request:

  • X-FHIR-Server-URL - The FHIR endpoint
  • X-FHIR-Access-Token - OAuth bearer token
  • X-Patient-ID - Currently selected patient
  • X-API-Key - Server authentication

This allows PromptOpinion (or any MCP client) to automatically inject context without the AI needing to manage secrets.

MCP Apps: UI tools return ui:// resource URIs instead of text. The client fetches these via resources/read and renders them as embedded iframes. This enables interactive dashboards directly in chat interfaces.

Challenges we ran into

Batch handover edge cases: Initial implementation required explicit patient IDs. We refactored to accept empty arrays and fall back to the FHIR context patient ID, matching the behavior of other tools.

MCP resource protocol: Getting the resources/list and resources/read handlers working for UI tools took several iterations. The spec is still evolving, so we had to test against the actual PromptOpinion implementation rather than just the docs.

Clinical accuracy: Early SBAR generation was too generic. We added specific hypertension staging (Stage 1 vs Stage 2), proper trending (percentage change from baseline), and realistic thresholds (160/100 for provider notification).

FHIR pagination: Large note sets would timeout. We added 12-hour windows and result limiting to keep responses fast.

Accomplishments that we're proud of

Working write-back: Most healthcare AI demos are read-only. We actually create FHIR Observation resources when logging vitals and CommunicationRequest resources for escalations, with full audit trails.

Risk prioritization: The batch handover tool automatically sorts patients by criticality (critical → moderate → low) and flags urgent cases (BP >180/110 with symptoms) for immediate attention.

No hardcoded secrets: Every tool call uses the SHARP header injection. The server itself has zero knowledge of which FHIR server it's talking to until the request arrives.

Edge deployment: Sub-100ms cold starts on Cloudflare Workers, with the MCP server deployed globally.

What we learned

MCP protocol design: Resources and tools are complementary. Tools do work, resources fetch data. UI tools blur this line in interesting ways.

FHIR complexity: Even "simple" operations like logging a vital sign require creating an Observation resource with proper coding (LOINC), references to the patient and encounter, and effective timestamps. We abstracted this, but building the abstraction taught us a lot.

Context is everything: The X-Patient-ID header auto-update is the feature nurses actually care about. Not having to type patient IDs into chat is a small thing that makes a big difference.

What's next for MedBridge

Medication reconciliation: Add a tool to compare current meds against new orders and flag interactions or omissions during handover.

Lab integration: Pull recent lab results (CBC, BMP, cultures) into the handover summary with trend arrows.

Wider EHR support: Test against more FHIR implementations (Athenahealth, Allscripts) to ensure compatibility beyond Epic/Cerner.

Audit dashboard: Build a UI tool that shows which handovers were generated, when, and by which AI agent for compliance tracking.

Built With

Share this project:

Updates