Co-Pilot Using AI Agents and Model Context Protocol (MCP)
Client is a healthcare analytics ISV enabling hospitals and research organizations to transform raw clinical data into actionable insights.
A repeat customer of Pegasus One, the Client previously partnered with us for the successful launch of their SMART on FHIR app across major EHR platforms including Epic, Cerner, and eClinicalWorks.
Building on that success, as part of their AI innovation roadmap, the client envisioned a conversational AI Co-pilot capable of assisting clinical researchers and physicians in analyzing both patient-level and cohort-level data through natural language queries.
The Challenge.
While the client’s analytics engine could aggregate large datasets from Epic, Cerner, and eClinicalWorks (eCW), interpreting this data required complex queries and specialized users. The organization wanted to:
- Make Data Accessible: Make longitudinal patient and cohort data accessible conversationally.
- Ensure Security & Compliance: Ensure security, compliance, and context persistence across research workflows.
- Allow Real-Time Reasoning: Allow real-time reasoning over FHIR data without exposing raw EHR details.
- Eliminate Manual Processes:The manual process was also slow and resource intensive.
Solution.
AI Co-Pilot powered by MCP and AI Agents
Pegasus One partnered with the client to develop Chartie, an AI-powered Cohort Co-Pilot leveraging Model Context Protocol (MCP) and FHIR data normalization.
MCP acts as the middleware between the FHIR data repository and the AI reasoning layer, providing structured, de-identified, and normalized clinical context to AI agents.
These AI agents interpret questions, fetch relevant clinical context, and respond with research-grade, evidence-based summaries.
Architecture Overview.
FHIR Data Layer
Aggregated patient data from Epic, Cerner, and eCW using Pegasus One’s SMART on FHIR backend integration.
AI Agent Framework
- Multi-agent orchestration using LangChain / LangGraph to coordinate between:
- Data Agent (FHIR retrieval)
- Clinical Agent (reasoning over diagnoses and labs)
- Research Agent (cohort-level analytics)
Model Context Protocol (MCP)
Serves as the context orchestrator, transforming raw FHIR JSON into simplified structured context (e.g., diagnoses, medications, lab results).
RAG (Retrieval-Augmented Generation):
Enriches answers with trusted medical literature (e.g., PubMed, Mayo Clinic, CDC).
Analytics and Visualization
Chartie could answer cohort-level questions using built-in analytics capabilities including dynamic charts, graphs, and regression analysis.
This allowed users to visualize patterns, correlations, and outcomes in real time.
Developing this capability required solving the complex challenge of maintaining AI context across patient- and cohort-level reasoning, ensuring results remained clinically valid and explainable.
UI Integration
Embedded chat assistant that toggles context dynamically, from cohort view to patient view based on user navigation.
Example Queries.
Cohort Level
- List patients who developed sepsis within 30 days of knee surgery.
- Show antibiotic prescribing trends among pediatric patients.
Patient Level
- Summarize this patient’s last 3 encounters and identify any abnormal lab trends.
- What post-surgical complications did this patient experience in the last 90 days?
Benefits.
- AI-driven contextual search: Query thousands of patient records using natural language.
- Research-ready summaries: Combines structured data and medical literature dynamically.
- Data-aware reasoning: AI agents use real patient context via MCP, improving response relevance.
- HIPAA-safe architecture: PHI never leaves the secured environment.
Impact & KPIs.
| Metric | Result |
|---|---|
| Average Query Response Time | <5 seconds |
| Research Query Success Rate | 93% accuracy |
| Reduction in Manual Data Review | 70% |
| Analyst Productivity Gain | +60% |
Future Enhancements.
- FHIR Task Integration: Send test recommendations directly to EHRs.
- CDS Hooks: Trigger clinical decision support alerts at population level.
- FHIR Write-back: Push AI recommendations into EHR