hipaa-fhir-mcp
This server gives an AI agent read-only access to one patient's FHIR R4 clinical record at a time, with deny-by-default patient grants and HMAC-hashed audit logging.
Look up patients —
get_patientby logical id (id, active, gender, birthDate) andfind_patientby identifier (MRN assystem|value), returning only patients inside your grant.Get a one-call overview —
get_patient_summaryreturns demographics, active conditions, allergies and active medications together.Review problems and allergies —
get_conditions(clinical/verification status, coded diagnosis, onset/abatement) andget_allergies(substance code, category, criticality).Review medications —
get_medication_listreturns active MedicationRequests only, with coded/referenced medication and authoredOn.Review history —
get_immunizations,get_encounters,get_procedures,get_diagnostic_reportsandget_care_team, several with an optionalsince(YYYY-MM-DD) filter.Review results —
search_observationsby code (e.g.http://loinc.org|8867-4),get_lab_resultsfor lab Observations,get_vital_signswith blood-pressure components.Review goals —
get_goalswith lifecycle/achievement status, coded description and targets.Safety behavior to expect — results keep codes, statuses and dates only (names, notes and free text are stripped); over 200 results fails rather than truncates; errors are fixed text like
Patient access not authorizedorFHIR request failed; every call writes one audit record with the patient id HMAC-hashed.Not possible — no writes or modifications of any kind, no identity or grant supplied via tool arguments, and no cross-patient or population queries.
Reads FHIR R4 clinical data from the SMART Health IT sandbox (or a configured FHIR R4 base such as AWS HealthLake), exposing tools to fetch a Patient resource, search Observations by code (e.g. LOINC), and list active MedicationRequests, with a stubbed SMART-on-FHIR OAuth 2.1 + PKCE path for production.
hipaa-fhir-mcp
Read-only FHIR R4 tools for AI agents, with deny-by-default patient access and HMAC-hashed audit.
Docs · Install · Tools · Patient access · Releases · Changelog
Prototype. Synthetic data only, not for real PHI. Tested against the Epic sandbox with its test patients only; not tested against a production EHR.
What the agent gets | What stays in place |
Patient summary, observations, medications, conditions, allergies, immunizations, encounters | Read only: no write path to patient data |
Codes, statuses and dates | Names, free text and notes are dropped before the model sees a record |
Fixed, safe error texts | Every call: one audit record, patient id HMAC-hashed |
Any FHIR R4 server, including SMART Backend Services | Deny by default: a grant per caller, patient and tool |
Try it without installing
A public demo runs at https://hipaa-fhir-mcp-demo.fly.dev/mcp (Streamable HTTP, no key). It can only reach the public synthetic SMART sandbox and five synthetic patients, so it never serves real data.
claude mcp add --transport http hipaa-fhir-demo https://hipaa-fhir-mcp-demo.fly.dev/mcpThen ask: "Summarize patient 1ac8947d-038f-4cc7-81fa-a32e694187e8." The other demo patients are listed in deploy/demo/patient-policy.json.
Related MCP server: mcp-health-server
Why this exists
AI agents are increasingly given direct access to data systems through MCP. In healthcare, that data is regulated and the required controls are specific: HIPAA §164.312 names them. Most public MCP examples ignore the regulatory context; most HIPAA write-ups predate AI agents.
This repository sits at that intersection. It is a working scaffold that lets an engineer see, in one place:
which Technical Safeguards a HIPAA-aligned MCP server actually needs,
which ones live in code, which live in infrastructure, and which are organizational policy,
what the production path looks like when the prototype's stubs become real implementations.
The point is not to ship a compliant system. The point is to make the gap between "MCP demo" and "HIPAA-compliant deployment" concrete enough to discuss. The full gap list is in docs/hipaa-compliance-mapping.md. See also the data flow, the threat model and deploying inside your own HIPAA program.
The shared Kubernetes lab connects this server to mcp-spiffe-bridge and mcp-svid-auth using real SPIRE mTLS and OAuth. Audit output uses stderr, leaving stdout exclusively for stdio MCP messages.
The development plan records the 2026-10-04 review, confirmed boundary gaps, and the next milestones.
HIPAA scope statement
In scope | §164.312(a)(2)(iv) encryption, §164.312(b) audit controls (structured JSON, HMAC-SHA-256 patient id hashing with a server-side secret, no PHI in logs), §164.312(e) transmission security (TLS), and stubs for the production path: SMART OAuth 2.1 + PKCE, SPIFFE SVID workload identity, KMS envelope encryption. |
Not in scope | Administrative and Physical safeguards - those are organizational controls. A real BAA with AWS and any downstream LLM provider. Production SMART/KMS wiring and identity integration with a real clinical backend. The stdio SPIFFE adapter remains a stub; the local Kubernetes gateway uses real SPIRE through |
Data | Public, synthetic sandbox at |
The prototype deliberately does not ship with fake production posture. Treating it as compliant out of the box would itself be non-compliant.
Claims and the tests that pin them
Every security claim in this README has a test that fails if the claim stops being true. CI runs all of them on every pull request.
Claim | Test that fails if it stops being true |
No tool runs for a patient outside the caller's grant, and the FHIR server is not called |
|
An expired grant is denied, and the FHIR server is not called |
|
Without a policy, every call is denied |
|
Identity or grants in tool arguments are ignored |
|
Every call writes exactly one audit record, with the patient id HMAC-hashed and no PHI |
|
An edited, removed or repeated audit record is detected |
|
Audit records name the key that hashed them, so a key can be rotated |
|
Names, free text and notes never reach the model |
|
A resource for another patient fails the call |
|
Upstream error text never reaches the agent |
|
Results are bounded; an over-limit search fails instead of truncating |
|
Pagination never follows a link off the configured FHIR base |
|
Where it falls short
Synthetic data only. Tested against the Epic sandbox with its test patients only, never against a production EHR; not for real PHI. Using real PHI needs your own HIPAA program, BAAs with your hosting and model providers, and an independent review this project has not had.
Read only. No writes, by design.
The patient policy is a local file. It is not SMART patient-level authorization or consent management.
One maintainer. Issues and reviews are welcome; see CONTRIBUTING.
Architecture
┌──────────────────────┐
│ Claude Desktop │
│ (MCP host) │
└──────────┬───────────┘
│ stdio (JSON-RPC)
▼
┌─────────────────────────────────────┐
│ hipaa-fhir-mcp │
│ │
│ ┌────────────┐ ┌───────────────┐ │
│ │ tools/ │ │ audit/logger │──┼──► stderr -> collector
│ │ │ │ (HMAC-SHA-256)│ │
│ └─────┬──────┘ └───────────────┘ │
│ │ │
│ ▼ │
│ ┌────────────┐ ┌───────────────┐ │
│ │ fhir/client│ │ security/ │ │
│ │ (axios+TLS)│ │ ├ oauth.ts │ │ ← SMART stub
│ │ │ │ ├ spiffe.ts │ │ ← Workload API stub
│ │ │ │ └ kms.ts │ │ ← envelope encryption stub
│ └─────┬──────┘ └───────────────┘ │
│ │ │
└────────┼────────────────────────────┘
│ HTTPS (TLS 1.2+)
▼
┌─────────────────────┐
│ FHIR R4 sandbox or │
│ AWS HealthLake │
└─────────────────────┘The fifteen read-only MCP tools exposed to Claude. Each needs its own grant in the patient policy:
Tool | Input | Returns |
|
| Patient, active conditions, allergies, active medications |
|
|
|
|
|
|
|
| active |
|
|
|
|
|
|
|
|
|
|
|
|
|
| matching |
|
|
|
|
|
|
|
| laboratory |
|
| vital-sign |
|
|
|
|
|
|
Results keep codes, statuses and dates only; display names, free text and notes are dropped. More than 200 results returns an error that asks the agent to narrow the request.
Every invocation emits a structured audit record:
{
"timestamp": "2026-04-21T10:15:03.123Z",
"tool": "get_patient",
"patient_id_hmac": "9b74c9897bac770ffc029102a200c5de...",
"caller_identity": "local-dev",
"request_id": "a3e1...",
"status": "success"
}patient_id is never written to any log. The audit record stores only an HMAC-SHA-256 of the id, computed with a server-side secret (AUDIT_HMAC_KEY). Plain SHA-256 would be reversible by enumeration if the id space were small or predictable; the keyed HMAC closes that gap. The hash is deterministic by design, which lets audit lines and KMS decrypt logs cross-reference the same patient via kms:EncryptionContext. Anyone with read access to the audit log can therefore count requests per patient, but cannot reverse to the plaintext id; the mitigation is access control on the log stream, not the hash.
Implementation and local evidence: quorum hardening.
Validated response boundary
The HTTP client validates and projects a deliberately small FHIR R4 subset. Patient output contains id, active, gender and birthDate. Observations contain status, coded concepts, subject references, times and quantitative/coded values. Medication requests contain status, intent, subject, coded/referenced medication and authoredOn; inactive requests are filtered. Names, narrative, display text, notes, identifiers and extensions are not returned. This is not a complete FHIR conformance validator or a clinical authorization policy.
Search follows same-origin continuation links confined to the configured FHIR
base, up to five pages and 200 resources, with a 1 MiB decoded response limit per
page. Requests ask for 50 results per page. A cycle, excess limit, malformed
entry, repeated resource or different patient fails the entire call with a fixed
error; partial results are never silently reported as complete. HTTP redirects
are disabled. TLS verification remains enabled with TLS 1.2 minimum.
Environment proxy settings (HTTP_PROXY, HTTPS_PROXY) are ignored, so the
backend bearer token is only sent directly to the configured FHIR origin.
See FHIR R4 search for server-driven
continuation semantics.
Stdio audits schema rejections and unknown-tool calls before SDK dispatch, using fixed labels instead of untrusted tool names or invalid arguments. Accepted calls retain their handler audit. Each invocation has one record; stdout carries JSON-RPC only. An explicit endpoint does not establish production authentication: SMART, clinical consent, durable log collection and key management remain gaps.
Requirements
Node.js 26+
pnpm (Corepack picks up the version pinned in
package.json; Node 25+ does not bundle it, so runnpm install -g corepack && corepack enableonce)
Install
cd hipaa-fhir-mcp
pnpm install
cp .env.example .env # tweak AUDIT_LOG_FILE, CALLER_IDENTITY if you want
cp patient-policy.example.json patient-policy.json # put a synthetic patient id in it
chmod 600 patient-policy.jsonThen set PATIENT_POLICY_FILE to the absolute path of patient-policy.json and LOCAL_SYNTHETIC_PRINCIPAL=local-synthetic-operator in .env. Without both, every tool call returns Patient access not authorized (see Patient access policy).
The required env vars are:
Var | Purpose |
| Server-side secret, exactly 64 hex characters, for HMAC of patient ids in the audit log. Generate with |
| HTTPS FHIR R4 base URL without embedded credentials, query or fragment. Required explicitly in production; explicit development/test without a backend token may default to the public synthetic SMART sandbox. If NODE_ENV is omitted or a token is set, an explicit URL is required. |
| Operator-configured audit label for stdio; not authenticated identity. The separate Kubernetes gateway supplies verified SPIFFE identity. |
| Optional file sink for audit records, honoured in every mode including production. If unset, or if the sink fails, audit records go to stderr. Production never requires a file. |
Run locally
# One-shot, no build needed:
pnpm dev
# Or directly:
node --env-file=.env --import tsx src/server.tspnpm dev loads .env when present; explicit environment values take precedence.
The built pnpm start command uses the process environment, so deployments must
supply the required values themselves.
The server talks MCP over stdio. To exercise it from a terminal, use the MCP Inspector:
pnpm dlx @modelcontextprotocol/inspector node --env-file=.env --import tsx src/server.tsThe SMART sandbox cycles its data periodically, so hard-coded patient ids go stale. Pull a current id with:
curl -s "https://r4.smarthealthit.org/Patient?_count=1&_elements=id" \
| python3 -c "import sys, json; print(json.load(sys.stdin)['entry'][0]['resource']['id'])"Build and test
pnpm typecheck
pnpm test
pnpm build
pnpm check # Biome lint + format check
pnpm check:fix # apply Biome fixes
pnpm check:phi # PHI shape sweepContainer image
Each release publishes a multi-arch image (amd64, arm64) with SBOM and provenance attestations, signed keylessly with cosign:
docker pull ghcr.io/tanya-ok/hipaa-fhir-mcp:latest
cosign verify ghcr.io/tanya-ok/hipaa-fhir-mcp:latest \
--certificate-identity-regexp '^https://github.com/tanya-ok/hipaa-fhir-mcp/\.github/workflows/image\.yml@' \
--certificate-oidc-issuer https://token.actions.githubusercontent.comThe default command runs the stdio server; pass dist/http-server.js as the command for Streamable HTTP. The image runs as the non-root node user and has no shell entry point beyond node.
Run over HTTP
hipaa-fhir-mcp-http serves MCP over Streamable HTTP (stateless) at POST /mcp, with GET /healthz for health checks. It refuses to start unless exactly one of these is set:
Mode | Setting | Who can call |
Bearer tokens |
| A caller whose token hashes to a listed digest acts as that principal in the patient policy |
Public demo |
| Anyone, as principal |
The file stores SHA-256 digests only; generate a token with openssl rand -base64 32 and its digest with printf %s "$TOKEN" | shasum -a 256. PATIENT_POLICY_FILE is required in both modes.
Other settings: MCP_HTTP_HOST (default 127.0.0.1), MCP_HTTP_PORT (default 8080), MCP_ALLOWED_HOSTS (comma-separated Host values; set it behind a public hostname), MCP_RATE_LIMIT_PER_MINUTE (default 60 per client address), MCP_CLIENT_IP_HEADER (behind a proxy, the header holding the client address, for example Fly-Client-IP; set it only when the proxy always overwrites that header). Bodies over 64 KB, batches and methods other than POST are refused. Invalid tool calls are audited before rejection, as on stdio. Terminate TLS in front of the server.
Connect to an authenticated FHIR server
For servers that use SMART Backend Services, set:
Variable | Value |
| the server's FHIR base URL (required) |
| the client id the authorization server issued |
| the |
| PEM private key, RSA 2048+ (RS384) or EC P-384 (ES384), mode 600 |
| optional; defaults to |
| required unless |
The server signs a short-lived client assertion (5 minutes, unique jti), exchanges it for an access token, caches the token until a minute before expiry and gets a new one once after a 401. Token endpoint responses and errors are never logged or returned to the agent. The token is sent only to the FHIR base origin. A static FHIR_AUTH_TOKEN remains available; the two cannot be combined.
The token flow was exercised against the public SMART bulk-data reference server and, on 2026-11-25, against the Epic sandbox (fhir.epic.com, R4, backend app with a JWKS URL): scripts/smoke-live.mjs ran all nine tools for one Epic test patient with no failures, including find_patient by identifier. The Epic app must use 64-character FHIR ids ("Use 64-Character-Limited FHIR IDs for USCDI FHIR Resources"); longer ids are rejected as invalid. On 2026-11-26 release 0.8.0 also passed all nine tools against a local Medplum 5.2.18 with an RS384 key; deploy/medplum-lab reproduces that run. A local server is not a hosted vendor sandbox, and Oracle Health was not tested yet. The six tools added after 0.8.0 pass against the local Medplum and the public SMART sandbox. On the Epic sandbox get_lab_results and get_vital_signs pass; get_procedures, get_diagnostic_reports, get_care_team and get_goals returned 403 because those APIs are not enabled for the test app, so they are untested there.
Patient access policy
Every tool checks the caller before any FHIR request and denies by default. A grant is an exact match of principal, patient and tool, loaded from PATIENT_POLICY_FILE (see patient-policy.example.json). A grant may carry expires_at (ISO 8601 with a time zone, for example 2027-01-31T00:00:00Z); once that time passes the grant is treated as absent, checked on every call. An invalid policy file stops the server at startup. A denial returns Patient access not authorized and writes one audit record with patient_not_authorized.
Mode | Where the principal comes from | Default |
Standalone stdio |
| Every call denied |
Kubernetes gateway | The verified SPIFFE mTLS peer, already matched to the token subject | One synthetic grant in the gateway |
CALLER_IDENTITY remains an audit label and never grants access. Tool arguments cannot supply an identity or a grant. This is a local policy for the prototype, not SMART authorization or clinical consent; a compromised caller can still misuse the patients it is granted.
Use synthetic patient ids only. To try the sandbox, copy the example, put a sandbox patient id in patients, and set both variables.
Audit log integrity and key rotation
Every audit record carries chain_id (one per process start), seq, prev and mac. mac is an HMAC-SHA-256 of the record under AUDIT_HMAC_KEY, and prev is the mac of the record before it. To check a log file:
pnpm build
AUDIT_HMAC_KEY=<key> node scripts/verify-audit.mjs /path/to/audit.jsonlIt reports an edited record, and a record removed from or repeated inside a chain, and exits non-zero. It prints counts only. Limits: records cut from the end of a chain and a whole removed chain are not detected, and anyone holding the key can re-sign a log. Ship the log to append-only storage for those cases.
To rotate the key: start the server with a new AUDIT_HMAC_KEY. New records get a new key_id and a new chain. Keep the old key in your secrets manager for as long as the old records are retained, and verify them with it; records under another key or without chain fields are counted as skipped. A skipped record is not verified, so anyone able to append to the file could add one: pass --strict to fail on every skipped record when the log should hold a single key. The same patient hashes differently under the new key, so cross-referencing a patient across the rotation needs both keys.
Install in Claude Desktop
Two paths. The local extension bundle installs natively in Claude Desktop; this was verified on 2026-10-13. The manual config is for active development.
Option A: native extension (.mcpb)
Build a local bundle with
pnpm package:mcpb(requires Python 3 for the archive gate). This prepares a file without publishing a release. An existing bundle is not overwritten.In Claude Desktop:
Settings -> Extensions -> Install Extension...and select the file.The form prompts for FHIR base URL, caller identity, audit HMAC key (required), audit log file path, patient policy file and local synthetic principal. Without the last two, every tool call is denied. The HMAC key is stored encrypted via your OS keychain. Generate one with
openssl rand -hex 32. The other three have working defaults for the public sandbox.Restart Claude Desktop. The tools appear in the tools menu under
hipaa-fhir-mcp.
Claude Desktop's built-in Node runtime is 24.x. The manifest requires Node 26 or newer, so Desktop runs the server with the system Node 26 found on its PATH. Install Node 26 system-wide before installing the extension.
Reinstalling a bundle with the same id and version does not replace the installed files. Uninstall the extension first, then install the new bundle.
Native installation was verified on 2026-10-13 on macOS: the extension connected with three tools, get_patient against the public SMART sandbox returned a synthetic patient, and the audit record contained only patient_id_hmac, with caller_identity claude-desktop-local. See the bundle checks.
Option B: manual config (development)
For a step-by-step walkthrough that takes the prototype from a clean clone through MCP Inspector to a working Desktop session, with a live audit-log trace and a no-PHI verification, see docs/demo.md.
Minimal config: add this to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows). Replace the absolute paths with values from your machine:
{
"mcpServers": {
"hipaa-fhir-mcp": {
"command": "/absolute/path/to/node",
"args": [
"/absolute/path/to/hipaa-fhir-mcp/dist/server.js"
],
"env": {
"FHIR_BASE_URL": "https://r4.smarthealthit.org",
"CALLER_IDENTITY": "claude-desktop-local",
"AUDIT_HMAC_KEY": "<paste-output-of-openssl-rand-hex-32>",
"NODE_ENV": "development",
"AUDIT_LOG_FILE": "/absolute/path/to/hipaa-fhir-mcp/audit-claude.log",
"PATIENT_POLICY_FILE": "/absolute/path/to/patient-policy.json",
"LOCAL_SYNTHETIC_PRINCIPAL": "local-synthetic-operator"
}
}
}
}Use absolute paths. macOS GUI apps do not always inherit your shell PATH, so a bare node may not resolve. Run which node (and follow with readlink -f if you use a version manager) and paste the result into command.
Build first: pnpm install && pnpm build so dist/server.js exists.
Restart Claude Desktop. The tools appear under the server name in the tools menu.
Install in Claude Code
Build first (pnpm install && pnpm build), then register the stdio server. Use an absolute path to dist/server.js and to a Node 26 binary if your shell resolves an older one.
claude mcp add hipaa-fhir-mcp \
-e FHIR_BASE_URL=https://r4.smarthealthit.org \
-e CALLER_IDENTITY=claude-code-local \
-e AUDIT_HMAC_KEY=<output-of-openssl-rand-hex-32> \
-e NODE_ENV=development \
-- node /absolute/path/to/hipaa-fhir-mcp/dist/server.jsThe default scope is local to the current project. Add -s user to make it available in every project. claude mcp list shows whether the server connected; inside a session, /mcp lists its three tools.
Install in Codex
Codex reads MCP servers from ~/.codex/config.toml (or a trusted project's .codex/config.toml); the CLI and the IDE extension share it. Either run:
codex mcp add hipaa-fhir-mcp \
--env FHIR_BASE_URL=https://r4.smarthealthit.org \
--env CALLER_IDENTITY=codex-local \
--env AUDIT_HMAC_KEY=<output-of-openssl-rand-hex-32> \
--env NODE_ENV=development \
-- node /absolute/path/to/hipaa-fhir-mcp/dist/server.jsor add the table by hand:
[mcp_servers.hipaa-fhir-mcp]
command = "node"
args = ["/absolute/path/to/hipaa-fhir-mcp/dist/server.js"]
[mcp_servers.hipaa-fhir-mcp.env]
FHIR_BASE_URL = "https://r4.smarthealthit.org"
CALLER_IDENTITY = "codex-local"
AUDIT_HMAC_KEY = "<output-of-openssl-rand-hex-32>"
NODE_ENV = "development"/mcp in the Codex TUI shows the active servers. See the Codex MCP documentation for options.
In every client the HMAC key ends up in a local config file. Keep that file private, use a key that exists only for this demo, and point FHIR_BASE_URL only at synthetic data.
MCP Registry
server.json describes the released Desktop bundle for the official MCP Registry as io.github.tanya-ok/hipaa-fhir-mcp. It points at the .mcpb asset of a GitHub release and pins its SHA-256, so no npm package is needed. On each release, update version, the asset URL and fileSha256 from the release's .sha256 file, then publish with mcp-publisher login github and mcp-publisher publish. The registry does not review servers; a listing is not a security or compliance claim.
This server is not submitted to the Claude Directory. It is a prototype on synthetic data, and a public directory listing for a HIPAA-named server would read as production readiness.
Production deployment notes
A production deployment replaces the sandbox with AWS HealthLake and the stubs with real implementations. A sketch:
Runtime: EKS pod or Fargate task in a private VPC subnet with no IGW route.
Workload identity: SPIRE Agent DaemonSet issues X.509 SVIDs over the Workload API socket. The pod SecurityContext mounts the socket read-only.
src/security/spiffe.tsgets a gRPC Workload API client.User identity: SMART-on-FHIR OAuth 2.1 + PKCE flow wired into
src/security/oauth.ts. Access token passes in theAuthorization: Bearerheader; scopes bind the clinical context (patient/*.rs).Data path: VPC interface endpoint for HealthLake (
com.amazonaws.eu-west-1.healthlake). Endpoint policy restricts calls to the specific datastore ARN. Egress security group allows only the endpoint ENI.Encryption at rest: any response cache goes through
src/security/kms.ts(KMS envelope encryption with AES-256-GCM). CMK key policy grantskms:Decryptonly to the workload's IAM role, withkms:EncryptionContextbinding tied topatient_id_hmac. Decrypts that do not match the expected context fail closed.Audit trail: stderr -> collector Logs, 2-year retention, metric filter on
status=errorinto an alarm. CloudTrail capturesKMS.Decryptandhealthlake:ReadResourcefor cross-reference.Transport to the MCP host: MCP over stdio works inside the pod. For a remote MCP transport, terminate TLS at an Envoy sidecar with mTLS between Envoy and peers using the SPIFFE SVID.
BAA: required with AWS (HealthLake, KMS, CloudWatch) and with any LLM provider that sees tool outputs. The prototype does not talk to any LLM directly.
The full control-by-control table is in docs/hipaa-compliance-mapping.md.
Project layout
hipaa-fhir-mcp/
├── src/
│ ├── server.ts # stdio entry point
│ ├── http-server.ts # Streamable HTTP entry point
│ ├── http.ts # HTTP transport: tokens, demo mode, rate limit
│ ├── mcp.ts # transport-independent MCP server factory
│ ├── stdio.ts # stdio transport that audits pre-handler rejections
│ ├── config.ts # zod-validated env, fails fast
│ ├── audit/
│ │ └── logger.ts # structured audit log, keyed HMAC-SHA-256 id hashing
│ ├── fhir/
│ │ ├── client.ts # HTTPS FHIR client (swappable for HealthLake)
│ │ ├── schemas.ts # bounded response schemas, shared patient id schema
│ │ └── types.ts # minimal FHIR R4 types
│ ├── tools/
│ │ ├── types.ts
│ │ ├── access.ts # policy check shared by the tools
│ │ ├── get-patient.ts
│ │ ├── search-observations.ts
│ │ ├── get-medication-list.ts
│ │ └── patient-records.ts # summary, conditions, allergies, immunizations, encounters, find
│ └── security/
│ ├── context.ts # per-request caller context
│ ├── patient-policy.ts # deny-by-default patient and tool grants
│ ├── smart-backend.ts # SMART Backend Services client assertion and token cache
│ ├── oauth.ts # SMART-on-FHIR OAuth 2.1 + PKCE stub
│ ├── spiffe.ts # SPIFFE Workload API stub
│ └── kms.ts # KMS envelope encryption stub
├── tests/ # vitest suites, synthetic fixtures only
│ ├── fixtures/stdio-http.ts
│ ├── client.test.ts
│ ├── config.test.ts
│ ├── http.test.ts
│ ├── mcp.test.ts
│ ├── patient-policy.test.ts
│ ├── patient-records.test.ts
│ ├── smart-backend.test.ts
│ ├── stdio.test.ts
│ └── tools.test.ts
├── scripts/
│ ├── check-phi.mjs # PHI shape sweep
│ ├── package-mcpb.mjs # gated Desktop bundle packer
│ ├── check-mcpb.py # bundle payload gate
│ ├── test-mcpb.py # payload gate cases
│ ├── demo-package.mjs # installed-package stdio demo
│ └── smoke-live.mjs # live smoke test of every tool, prints no clinical content
├── deploy/medplum-lab/ # local Medplum to run the live smoke test against
├── deploy/kubernetes/ # shared lab gateway and probe (not standalone)
├── docs/ # documentation site sources (Zensical)
├── .github/ # workflows, Dependabot, templates
├── manifest.json # Claude Desktop extension manifest
├── Dockerfile
├── zensical.toml
├── package.json
└── README.mdSecurity automation
This repository runs the following automated checks on every push and pull request, plus a weekly schedule for the static-analysis job:
Check | What it does | Workflow |
Typecheck / test / build | Catches broken code. | |
Biome lint + format check ( | Enforces code style and catches a baseline of correctness rules. | |
| Fails on | |
PHI sweep | Scans the working tree for SSN-, US-phone-, and non-allowlisted-email shapes. Enforces the no-PHI claim made elsewhere in this repo. | |
CodeQL | GitHub-native static analysis for JS/TS with the | |
gitleaks | Full-history secret-shape scan on every push and pull request, using a checksum-verified release. | |
Release | Tag builds re-run the gates, require the tag on | |
Dependabot | Weekly grouped PRs for the npm (reads |
Actions are pinned to full commit SHAs, checkouts do not persist credentials and write permissions are job-scoped.
What the PHI sweep catches and explicitly does not catch is in docs/security-automation.md.
Versioning
This project follows Semantic Versioning. Releases are tagged vX.Y.Z and tracked in CHANGELOG.md.
While the project is pre-1.0, the public surface (MCP tool signatures, audit record schema, environment variable names, CLI flags) may change in any minor release. Pin to an exact version or commit SHA for reproducibility.
Change type | Pre-1.0 bump | Post-1.0 bump |
Bug fix, dependency bump, doc-only change | patch | patch |
New MCP tool, new optional env var, additive audit field | minor | minor |
MCP tool removed or renamed, audit schema field removed or renamed, env var renamed, breaking config change | minor | major |
Schema-level changes are also called out in the changelog under a ### Changed or ### Removed heading so a downstream consumer can spot them at a glance.
License
MIT. See LICENSE.
Available Tools
15 toolsfind_patientFind Patient by IdentifierARead-onlyIdempotent
Find patients by identifier (MRN, member id or another system|value) and return their FHIR ids, gender, birth date and active status. Use it when you know an identifier but not the FHIR id, then pass the id to the other tools. Only patients the caller is granted for find_patient are returned; others are silently left out, so an empty list does not mean no such patient exists. Read only. Every call writes one audit record; the identifier and patient ids are not logged. A caller without a find_patient grant gets "Patient access not authorized" before any FHIR request. More than 200 matches returns "Too many results (more than 200); narrow the request". Other failures return "FHIR request failed" with no server detail.
Inputs: identifier (required).
get_allergiesGet AllergiesARead-onlyIdempotent
List FHIR R4 AllergyIntolerance resources for one patient. Use it before reasoning about medications. Returns a JSON array with clinical status, type, category, criticality, the substance code (system and code only; display and free text are dropped) and recorded date. Read only. Every call writes one audit record in which the patient id is HMAC-hashed; no PHI is logged. Access is checked first against the server patient policy: a patient outside the caller grant returns "Patient access not authorized" before any FHIR request. More than 200 results returns "Too many results (more than 200); narrow the request". Other failures return "FHIR request failed" with no server detail.
Inputs: patient_id (required).
get_care_teamGet Care TeamARead-onlyIdempotent
List FHIR R4 CareTeam resources for one patient. Use it to see which roles are involved in care. Returns a JSON array with status, category, period and the coded role of each participant; member names and references are never returned. Read only. Every call writes one audit record in which the patient id is HMAC-hashed; no PHI is logged. Access is checked first against the server patient policy: a patient outside the caller grant returns "Patient access not authorized" before any FHIR request. More than 200 results returns "Too many results (more than 200); narrow the request". Other failures return "FHIR request failed" with no server detail.
Inputs: patient_id (required).
get_conditionsGet ConditionsARead-onlyIdempotent
List FHIR R4 Condition resources (problems and diagnoses) for one patient, active and resolved. Use it to see what the patient is or was treated for; check clinicalStatus for active. Returns a JSON array with clinical and verification status, code (system and code only; display and free text are dropped), onset, abatement and recorded dates. Read only. Every call writes one audit record in which the patient id is HMAC-hashed; no PHI is logged. Access is checked first against the server patient policy: a patient outside the caller grant returns "Patient access not authorized" before any FHIR request. More than 200 results returns "Too many results (more than 200); narrow the request". Other failures return "FHIR request failed" with no server detail.
Inputs: patient_id (required).
get_diagnostic_reportsGet Diagnostic ReportsARead-onlyIdempotent
List FHIR R4 DiagnosticReport resources (lab panels, imaging and pathology reports) for one patient. Pass since (YYYY-MM-DD) for patients with a long history. Returns a JSON array with status, category, report code, effective and issued times, coded conclusions and references to the result Observations. The narrative conclusion and attached documents are never returned; use get_lab_results for the values. Read only. Every call writes one audit record in which the patient id is HMAC-hashed; no PHI is logged. Access is checked first against the server patient policy: a patient outside the caller grant returns "Patient access not authorized" before any FHIR request. More than 200 results returns "Too many results (more than 200); narrow the request". Other failures return "FHIR request failed" with no server detail.
Inputs: patient_id (required), since.
get_encountersGet EncountersARead-onlyIdempotent
List FHIR R4 Encounter resources (visits and admissions) for one patient. Pass since (YYYY-MM-DD) for patients with a long history. Returns a JSON array with status, class, type and period. Read only. Every call writes one audit record in which the patient id is HMAC-hashed; no PHI is logged. Access is checked first against the server patient policy: a patient outside the caller grant returns "Patient access not authorized" before any FHIR request. More than 200 results returns "Too many results (more than 200); narrow the request". Other failures return "FHIR request failed" with no server detail.
Inputs: patient_id (required), since.
get_goalsGet GoalsARead-onlyIdempotent
List FHIR R4 Goal resources for one patient. Returns a JSON array with lifecycle and achievement status, category, the coded goal description, start date and targets (measure, quantity, due date). A goal recorded only as free text comes back without a description code. Read only. Every call writes one audit record in which the patient id is HMAC-hashed; no PHI is logged. Access is checked first against the server patient policy: a patient outside the caller grant returns "Patient access not authorized" before any FHIR request. More than 200 results returns "Too many results (more than 200); narrow the request". Other failures return "FHIR request failed" with no server detail.
Inputs: patient_id (required).
get_immunizationsGet ImmunizationsARead-onlyIdempotent
List FHIR R4 Immunization resources for one patient. Returns a JSON array with status, vaccine code (system and code only; display and free text are dropped) and the date given. Read only. Every call writes one audit record in which the patient id is HMAC-hashed; no PHI is logged. Access is checked first against the server patient policy: a patient outside the caller grant returns "Patient access not authorized" before any FHIR request. More than 200 results returns "Too many results (more than 200); narrow the request". Other failures return "FHIR request failed" with no server detail.
Inputs: patient_id (required).
get_lab_resultsGet Lab ResultsARead-onlyIdempotent
List laboratory Observation resources for one patient without knowing a code; use search_observations when you know the LOINC code. Pass since (YYYY-MM-DD) for patients with a long history. Returns a JSON array with status, code, effective or issued time, the value, coded interpretation (for example high or low) and panel components. Read only. Every call writes one audit record in which the patient id is HMAC-hashed; no PHI is logged. Access is checked first against the server patient policy: a patient outside the caller grant returns "Patient access not authorized" before any FHIR request. More than 200 results returns "Too many results (more than 200); narrow the request". Other failures return "FHIR request failed" with no server detail.
Inputs: patient_id (required), since.
get_medication_listGet Medication ListARead-onlyIdempotent
List the active FHIR R4 MedicationRequest resources for one patient. Use it to see what is currently prescribed; inactive, stopped and completed requests are excluded. Read only. Returns a JSON array of MedicationRequests with status, intent, subject, the medication code or reference and authoredOn, at most 200 results. Every call writes one hashed audit record. Other failures return the fixed text "FHIR request failed" with no server detail. Access is checked first against the server patient policy: a patient outside the caller grant returns "Patient access not authorized" before any FHIR request.
Inputs: patient_id (required).
get_patientGet FHIR PatientARead-onlyIdempotent
Read one FHIR R4 Patient resource by its logical id from the configured FHIR server (by default the public synthetic SMART sandbox). Use it first to confirm a patient exists and to get gender, birth date and active status; use search_observations or get_medication_list for clinical data. Read only. Returns the Patient as JSON with only id, active, gender and birthDate. Every call writes one audit record in which the patient id is HMAC-hashed; no PHI is logged. Other failures return the fixed text "FHIR request failed" with no server detail. Access is checked first against the server patient policy: a patient outside the caller grant returns "Patient access not authorized" before any FHIR request.
Inputs: patient_id (required).
get_patient_summaryGet Patient SummaryARead-onlyIdempotent
One-call overview of a patient: demographics, active conditions, allergies and active medications. Use it first when asked about a patient as a whole; use the single-resource tools for detail or history. Needs its own policy grant. Any failed part fails the whole summary. Read only. Every call writes one audit record in which the patient id is HMAC-hashed; no PHI is logged. Access is checked first against the server patient policy: a patient outside the caller grant returns "Patient access not authorized" before any FHIR request. More than 200 results returns "Too many results (more than 200); narrow the request". Other failures return "FHIR request failed" with no server detail.
Inputs: patient_id (required).
get_proceduresGet ProceduresARead-onlyIdempotent
List FHIR R4 Procedure resources (surgeries, interventions and other procedures) for one patient. Pass since (YYYY-MM-DD) for patients with a long history. Returns a JSON array with status, category, procedure code (system and code only; display and free text are dropped) and the performed date or period. Read only. Every call writes one audit record in which the patient id is HMAC-hashed; no PHI is logged. Access is checked first against the server patient policy: a patient outside the caller grant returns "Patient access not authorized" before any FHIR request. More than 200 results returns "Too many results (more than 200); narrow the request". Other failures return "FHIR request failed" with no server detail.
Inputs: patient_id (required), since.
get_vital_signsGet Vital SignsARead-onlyIdempotent
List vital-sign Observation resources (blood pressure, heart rate, temperature, weight and similar) for one patient. Pass since (YYYY-MM-DD) for patients with a long history. Returns a JSON array with status, code, effective time and the value; blood pressure carries systolic and diastolic in component. Read only. Every call writes one audit record in which the patient id is HMAC-hashed; no PHI is logged. Access is checked first against the server patient policy: a patient outside the caller grant returns "Patient access not authorized" before any FHIR request. More than 200 results returns "Too many results (more than 200); narrow the request". Other failures return "FHIR request failed" with no server detail.
Inputs: patient_id (required), since.
search_observationsSearch FHIR ObservationsARead-onlyIdempotent
Search FHIR R4 Observation resources for one patient filtered by a code, for example vital signs or lab results. Use it when you know the code to look for (LOINC is typical: http://loinc.org|8867-4 is heart rate); use get_patient to check the patient first. Read only. Returns a JSON array of Observations with status, code, subject, effective or issued time and the value, at most 200 results across up to 5 pages of 50; larger result sets fail instead of being truncated. Every call writes one hashed audit record. Other failures return the fixed text "FHIR request failed" with no server detail. Access is checked first against the server patient policy: a patient outside the caller grant returns "Patient access not authorized" before any FHIR request.
Inputs: code (required), patient_id (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 15 tools
Most tools map cleanly to a single FHIR resource, and descriptions explicitly distinguish find_patient (identifier lookup), get_patient (id read) and get_patient_summary (composite). The only real overlap is among get_lab_results, get_vital_signs and search_observations, all Observation-based, though the descriptions do explain when to use each.
All names are snake_case and almost all use a get_<resource> pattern. find_patient and search_observations deviate in verb, but the verbs are semantically apt and the style remains predictable.
15 tools is at the upper end of the ideal range but each earns its place by covering a distinct FHIR resource or composite workflow for a read-only clinical data server.
Core clinical resources (Patient, Condition, Allergy, Medication, Immunization, Procedure, DiagnosticReport, Observation, Encounter, CareTeam, Goal) are covered for a read-only server. Minor gaps exist, notably no medication history (only active MedicationRequests) and no document/report attachment retrieval, but main workflows are workable.
Maintenance
Related MCP Connectors
Hosted MCP server for the Healthie EHR & telehealth API: patients, appointments, charting, tasks.
Hosted MCP server exposing US hospital procedure cost data to AI assistants
Citepath public MCP server for LLM readiness audits and public scan results.
Hosted MCP server for Cliniko — patients, appointments, availability, and invoices for AI agents.
Related MCP Servers
- AlicenseAqualityAmaintenanceOpen-source guardrails between AI agents and FHIR clinical data — PHI redaction, immutable audit, step-up auth, tenant isolation. MCP server + OpenAI/Gemini adapters. A healthclaw.io project.2934MIT
- AlicenseAqualityDmaintenanceA Claude-compatible MCP server that exposes health-domain tools over 100% synthetic data, built with security and compliance in mind.4MIT
- FlicenseNot gradedqualityDmaintenanceA healthcare MCP demo server exposing clinical resources, tools, and prompts over SSE with authentication, integrated with Pydantic AI and Gemini for natural language patient record updates.-
- AlicenseNot gradedqualityDmaintenanceMCP server that lets a hosted LLM securely read a local family health archive and deposit structured reports into an inbox, with a read-biased tool surface and strict path/token enforcement.MIT