
# HealthClaw Guardrails
### The open-source security layer between AI agents and clinical data.
*FHIR standardized how health data is structured. MCP standardized how AI connects to tools.*
***Nobody standardized the guardrails in between. This project does.***

**[▶ Watch the 90-second demo](https://healthclaw.io/#demo)**
All records are synthetic. The chat ran on a third-party model, best of four takes. No clinician has signed off yet. [How it was made](docs/video/2.0-demo/disclosures.md).
[](https://github.com/aks129/HealthClawGuardrails/releases)
[](LICENSE)
[](https://github.com/aks129/HealthClawGuardrails/actions/workflows/ci.yml)
[](https://github.com/aks129/HealthClawGuardrails)
[](https://github.com/aks129/HealthClawGuardrails/stargazers)
[](https://github.com/aks129/HealthClawGuardrails/network/members)
[](https://github.com/aks129/HealthClawGuardrails/issues)
[](https://github.com/aks129/HealthClawGuardrails/graphs/contributors)
[](https://github.com/aks129/HealthClawGuardrails/commits/main)
[](#testing)
[](#mcp-tools-29)
[](#fhir-version-support)
[](#what-this-grade-means-and-what-it-doesnt)
[](https://glama.ai/mcp/servers/aks129/HealthClawGuardrails)
[](pyproject.toml)
[](#docker)
**[Quick Start](#quick-start)** · **[MCP Tools](#mcp-tools-29)** · **[Recipes](docs/recipes/)** · **[Roadmap](ROADMAP.md)** · **[Claude Plugin](#install-as-a-claude-plugin)** · **[Architecture](#what-it-does)** · **[healthclaw.io](https://healthclaw.io)** · **[Contributing](CONTRIBUTING.md)** · **[Dev Guide](docs/development.md)**
---
> **What it is:** an open reference implementation of the FHIR × MCP guardrail layer — PHI redaction,
> immutable audit, step-up auth, and tenant isolation — that sits between *any* AI agent and *any* FHIR
> server. Built in the open as a community project, MIT-licensed. Not a product, not a pitch: if the
> pattern is useful, take it; if it's wrong, tell us or fix it.
**This is a community effort.** It's most useful when implementers, clinicians, and standards folks poke holes in it. Issues, PRs, and "you got the SDC extraction wrong" critiques are all welcome — start with **[CONTRIBUTING.md](CONTRIBUTING.md)** and the **[Code of Conduct](CODE_OF_CONDUCT.md)**.
**At a glance:** v2.1.0, with 29 MCP tools.
**[CareAgents](https://careagents.cloud)** is the hosted consumer app: passkey sign-in, advisors, and chat on the web. iMessage works where it's offered; Telegram is not open in the beta.
Two rails run end to end — real-world actions behind a provably out-of-band gate, and forms (`$populate` → human review → provenance PDF).
Standards: FHIR R4 US Core v9 and R6 v6.0.0-ballot3, HL7 SDC forms, NQF 0018.
Operations: lab interpreter (`$interpret`), care-gaps reminders (`$care-gaps`) with an embedded MCP-App view, and ChatGPT-connector `search`/`fetch`.
Connectors: Fasten TEFCA, HealthEx, HBO, Flexpa, Epic, MEDENT, Open Wearables, SMART Health Links.
Also a Claude Code plugin and OpenAI/Gemini adapters.
## How it stops unauthorized or irreversible agent actions
A short map for a reviewer. Each line links to the detail and to something you can run.
**The problem.** An AI agent connected to a health record can read more than it needs and write what nobody approved. It can also start things that cannot be undone, such as a text message or a submitted form. Most FHIR MCP servers hand the agent the record and the write path as they are.
**The approach.** The agent gets a narrower path than the person it works for:
- **It reads less.** Names, identifiers, addresses and birth dates are redacted before the model sees a record. Reads and writes leave an audit record. Pinned by [`tests/test_claimed_properties_are_pinned.py`](tests/test_claimed_properties_are_pinned.py) (search and read redaction, a read's own audit event), and per write route by the audit column in [`tests/test_write_guard_matrix.py`](tests/test_write_guard_matrix.py).
- **It cannot write on its session alone.** Each write needs a separate, tenant-bound step-up token that expires in five minutes. Expiry is pinned in `tests/test_claimed_properties_are_pinned.py`; a write without a token is refused in the conformance test.
- **It cannot approve its own action.** For a real-world action the agent can only *propose*. `commit` submits the action and returns HTTP 202. Nothing runs until a person approves on a separate page, with a single-use credential bound to a digest of the exact payload they were shown. If the payload changes after they saw it, the approval does not match. Pinned by [`tests/test_human_gate_payload_digest.py`](tests/test_human_gate_payload_digest.py) (a changed payload is refused) and [`tests/actions/test_confirmations.py`](tests/actions/test_confirmations.py) (the credential is consumed once).
- **It fails loudly.** An action kind with no working executor ends as `failed`, not as a simulated success. A decline is recorded as a decline. Pinned by [`tests/actions/test_free_text_calls_cannot_dial.py`](tests/actions/test_free_text_calls_cannot_dial.py) and [`tests/actions/test_decline_is_a_state.py`](tests/actions/test_decline_is_a_state.py).
- **It stays in its tenant.** A record is not readable from another tenant. Pinned by the tenant-isolation property in [`tests/test_guardrail_conformance.py`](tests/test_guardrail_conformance.py).
**What can run today.** Form filling runs end to end. Text messages run only on a server with a provider configured. Phone calls can be proposed, but no call executor is registered. The approval page offers no Approve for a call, an approval sent another way ends as `failed`, and nothing dials.
**Evidence you can check.**
- Live self-test, no key needed: `curl "https://app.healthclaw.io/r6/fhir/\$conformance?format=text"` ([what the grade covers](#what-this-grade-means-and-what-it-doesnt)).
- The same seven properties as a CI test: [`tests/test_guardrail_conformance.py`](tests/test_guardrail_conformance.py).
- Which control guards which write route, as one table: [`tests/test_write_guard_matrix.py`](tests/test_write_guard_matrix.py).
- The propose, commit, approve, execute sequence: [`tests/test_actions_routes.py`](tests/test_actions_routes.py).
- The guardrails in front of a real FHIR server, each property asserted: [Aidbox example](examples/aidbox-healthclaw-guardrails/).
- Mistakes this codebase has already made, with what each cost: [defect catalogue](docs/defect-catalogue.md).
- The `python-tests` job runs `pytest tests/` on every pull request ([`ci.yml`](.github/workflows/ci.yml)); the badge above carries the count.
**Where it falls short.** The full list is under [Known Limitations](#known-limitations). The three that matter most here:
- Direct clinical FHIR writes do not have a real human gate. They wait for an `X-Human-Confirmed` header, and the caller sets that header itself ([#214](../../issues/214)). Only the action rail has the out-of-band approval.
- A step-up token works for several writes inside its five minutes. It is not single-use. No test pins this; validation does not consume the token's nonce unless a caller asks it to (`r6/stepup.py`).
- The conformance grade is a self-test on synthetic data. No third party has audited this, and no clinician has signed off.
## Try it in 60 seconds — no clone, no keys
The hosted demo runs synthetic data behind the full guardrail stack:
```bash
# Watch the deployment grade its own guardrails (PHI redaction, audit, step-up, ...):
curl "https://app.healthclaw.io/r6/fhir/\$conformance?format=text"
```
Point any MCP client at the **public demo server** — URL `https://mcp-demo-production-ee2c.up.railway.app/mcp`,
no key required — then ask: *"Search my health records for lab results and explain them in plain
language."* The demo server is unauthenticated but hard-pinned to a synthetic demo tenant, so it can
only ever serve fake data. A separate **production endpoint** (`mcp-server-production-5112`) requires a
deployment-scoped `Authorization: Bearer