Last EHR — Medplum MCP Server

Read-only Medplum chart search and patient context for MCP clients.

Remote serverstreamable-httpGo

What is the Last EHR — Medplum MCP server?

Read-only Medplum chart search and patient context for MCP clients. That is what the last ehr — medplum mcp server brings to an AI assistant: the same capability, reachable through the Model Context Protocol rather than a separate app or dashboard.

The short version

Five FHIR backends sit behind one interface. This repository is the reference implementation: bring your own FHIR backend and model key for a real agent (Medplum for the authenticated path, or any verified adapter for synthetic evaluation), or start with the zero-key local synthetic walkthrough.

  • Authentication, multi-tenancy, and access control are delegated to your Medplum project (Project = tenant, ProjectMembership = user, AccessPolicy = RBAC). Last EHR doesn't reimplement any of that, and writes are bounded by your AccessPolicy

Getting it running

Because this one is hosted, setup is mostly authentication — you point your client at the endpoint and approve access. Nothing runs on your machine, so there is no runtime to keep patched.

What it needs from you

Configuration is passed through the environment: OPENAI_API_KEY, ANTHROPIC_API_KEY, MODEL_ID, NEXT_PUBLIC_MEDPLUM_BASE_URL, MEDPLUM_BASE_URL, MEDPLUM_CLIENT_ID, MEDPLUM_CLIENT_SECRET, NEXT_PUBLIC_MEDPLUM_GOOGLE_CLIENT_ID. Treat anything key-shaped as a real credential — scope it to the minimum the server needs, and rotate it if it ever lands in a shared config.

How it compares

Plenty of developer tooling servers cover similar ground. The differences that matter in practice are scope of access and how much setup stands between you and a working tool call. It is maintained by cbetz; worth a glance at recent repository activity before you build anything load-bearing on it.

SyncDev reviews every entry in this directory against the project's own documentation before publishing, and revisits them as servers change.

Things to watch

  • Your data travels to the provider's service, so the usual questions apply about what you send and what they retain.
  • Missing credentials fail quietly in some clients — if no tools show up, check the environment block first.
  • Keep per-call confirmation enabled while you learn its behaviour; it is the cheapest safeguard you have.

How to install the Last EHR — Medplum MCP server

{
  "mcpServers": {
    "last-ehr": {
      "command": "npx",
      "args": ["-y", "@lastehr/agent-write-conformance"],
      "env": {
        "OPENAI_API_KEY": "your-value",
        "ANTHROPIC_API_KEY": "your-value",
        "MODEL_ID": "your-value",
        "NEXT_PUBLIC_MEDPLUM_BASE_URL": "your-value",
        "MEDPLUM_BASE_URL": "your-value",
        "MEDPLUM_CLIENT_ID": "your-value",
        "MEDPLUM_CLIENT_SECRET": "your-value",
        "NEXT_PUBLIC_MEDPLUM_GOOGLE_CLIENT_ID": "your-value"
      }
    }
  }
}

Add to claude_desktop_config.json, then restart Claude Desktop.

Configuration

VariableDescriptionRequired
OPENAI_API_KEYCredential the server authenticates with.Yes
ANTHROPIC_API_KEYCredential the server authenticates with.Yes
MODEL_IDConfiguration value read at startup.Optional
NEXT_PUBLIC_MEDPLUM_BASE_URLEndpoint or connection string the server talks to.Yes
MEDPLUM_BASE_URLEndpoint or connection string the server talks to.Yes
MEDPLUM_CLIENT_IDConfiguration value read at startup.Optional
MEDPLUM_CLIENT_SECRETCredential the server authenticates with.Yes
NEXT_PUBLIC_MEDPLUM_GOOGLE_CLIENT_IDConfiguration value read at startup.Optional

Frequently asked questions

It connects Last EHR — Medplum to MCP-compatible AI assistants such as Claude and Cursor. Instead of copying data back and forth by hand, the assistant works with Last EHR — Medplum directly.