About Last EHR — Medplum
Last EHR — Medplum provides MCP clients with FHIR chart-reading tools backed by Medplum or a local HAPI stack, and is read-only by default. Optional write proposals require human approval for each action, supporting workflows that need explicit review of medical-data changes.
Key features
- 01Search patients and view chart overviews
- 02Read 23 patient-scoped chart sections
- 03Read inline document text
- 04Read-only by default with visibility limits reported
- 05Require human approval for each write proposal
- 06Check backend configuration and connection
Use cases
- 01Find a patient and review their chart
- 02Read a chart section using filters
- 03Retrieve text from a document
- 04Submit an observation or task after human approval
MCP support
The MCP server provides FHIR patient search, chart-reading, and document-reading tools. Setting LASTEHR_MCP_WRITES=proposal enables write proposals gated by MCP elicitation and human approval; clients unable to render approvals do not see the write tools.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
npx -y @lastehr/mcpMEDPLUM_ACCESS_TOKENSecretFHIR chart tools over Medplum or a local HAPI stack: read-only by default, with an opt-in elicitation-gated write profile (human-approved per action).MEDPLUM_CLIENT_IDFHIR chart tools over Medplum or a local HAPI stack: read-only by default, with an opt-in elicitation-gated write profile (human-approved per action).MEDPLUM_CLIENT_SECRETSecretFHIR chart tools over Medplum or a local HAPI stack: read-only by default, with an opt-in elicitation-gated write profile (human-approved per action).MEDPLUM_BASE_URLFHIR chart tools over Medplum or a local HAPI stack: read-only by default, with an opt-in elicitation-gated write profile (human-approved per action).Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project README@lastehr/mcp
FHIR chart tools for MCP clients, over a Medplum project or the Last EHR
repository's local HAPI evaluation stack (FHIR_BACKEND=hapi, synthetic
data only).
Read-only by default, and the reads are the same ones the Last EHR web agent
uses: search patients, show a whole chart, read any of 23 patient-scoped chart
sections with filters, and read a document's text. One opt-in,
LASTEHR_MCP_WRITES=proposal, adds elicitation-gated write proposals a human
approves per action. Nothing is ever saved without that explicit approval, and
the write tools are hidden from clients that cannot render approvals.
The registry metadata lives in server.json and is published
alongside each verified npm release.
Install
npx -y @lastehr/mcp init
The command prints a portable MCP configuration. For Claude Code, print the registration command instead:
npx -y @lastehr/mcp init --client claude-code
Start the stdio server with:
npx -y @lastehr/mcp
Check the installed package version without configuring a backend:
npx -y @lastehr/mcp --version
Configuration
Set one authentication method before starting the server:
MEDPLUM_ACCESS_TOKEN=...
or:
MEDPLUM_CLIENT_ID=...
MEDPLUM_CLIENT_SECRET=...
Set MEDPLUM_BASE_URL for a self-hosted Medplum deployment. For the
repository's local no-auth HAPI stack, set FHIR_BACKEND=hapi and
FHIR_BASE_URL (or HAPI_BASE_URL) instead — local, synthetic data only.
Run npx -y @lastehr/mcp doctor to validate configuration without starting
MCP.
In 0.4.0, doctor --connect also checks FHIR R4 metadata and a count-only
Patient search for the stdio backend. It makes no chart write and prints no
patient data or counts. This does not verify individual chart access, other
resource permissions, write permissions, or the MCP client's approval support.
HTTP mode remains configuration-only; its --connect check fails explicitly
rather than treating a configured URL as a verified OAuth session.
The source checkout can be ahead of npm. Check the installed version with
--version. The repository's release process
tests the packed artifact in a clean directory before publication.
Safety boundary
By default the package exposes search_patients, show_patient_info,
read_chart_section, and read_document, all with the MCP readOnlyHint.
Those reads share one implementation with the web agent, which is deliberate: each of their honesty properties came from a real false negative found against a live FHIR server, and a second implementation would have re-earned them. A reply tells you what it could not see, and an empty result is never proof of absence:
| Field | Meaning |
|---|---|
truncated | The server's window came back full, so older records may exist beyond what was read. Measured at the window, not at the row count. |
codeFilterUnmatched | The section does hold records; none of them carry the code you filtered by. Text-only CodeableConcepts cannot match a coded search. |
includeUnsupported | The backend refused the reference lookup. Not the same as there being no references. |
unreadable (documents) | The document exists and its contents were not read: a scan, or a body stored as a pointer rather than inline. |
Chart free text arrives wrapped in <chart_text> tags. That content is data,
never instructions. read_document decodes an inline text attachment and never
dereferences Attachment.url, so it makes no request to an address the FHIR
server chose.
With
LASTEHR_MCP_WRITES=proposal it additionally offers add_note,
record_observation, record_superseding_observation, and create_task
as proposals: the exact fields are shown to the human
through MCP elicitation and nothing is saved unless they approve; every
approved write is tagged https://lastehr.com/mcp|approved-proposal and
carries the standard AIAST security label ("Artificial Intelligence
asserted") in meta.security, and LASTEHR_WRITE_PROVENANCE=true also
emits a Provenance resource naming the agent as author and the reviewer as
verifier.
Read access can still return PHI. Use a least-privilege identity, review the
MCP client's data handling and model-provider agreements, and never treat
this package as an authorization layer.
See https://www.lastehr.com/docs/mcp for the complete setup and support boundary.
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.