Inspiration

Prior authorization is one of the most absurd bottlenecks in modern healthcare. A doctor knows what their patient needs. The insurance company demands a formal letter proving it. That letter takes 2–4 hours to write, requires ICD-10 codes, step therapy documentation, and payer-specific clinical framing — and 93% of physicians say it directly delays patient care. We built Prior Auth Copilot because that 2–4 hours should be 30 seconds.

What it does

Prior Auth Copilot is an MCP server that plugs into the Prompt Opinion platform and exposes three tools:

  • analyze_patient_fhir — takes a synthetic FHIR R4 patient bundle and extracts a structured clinical summary: diagnosis, severity indicators, treatment history, and justification hooks
  • draft_prior_auth — takes that summary plus a procedure/drug code and payer name, then generates a complete, formal prior authorization letter with ICD-10/HCPCS codes, medical necessity narrative, step therapy documentation, and the top denial risks with preemptive rebuttals
  • get_synthetic_fhir_example — returns a ready-to-use synthetic FHIR bundle for testing

Input a FHIR bundle. Get a submission-ready PA letter in seconds.

How we built it

  • MCP Server built with @modelcontextprotocol/sdk in Node.js, exposed over SSE via Express so it's connectable from any web-based agent platform
  • AI reasoning powered by Google Gemini 2.0 Flash — handles clinical summarization and letter drafting with structured JSON output
  • FHIR R4 synthetic data as the input standard, keeping the solution healthcare-interoperable from day one
  • Deployed to Prompt Opinion Marketplace where it can be discovered and invoked by any agent in the ecosystem

Challenges we ran into

Getting Gemini to return strict, parseable JSON consistently was the first hurdle — solved with explicit prompt constraints and a markdown-strip fallback parser. The bigger challenge was making the PA letter actually good, not just formally correct. A letter without step therapy documentation gets denied instantly, so we engineered the FHIR bundle and prompts to surface prior treatment failures as the narrative backbone of every letter.

Switching from stdio to SSE transport mid-build was also an unexpected detour — Prompt Opinion's platform requires HTTP-based transport, which meant refactoring the server and setting up ngrok for local development.

Accomplishments that we're proud of

The letter quality. When we ran our diabetes patient test case — metformin trial, inadequate glycemic control, escalation to Insulin Glargine — the output letter cited the correct HCPCS code (J1817), documented the step therapy timeline, and preemptively rebutted the most common denial reason insurers use. It scored 8/10 on medical necessity confidence. A real physician reviewed the output and called it "better than what most residents write."

What we learned

FHIR is the right abstraction layer for healthcare AI. By anchoring the input to a real interoperability standard, Prior Auth Copilot can theoretically slot into any EHR workflow without custom integration work. We also learned that the AI factor in healthcare isn't just about generating text — it's about understanding the bureaucratic logic of the system you're navigating. Payers have patterns. Denials are predictable. GenAI is uniquely good at modeling that.

What's next for Prior Auth Copilot

  • Multi-payer profiles — different insurers have different step therapy requirements; we want Gemini to adapt the letter framing per payer automatically
  • Denial appeal mode — a fourth tool that takes a denial letter as input and drafts a formal appeal
  • Real EHR integration — connecting to live FHIR endpoints (with proper auth) so the workflow is one click from the physician's dashboard
  • Approval probability scoring — train on historical PA outcomes to give physicians a realistic approval likelihood before they even submit ```

Built With

Share this project:

Updates