MCP Healthcare Reference
InvariantsArchitectureEMA alignmentToken contractPhase gatesConsistency reviewDocumentsGlossary
Reference implementation · Home lab · HIPAA-shaped controls

An enterprise MCP platform, proven end to end on one box

Four client populations reach two classes of MCP destination through a Kong gateway estate, under a single-issuer token model (Keycloak), sender-constrained tokens (mTLS for workloads, DPoP for workforce), egress DLP, and a vault-backed vendor token broker. Every contested design decision runs as executable acceptance gates — phases 0–7, all green on the last full run (2026-10-01).

Phases 0–7 green (last full run 2026-10-01)
Red-team suite: 32 passed, 0 xfail
1 open gap: external-tier CIMD origin allowlist (#3, follow-up #23); MCP 2026-07-28 migration (#8) done 2026-09-30
EMA (stable ext-auth spec) terminology aligned
DPoP sender-constraint (RFC 9449) proven end-to-end
The fidelity contract

Five invariants, never stubbed

Every section of the architecture elaborates one of these; the lab is only useful because each is actually enforced and tested.

One token issuer

Keycloak mints every token the gateway or an MCP server validates. The workforce IdP, the workload identity system, Auth0, and a legacy in-house AS authenticate their populations; none of their tokens reach the plane directly.

PHI stays inside the boundary

The Konnect control plane sees configuration and aggregate telemetry only; vendor clouds receive only DLP-screened, allowlisted tool traffic; audit flows to the customer SIEM.

Stateless MCP from day one

No protocol session. Identity and capabilities ride every request; continuity uses explicit handles like slot_hold_id, so any request can hit any replica.

Governance at two layers

Enterprise-Managed Authorization / IdP policy governs connections — the spec scopes IdP visibility to token issuance (EMA §7.2). Kong ACLs and server scope checks govern tool calls.

Every transitional piece has an exit

The legacy in-house AS sunsets into the workload-identity path + Keycloak; the vendor token broker shrinks vendor-by-vendor as ID-JAG adoption spreads; the workforce IdP's brokered leg upgrades in place to EMA.

Master diagram

Every population, token path, and flow

Solid edges are current state. Dashed labeled edges are the future EMA (ID-JAG) upgrade paths; unlabeled dashed edges feed the audit spine. The egress feed is drawn from the internal-agents node for routing clarity — developer clients reach it through the same private ingress.

Audit spine

SaaS vendor (GitHub)

First-party MCP servers (Resource Servers)

Kong gateway tiers (DPs in the enterprise cloud)

Identity plane

MCP Clients

OIDC broker (today)

OIDC broker

RFC 8693 token exchange (sunsetting)

X.509 SVID

authorization code + PKCE

auth code + PKCE + DPoP proof
→ cnf.jkt-bound token (RFC 9449)

tls_client_auth client credentials → cnf.x5t#S256-bound token

authorization code + PKCE (pre-registered)

authorization code + PKCE (Auth0 brokered)

issues ID-JAG (EMA §4, future)

ID-JAG as JWT authorization grant
(RFC 7523, EMA §5, future)

Pattern A — EMA direct (ID-JAG),
per-vendor after risk assessment

hub JWT via VPN (bearer)

hub JWT + fresh DPoP proof per request

hub JWT + mTLS

hub JWT via WAF

hub JWT via WAF

servers re-validate cnf/DPoP — never trust the DP

curated catalog · patient-compartment tools

workload mTLS service creds (no token transit)

vendor-bound tool calls

resolve (mTLS + hub JWT)

consent dance · single-flight refresh · RFC 7009 revoke

tool call — vendor token injected, hub JWT stripped

Workforce interactive clients
Claude Code · Codex CLI · VS Code
(bearer today)

Workforce DPoP client
(workforce-dpop) — sender-constrained

Internal autonomous agents
(loop agent)

External SaaS agents + B2B
ChatGPT · partners

End-customer clients
(patient-facing agents)

Workforce IdP (e.g., Ping)
(EMA IdP Authorization Server)

Auth0 — end customers

Legacy in-house AS
(transitional, frozen)

Workload identity
short-lived X.509 SVIDs

Keycloak realm mcp-plane
sole Resource Authorization Server
named in every server's RFC 9728 PRM

Internal DP
JWT + cnf(mTLS) + DPoP checks · mcp://tier/internal

External DP (WAF front)
curated catalog · mcp://tier/external

Egress tier
vendor allowlist · DLP · vendor-token injection

scheduling — stateless, explicit handles

fhir-clinical — patient-compartment enforced

FHIR R4 backends
Epic · Cerner

Vendor Token Broker
OAuth client + custodian — never issues tokens

Vault custody
per vendor + hub sub

GitHub Authorization Server
(vendor Resource Authorization Server)

GitHub MCP server
(Resource Server)

OTel / log shipping

SIEM — jti-joinable audit tuple

The diagram renders at full size — scroll horizontally inside the panel to pan. Keycloak (realm mcp-plane) is the sole Resource Authorization Server, named in every server's RFC 9728 Protected Resource Metadata. Tier audiences make cross-tier replay fail cryptographically; the hub JWT stops at the component that validated it.

Spec alignment

Enterprise-Managed Authorization, mapped

The MCP Enterprise-Managed Authorization extension (stable, modelcontextprotocol/ext-auth) applies the Identity Assertion JWT Authorization Grant (ID-JAG): RFC 8693 token exchange at the IdP, then an RFC 7523 JWT authorization grant at the Resource Authorization Server. This platform was designed for that shape before it stabilized.

EMA role (spec §1.2)This platformStatus
MCP ClientClaude Code, the DPoP harness client, the loop agent, and the patient agent are registered in the lab; Codex CLI, VS Code, ChatGPT and partner apps are target-stateIn place (lab clients)
MCP Server (Resource Server)First-party servers (scheduling, fhir-clinical) and vendor MCP serversIn place
Resource Authorization ServerKeycloak realm mcp-plane, advertised in every server's RFC 9728 PRMIn place
IdP Authorization ServerWorkforce IdP (e.g., Ping), Auth0 (patients) — brokered today, ID-JAG issuers tomorrowAwaiting vendor ID-JAG
Discovery (spec §6)urn:ietf:params:oauth:grant-profile:id-jag in authorization_grant_profiles_supported — drives broker sunset criteriaSunset trigger
resource = RFC 9728 identifier (spec §4)Lab uses opaque mcp:// URIs — a documented deviation (issue #13, closed as documented)Documented deviation
Claims contract

One canonical JWT, five grant paths

Kong ACLs, server permission logic, and SIEM parsing are written once against one claim vocabulary, regardless of which grant path produced the token.

Always present

iss exact issuer · sub, azp, exp, iat — servers reject a token missing any of them · aud = exactly one tier audience (mcp://tier/*) plus server URIs (mcp://srv/*) · jti joins every audit record · mcp_tier, idp_origin, mcp_contract pins · PS256/ES256 only, 5–10 minute lifetimes.

Conditional, enforced both ways

cnf sender-constraint — x5t#S256 (mTLS) on the m2m path and jkt (DPoP, RFC 9449) on the DPoP workforce path, each rejected without its matching binding · fhir_patient mandatory on the patient path, forbidden elsewhere — a hard compartment filter on every FHIR query · act carries delegation chains · amr on interactive paths — clinical step-up scopes (MCP_MFA_SCOPES) are refused without mfa (401 insufficient_user_authentication, RFC 9470) · directory PII is forbidden in access tokens.

Executable acceptance

Phase gates, in order

A phase is done only when tests/phaseN.sh is green. All eight were on the last full run (2026-10-01, after both hardening passes): all 159 tests across phases 1–7 passed, none skipped (the real-GitHub egress leg included), plus the phase-0 smoke checks.

0 · Skeleton

tests/phase0.sh

Keycloak + Postgres + HAPI FHIR + Grafana stack; ~50 Synthea patients; hub realm from a git-tracked export.

1 · Identity hub

tests/phase1.sh · 72 tests

A fake-Ping Keycloak realm, real Auth0, and a toy homegrown issuer all normalize to contract-conformant JWTs from the single issuer.

2 · Gateway tiers

tests/phase2.sh · 11 tests

Konnect CP + local DPs; cross-tier replay fails in both directions; ACL misses are 403, not 401; DPs keep serving with the CP uplink severed.

3 · First-party MCP

tests/phase3.sh · 12 tests

Generated FHIR server + hand-built stateless scheduling server; speaks MCP 2026-07-28 through the gateway and still serves 2025-era clients; scope step-up via single-shot insufficient_scope challenges, an MFA mark on the clinical step-up token, and JSON-RPC batches refused so no call slips past it; replica kill mid-conversation survives.

4 · Cert-bound m2m

tests/phase4.sh · 9 tests

SPIRE-issued SPIFFE certs; client-x509 at Keycloak; the cnf-check plugin rejects tokens without the presenting cert.

5 · Egress + broker

tests/phase5.sh · 17 tests

Vendor Token Broker over OpenBao custody; DLP blocks planted MRNs and SSNs, JSON-escaped ones included; 20 parallel resolves produce exactly one vendor refresh (single-flight + generation CAS).

6 · Audit spine

tests/phase6.sh · 6 tests

One Loki query keyed by jti walks a vendor call across gateway verdicts, broker resolve, and the vendor action.

7 · Red team

tests/phase7.sh · 32 tests

Cross-tier replay, scope-ceiling probes, broker state replay, RFC 9207 iss tamper and omission, mass-STALE storm, token-in-log grep, URL-form client_id (CIMD) refusal, the broker's no-issuance rule, and DPoP sender-constraint (RFC 9449).

Verification

Code ↔ docs consistency review

Three independent review passes (broker vs design doc; servers, plugins, and agent vs claims contract; realm, gateway config, tests, and READMEs vs the doc set) verified the implementation against the documents, July 11, 2026. Verdict: faithful on every security-critical mechanic — single-flight refresh with generation CAS, RFC 9207 iss and iss-omission defense, PKCE S256 with single-use state, PS256/ES256 pinning with contract-exact claims, compartment filtering, mass-STALE paging, fail-closed vault, and the broker no-issuance rule all hold in code as documented.

FindingResolution
Auth0-origin token missing fhir_patient fell through to workforce handlingFixed in both servers: required-direction check added alongside the forbidden-direction check (contract §8)
Broker doc self-conflict (§4.3 vs §10) and four production-vs-lab deltas undeclaredDoc reconciled; new broker design §16 "Lab implementation deltas" declares them in one place
Stale xfail language in three test docs contradicted the green phase-7 suiteCorrected — all probes are plain asserts; issues #1/#2 recorded as closed
Dangling bin entry pointed at a CLI that never existedRemoved from fhir-clinical/package.json
Wildcard redirect URIs in the realm (RFC 9700 exact-match)Fixed — exact /callback registrations, crafted paths refused at the auth endpoint (issue #15 closed 2026-07-16)
Scheduling server lacks the Origin/Host rebinding guard fhir-clinical hasFixed — guard ported verbatim; both servers reject rebound Host / foreign Origin; phase-3 gate green (issue #16 closed 2026-07-16)
sol-rec*.md external-review scratch files, fully triagedRemoved; every open finding now lives in the issue tracker

Repository audit — September 30, 2026

A full repository audit (AUDIT.md, a point-in-time record taken before the fixes) re-read the code, reproduced findings on a fresh clone, and checked every claim in the docs. Its fixes shipped as release 2.0.0 (CHANGELOG.md); a second pass (2.0.1) made every phase start from a clean clone. The security findings:

FindingResolution
High: wrapping a tool call in a JSON-RPC batch skipped the per-tool scope check, so a token without the step-up scope could call patientEverythingFixed — batches are refused (-32600) and every tool handler re-checks the policy; a phase-3 probe proves it
Medium: egress DLP matched raw bytes only, so a JSON-escaped MRN passed and decoded at the vendorFixed — dlp-egress also screens every JSON-decoded string and key, and denies declared-JSON bodies that do not parse; a phase-5 probe proves it
Clinical scopes were documented as needing an MFA mark, but nothing enforced itFixed — the FHIR server refuses MCP_MFA_SCOPES calls without amr∋mfa (401 insufficient_user_authentication, RFC 9470)
dpop-check read only the first DPoP header; vendor-token had no explicit handling for DPoP-scheme tokensFixed — the gateway sees every DPoP header; vendor-token refuses DPoP-scheme tokens with a clear 401 and malformed broker replies with 502
Servers spoke MCP 2025-11-25 while docs claimed 2026-07-28 (#8)Fixed — both servers run MCP 2026-07-28 on SDK v2 from one shared resource-server core; verifiers now require every contract-mandatory claim
Dependency advisories (npm, PyJWT, starlette); broker 500s on bad input; non-constant-time secret compare in the legacy issuer stand-inFixed — advisories cleared and CI fails on new high-severity ones; broker returns 4xx problems without exception text; constant-time compare, non-root image
No offline tests; phases 0 and 2–4 failed from a clean cloneFixed — make test runs 248 offline tests (servers 89, broker 97, Kong plugins 47, kit vectors 15); CI adds lint, CodeQL, Dependabot, and phase 0–1 clean-clone smoke runs
The document set

Where the authority lives

The design documents below live in the project's public source repository; the paths are cited here as provenance. The rendered tours are hosted on this site.

Design authority — source repository

Enterprise rollout kit — source repository

The lab is being packaged into a portable kit a delivery team can take into any enterprise — the lab stays the reference implementation; the kit is what travels.

Rendered tours — on this site

Terms used on this site

Glossary