Read a bounded chart surface
Search and chart reads are explicit tools over FHIR. The backend remains the system of record and access-control boundary.
Open-source clinical agent infrastructure
Last EHR defines and tests a small protocol for agent-initiated FHIR writes: show the exact proposed resource, require an explicit human decision, commit exactly what was reviewed, and record what created it. The live demo is its reference implementation.
Proposal → Decision → Commit → AuditApproval-Gated Agent Writes on FHIR, v0.1 draft
Agent request
record_observation({
patientId: "<synthetic-patient-id>",
label: "Heart rate",
value: 72,
unit: "bpm"
})needsApproval: true
The UI is not the authorization layer. It makes the proposed change inspectable before the backend receives it.
The safety contract
Last EHR does not claim to replace backend policy or clinical judgment. It gives the agent a small, inspectable surface and makes the point of human review impossible to miss.
Read the approval modelSearch and chart reads are explicit tools over FHIR. The backend remains the system of record and access-control boundary.
A note, observation, or follow-up task is shown as a concrete FHIR-shaped change, not hidden as an agent side effect.
The write tool pauses. A reviewer can inspect, approve, or cancel before anything reaches the chart — and every ambiguous outcome fails closed.
Nothing beyond the reviewed proposal saves except mechanical metadata. Every agent write carries the standard AIAST security label, with optional Provenance recording an author agent and a human verifier.
One protocol, two running bindings
Approval-Gated Agent Writes on FHIR is a v0.1 draft of the layer between “the agent wants to write” and “the chart changed”: Proposal → Decision → Commit → Audit. CDS Hooks owns EHR-initiated suggestions, the AI Transparency IG owns after-the-fact provenance, SMART owns identity, MCP owns transport — this names the unclaimed step in the middle, reusing their vocabulary where it fits. Independent implementations and criticism are invited.
The write tool declares needsApproval; the SDK pauses before execute; a card renders the exact fields plus a FHIR-shaped preview; an explicit approve or cancel resumes the flow.
Same semantics, different host
See it live in the demoA host that cannot render the approval prompt is never offered a write tool. Each call pauses on an elicitation showing the exact fields with one approve boolean; only an explicit approval commits.
Same semantics, different host
Read the MCP bindingThe conformance suite is an independent MCP client with a scripted reviewer. It spawns an implementing server fresh for every scenario and verifies each outcome against the FHIR store with its own reads — never the implementation's word for it. CI runs it in strict mode against this repository's own server on every pull request and merge.
It proves gate mechanics, not clinical correctness or authorization — the report says exactly which is which.
Run it against your implementation$ npx @lastehr/agent-write-conformance \
--server "node dist/my-mcp-server.js" \
--manifest awp-manifest.json \
--fhir-base-url http://localhost:8080/fhir \
--confirm-synthetic --strictMCP, deliberately constrained
The published package is read-only by default — bounded chart reads over Medplum or the local HAPI stack — and its only write mode is proposal-shaped: the client renders the exact fields and a human approves each write. The checkout Local Lab lets a developer inspect the bounded read surface against four synthetic HAPI charts before connecting a real project.
No FHIR credential for the Local Lab server.
Fixture-only data on loopback HAPI.
Your client keeps its own model account.
Use with Medplum
$ npx -y @lastehr/mcp init --client claude-codePrints a client registration command for a least-privilege Medplum token. By default the package exposes only reads.
Inspect locally
$ npm run mcp:demo -- --client claude-codeStarts loopback HAPI, resets synthetic fixtures, and prints a direct registration command without FHIR credentials.
Tool manifest
Read tools ship by default. The write tools exist only behind LASTEHR_MCP_WRITES=proposal, are offered only to clients that can render the approval prompt, and every write is a human-approved proposal — never an arbitrary endpoint.
@lastehr/mcpSupport matrix →Three useful first moves
The project is built for people who need to inspect the safety boundary before they bring an agent anywhere near a real chart. Pick the path that matches the question you have today.
Use the live synthetic demo to watch a clinical write become a visible proposal before it is saved.
Open /demoOpen the demoRun the conformance suite against any MCP stdio server implementing the write profile: a scripted reviewer plus independent FHIR verification.
npx @lastehr/agent-write-conformanceRead the conformance guideCreate a scrubbed report for proposal, approval, denial, chart association, and cleanup on a disposable target.
npm run evalRead the evaluatorAn integration should be able to explain itself
Last EHR keeps the extension point small: a FHIR backend contract, an executable adapter starter, and real HAPI integration coverage. The Safety Eval runs on those same disposable synthetic workflows and writes a scrubbed report, not a broad marketing badge.
Read the adapter contractDocumentation as an operating manual
Each guide names the path, the support boundary, and what still needs proof. The docs are a product surface, not a dump of API notes after the fact.
Built in the open
Last EHR is Apache-2.0. The code, safety notes, local paths, and support boundaries are public. A future managed offering is optional; the inspectable core is the point.
Not a medical device, a substitute for clinical judgment, an authorization layer, or a HIPAA-ready deployment by default.
Hosted updates
Join only for future managed-service news. Open-source updates ship in the repository first.