FHIR agent guardrails for clinical data access via MCP. Provides 12+ tools for reading/writing resources with automatic PHI redaction, audit trails, and step-up authorization.
How this skill is triggered — by the user, by Claude, or both
Slash command
/healthclaw-guardrails:fhir-r6-guardrailsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
A [healthclaw.io](https://healthclaw.io) open source project. Reference implementation
A healthclaw.io open source project. Reference implementation of security and compliance patterns for AI agent access to FHIR data via MCP.
Supports FHIR R4 US Core v9 (stable) and FHIR R6 v6.0.0-ballot3 (experimental).
This is a runtime guardrail layer, not a knowledge skill. It sits between any AI agent and FHIR data (local or upstream), enforcing PHI redaction, audit trails, step-up authorization, and tenant isolation on every request.
| Tool | Purpose |
|---|---|
context.get | Retrieve a pre-built context envelope with patient-centric resources |
fhir.read | Read a single FHIR resource by type and ID (auto-redacted) |
fhir.search | Search resources with patient, code, status, date filters |
fhir.validate | Structural validation of a proposed resource |
fhir.stats | Observation statistics: count, min, max, mean over valueQuantity |
fhir.lastn | Most recent N observations per code |
fhir.permission_evaluate | Evaluate R6 Permission for permit/deny with reasoning |
fhir.subscription_topics | List available SubscriptionTopics |
curatr.evaluate | Evaluate a FHIR resource for data quality issues |
| Tool | Purpose |
|---|---|
fhir.propose_write | Validate and preview a write without committing |
fhir.commit_write | Commit a proposed write (requires X-Step-Up-Token) |
curatr.apply_fix | Apply patient-approved data quality fixes with Provenance |
Writes always follow propose-then-commit:
Propose: Call fhir.propose_write with the resource and operation (create/update).
This validates the resource and returns a preview. No data is changed.
Review: Check the proposal response:
proposal_status: "ready" means validation passedrequires_human_confirmation: true for clinical resource typesrequires_step_up: true always for commitsCommit: Call fhir.commit_write with the same resource. Include:
X-Step-Up-Token header (HMAC-SHA256 signed, 5-minute TTL)X-Human-Confirmed: true header for clinical resourcesObservation, Condition, MedicationRequest, DiagnosticReport, AllergyIntolerance, Procedure, CarePlan, Immunization, NutritionIntake, DeviceAlert.
Patient, Encounter, Observation, AuditEvent, Consent, Condition, Provenance, AllergyIntolerance, Immunization, MedicationRequest, Medication, MedicationDispense, Procedure, DiagnosticReport, CarePlan, CareTeam, Goal, DocumentReference, Location, Organization, Practitioner, PractitionerRole, RelatedPerson, Coverage, ServiceRequest, Specimen, FamilyMemberHistory.
Permission, SubscriptionTopic, Subscription, NutritionIntake, NutritionProduct, DeviceAlert, DeviceAssociation, Requirements, ActorDefinition.
$evaluate operation.Applied on every read path. Names truncated to initials, identifiers masked to last 4 characters, addresses stripped to city/state/country, birth dates truncated to year, photos removed, notes replaced with [Redacted].
Append-only AuditEvent records for every resource access. Database-level immutability. Logs agent ID, tenant ID, resource accessed, and outcome.
HMAC-SHA256 tokens with 128-bit nonce, 5-minute TTL, tenant binding. Required for all write operations.
X-Tenant-Id header enforced on every query at the database layer.
Supported: patient (reference), code (token), status (token),
_lastUpdated (date with ge/le/gt/lt prefix), _count (1-200),
_sort (_lastUpdated/-_lastUpdated), _summary (count).
Not supported in local mode: chaining, _include, _revinclude, modifiers.
In upstream proxy mode, all query parameters are forwarded to the upstream server.
# Docker Compose (recommended)
docker-compose up -d --build
# Manual
uv sync && python main.py &
cd services/agent-orchestrator && npm ci && npm start
Required environment variables:
STEP_UP_SECRET — HMAC secret for step-up tokensOptional:
FHIR_UPSTREAM_URL — Connect to a real FHIR server (e.g., https://hapi.fhir.org/baseR4)FHIR_BASE_URL — Backend URL (default: http://localhost:5000/r6/fhir)MCP_PORT — MCP server port (default: 3001)npx claudepluginhub aks129/healthclawguardrails --plugin healthclaw-guardrailsProxies AI agent requests to real FHIR servers (HAPI, SMART, Epic) through an MCP guardrail proxy with PHI redaction, audit trails, and URL rewriting. Use when connecting agents to production or sandbox EHR systems.
Guides building FHIR R4 REST endpoints for Patient, Observation, Encounter, Condition, MedicationRequest including resource validation, HTTP status codes, value sets, coding systems (LOINC, SNOMED, RxNorm, ICD-10), and OperationOutcome error handling.
Provides FHIR development guidance including package management, resource modeling, server implementation, and terminology handling for R4, R4B, R5.