Skip to main content
Glama
fhir-journey-mcp
by Ath404

fhir-journey-mcp

A read-only MCP server that gives an AI agent a patient's context from any FHIR R4 server: who they are, when they were last seen, what is booked next, and which discharged patients never got a follow-up.

Hospitals already run HIS, EMR and scheduling systems that speak (some) FHIR. An agent that calls patients or answers the front desk needs that context before it says a word, and it should not need write access to get it.

Tools

Tool

What it answers

fhir_search_patients

Find a patient by name, phone, identifier (MRN, ABHA number) or birth date. Requires at least one filter.

fhir_get_patient_journey

Encounters + appointments as one dated timeline, last seen, next appointment, no-show and cancellation counts.

fhir_list_appointments

Appointments by patient, practitioner, status and date range, e.g. all noshow + cancelled last week to rebook.

fhir_find_open_slots

Free slots for a practitioner (chained through Schedule.actor) or schedule, earliest first. Does not book.

fhir_find_followups_due

Finished encounters in a window with no live follow-up within N days. Cancelled or no-show follow-ups don't count as booked. Each row says whether the window is already overdue or can still be met, and shows any follow-up booked too late.

fhir_find_followups_due output, from the live smoke run below:

[
  { "patient": "Meera Demo", "discharged": "2026-10-09T12:00:00.000Z", "dueBy": "2026-10-16T12:00:00.000Z", "lateBooking": "2026-10-28T10:00:00.000Z" },
  { "patient": "Rohan Demo", "discharged": "2026-10-13T12:00:00.000Z", "dueBy": "2026-10-20T12:00:00.000Z", "lateBooking": null }
]

Related MCP server: LangCare MCP FHIR Server

Run it

npm install
npm run build
FHIR_BASE_URL=https://your-server/fhir FHIR_TOKEN=... npx fhir-journey-mcp

Claude Desktop / any MCP client:

{
  "mcpServers": {
    "fhir-journey": {
      "command": "node",
      "args": ["/path/to/fhir-journey-mcp/dist/mcp/server.js"],
      "env": { "FHIR_BASE_URL": "https://hapi.fhir.org/baseR4" }
    }
  }
}

With no FHIR_BASE_URL it uses the public HAPI test server, which holds synthetic data only.

Verify it

npm test          # 22 offline tests against a fake FHIR server
npm run seed      # loads 4 synthetic patients with known answers, tagged per run
npm run smoke     # starts the server over stdio and checks every tool's answer

scripts/seed.ts documents the expected answers (who is booked, who is due, whose follow-up was cancelled and rebooked late). npm run smoke passes 10/10 against the public HAPI server.

Design choices

  • Read-only. Booking, cancelling and messaging patients belong behind a human or a separate, audited tool.

  • No full-table reads. Search tools refuse to run without a filter.

  • Ids are validated before they reach a URL path; a model can't turn patientId into ../Practitioner/1.

  • Paging links are only followed on the configured origin, so a bearer token is never sent to a host the server named in a next link.

  • Search URLs are redacted from errors, since they carry names and phone numbers.

  • GET retries on 408/429/5xx with backoff; transaction POSTs are never replayed.

  • Compact summaries, not raw resources: less token spend, fewer fields for a model to misread.

  • meta.tag filter on every search tool, for scoping to one tenant or one test dataset.

Not done / honest limits

  • Tested against HAPI FHIR only. Real hospital systems use FHIR profiles and partial implementations differently (chained search and _sort support vary). Not tested against any production EMR/HIS.

  • No ABDM gateway integration, consent artefact handling, or SMART-on-FHIR auth flow; it takes a bearer token you already have.

  • "Follow-up" means any live appointment for the patient after discharge, not one matched to the same department or condition.

  • fhir_find_followups_due makes one appointment query per patient (5 in parallel). Fine for a daily worklist, not for a 10,000-discharge backfill.

MIT licensed.

Available Tools

5 tools
fhir_find_followups_dueFollow-ups dueA

Finished encounters that ended in a date range with no live follow-up appointment booked within withinDays of discharge. Cancelled or no-show follow-ups do not count as booked. Returns the patients to contact, oldest discharge first, whether the window has already closed (overdue) or can still be met, and any follow-up booked too late.

Inputs: dischargedFrom (required), tag, withinDays, dischargedTo, +2 more.

fhir_find_open_slotsFind open slotsA

Free Slots in a date range, earliest first, for one practitioner or one schedule. Defaults to the next 7 days. Read-only: it does not hold or book the slot.

Inputs: to, tag, from, limit, +2 more.

fhir_get_patient_journeyPatient journeyA

One patient's encounters and appointments merged into a dated timeline, plus when they were last seen, their next upcoming appointment, and no-show/cancellation counts. Use this before contacting a patient so the agent knows their context.

Inputs: patientId (required), since.

fhir_list_appointmentsList appointmentsA

Appointments filtered by patient, practitioner, status and date range, soonest first. At least one of patientId, practitionerId, from or tag is required.

Inputs: to, tag, from, limit, +3 more.

fhir_search_patientsSearch patientsA

Find patients by name, phone, identifier (e.g. MRN or ABHA number, as system|value or value) or birth date. At least one filter is required. Returns compact summaries, not full resources.

Inputs: tag, name, limit, phone, +2 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.8/5.0

    Scored across 5 tools

    Disambiguation4/5

    Each tool targets a distinct resource or workflow: patient search, patient timeline, appointment listing, open slots, and follow-up detection. The only mild overlap is that get_patient_journey already embeds a patient's appointments while list_appointments offers a filtered appointment view, so an agent could occasionally hesitate on which to use for appointment data.

    Naming Consistency5/5

    All tools use a uniform fhir_ prefix followed by a consistent verb_noun pattern (search_patients, get_patient_journey, list_appointments, find_open_slots, find_followups_due). The convention is predictable and readable throughout.

    Tool Count5/5

    Five tools is well-scoped for a focused patient-journey server; each one earns its place covering search, context, appointments, availability, and follow-up detection without redundancy.

    Completeness3/5

    The read-only surface covers discovery and identification well, but the implied workflow dead-ends: find_open_slots explicitly cannot hold or book, and find_followups_due returns patients to contact with no tool to actually schedule the follow-up. Booking/rescheduling operations are notable gaps for the scheduling workflow the tools describe.

    Maintenance

    ActivityMaintained
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Provides safe read-only access to synthetic healthcare data via FHIR R4, enabling AI assistants to search patients, retrieve vitals, and summarize conditions using a public sandbox.
      4
      26 npm
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI agents to securely interact with FHIR R4-based EMRs, supporting read, search, create, and update operations on any FHIR resource type across systems like Epic, Cerner, and OpenEMR.
      311 npm
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables LLM agents to query de-identified FHIR-shaped hospital data through audited, read-only tools for patients, encounters, conditions, observations, medications, and interaction checks, while any medication write stays a draft that a clinician must confirm out-of-band.
      MIT
    • F
      license
      Not graded
      quality
      A
      maintenance
      Enables LLM-based agents to connect to a FHIR-compliant healthcare backend and query or manipulate clinical data with natural-language prompts. Provides full CRUD operations on FHIR resources, AI-powered document ingestion and semantic search, RAG-ready retrieval, and LOINC terminology lookup.
      -