Inspiration

Prior authorization is one of healthcare's most broken processes. Doctors spend an average of 14 hours per week on insurance paperwork. Patients wait 2 weeks or more for approval , and some never get it , some may stay suffer just because of this delay , and what to do about who his case is urgent , we need a fast solution , because when it comes to healthcare , each second counts . We built CareFlow because that wait is not a bureaucratic inconvenience. It costs lives.

What it does

CareFlow is an MCP (Model Context Protocol) server that automates the entire prior authorization workflow for any AI agent or healthcare system:

  • Prior Auth Check : instantly looks up payer requirements for any drug or procedure
  • Medical Necessity Assessment : evaluates clinical criteria against patient FHIR records
  • Approval Likelihood Estimation : predicts approval odds based on clinical evidence
  • Appeal Letter Generation : drafts a complete, clinician-ready appeal letter in seconds

Any AI agent can connect to CareFlow via MCP and handle prior auth end-to-end , what used to take 2 weeks now takes 30 seconds.

How we built it

  • MCP StreamableHTTP transport (stateless) compatible with any MCP client
  • FHIR R4 for real patient data ingestion via HAPI FHIR
  • Gemini 2.5 Flash via Google service account OAuth for clinical reasoning
  • Prompt Opinion SHARP headers for patient context injection
  • Railway for live cloud deployment with zero cold-start

Challenges we ran into

Building a stateless MCP server that handles real clinical data while keeping latency low was the core challenge. Getting Google Vertex AI credentials to work reliably in a containerized Railway environment required significant debugging. We also had to design the appeal letter tool to produce output that reads like it was written by a clinician, not a chatbot.

What we learned

Healthcare AI needs to be infrastructure, not just an interface. The real value is not in the chat , it is in the layer that connects AI reasoning to existing medical workflows and data standards like FHIR.

What's next for CareFlow

  • Connect to real payer APIs for live formulary and criteria data
  • Add EHR integrations (Epic, Cerner) via SMART on FHIR
  • Support multi-step autonomous prior auth submission
  • HIPAA compliance layer for production healthcare use

Built With

  • fhir-r4
  • gemini-2.5-flash
  • google-auth
  • google-vertex-ai
  • hapi-fhir
  • httpx
  • mcp-(model-context-protocol)
  • nixpacks
  • python
  • railway
  • starlette
Share this project:

Updates