Λογότυπο HealthClaw Guardrails

HealthClaw Guardrails

Κοινότητα
aks129

Open-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.

Εκδότηςaks129
ΑποθετήριοHealthClawGuardrails
ΓλώσσαPython
Διακλαδώσεις
12
Αστέρια
30
Διαθέσιμα εργαλεία
0
Τύπος μεταφοράςstdio, streamable-http
Κατηγορίες
Άδεια χρήσηςMIT
Σύνδεσμοι
  • Συνδέστε εργαλεία σε ροές εργασίας AI

    Το HealthClaw Guardrails παρέχει δυνατότητες MCP που μπορούν να χρησιμοποιηθούν από συμβατές εφαρμογές-πελάτες AI και συμβατούς πράκτορες AI.

  • Διαθέσιμα εργαλεία: 0

    Δείτε παρακάτω τις ενέργειες που μπορεί να καλέσει μια εφαρμογή-πελάτης, μαζί με τα ονόματα και τις περιγραφές τους, εφόσον τα παρέχει ο διακομιστής.

  • Ρυθμίσεις έτοιμες για αντιγραφή

    Χρησιμοποιήστε τα παραδείγματα διαμόρφωσης για να ρυθμίσετε αυτόν τον διακομιστή στην εφαρμογή-πελάτη MCP που προτιμάτε.

  • Δείκτες ενδιαφέροντος της κοινότητας για το έργο ανοιχτού κώδικα

    Στοιχεία του συνδεδεμένου αποθετηρίου: αστέρια (30) και διακλαδώσεις (12).

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.

Release License CI Code size

Stars Forks Issues Contributors Last commit

Tests MCP tools FHIR Guardrail conformance Glama score Python Docker

Quick Start · MCP Tools · Recipes · Roadmap · Claude Plugin · Architecture · healthclaw.io · Contributing · Dev Guide


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 and the Code of Conduct.

At a glance: v1.10.0, with 1,490+ Python and 170 Node tests across 29 MCP tools. CareAgents is the hosted consumer app: passkey sign-in, advisors, and web/Telegram/iMessage. 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.

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 <token> — real records stay behind auth, always. Hosted connectors cannot attach that header, so the demo URL above is the one to paste. One-command installs: gemini extensions install https://github.com/aks129/HealthClawGuardrails · claude plugin marketplace add aks129/HealthClawGuardrails · skills on ClawHub

Non-developer? Step-by-step guides for Claude (web/desktop/phone), Perplexity, ChatGPT, and Telegram — plus a 10-minute demo script — in docs/quickstarts/.

Listed in: Official MCP Registry (io.github.aks129/healthclaw-guardrails) · Glama (hosted connector) · ClawHub (14 skills) · Gemini CLI Extensions · agent-skills discovery at /.well-known/agent-skills/

Release highlights

Full notes live in Releases.

VersionHighlights
v1.10.0Runs in front of a real FHIR server. The proxy now authenticates to an upstream FHIR server with its own client credential, so an agent never holds one — with a runnable Aidbox example that stands the guardrails in front of Aidbox and asserts each property rather than narrating it · access kernel — r6.access becomes the one tenant reader, step-up gate, audit call and FHIR exit, adopted blueprint by blueprint · security: a caller-supplied seed bundle takes the ingest gate, not the mint gate (an unauthenticated write path, found and closed) · MCP: an expired session returns 404, so a client re-initializes instead of failing · demo data: multi-year synthetic blood-pressure history and a server-rendered trend chart, with home and clinic readings modelled distinctly · a defect catalogue wired into the PR gate, and drift guards that replay the published example's own claims against the running app
v1.9.0CareAgents — the hosted consumer experience: sign up with a passkey, connect records through a pluggable connector marketplace (Fasten, Apple Health via Open Wearables, sample data), and spin up a guardrailed health agent reachable on web, Telegram, and iMessage · advisor registry — specialties ported from SmartHealthConnect (healthy-habits, care-completion, medication-refills, diet-exercise) as prompt-blocks over the guarded tool set, deferred ones honestly labeled · versioned informed consent enforced server-side (HTTP 428) before any real-record connection · forms rail ships end-to-end — $populate → per-item human review (NKA never inferred) → provenance-stamped PDF → signed expiring link · error fidelity is conformance property seven (Grade A = 7/7), hardened across both MCP transports with a Python↔TypeScript drift guard · MCP Apps — care-gaps results embed an engine-served UI (text/html; profile=mcp-app) whose only fetch target is the guarded operation · security pass: fail-closed prod config, authenticated tenant reads, MCP transport auth, Alembic · SmartHealthConnect archived (skills frozen at v1.2.0; advisors are the live successors)
v1.8.0Real-actions foundation — an agent can propose a real-world action (call, SMS, form) but commit only submits it (HTTP 202); execution happens through a separate approval that requires a single-use step-up credential and an expiry-guarded atomic claim, so the agent's own toolchain can never approve its own action (the spoofable X-Human-Confirmed header is gone) · ActionExecutor plugin registry — add a real-world capability behind the full guardrail rail in ~50 lines, no core changes (extend it) · mandatory red-flag emergency screen; fail-loud rails (no silent simulation) · durable execution — attempt ledger, provider reconciliation, external-tick reaper, append-only action-event log · reliability floor — config preflight (GET /r6/ops/preflight), Postgres CI lane, MCP fetch timeouts, poller 409-storm detection, source-aware resource identity (tenant, type, id), Fasten hardening + zombie-job reaper · public ROADMAP + contributor on-ramp · fixes: upstream FHIR error fidelity, quality measures default to current year
v1.7.0Preventive care-gaps engine (Patient/$care-gaps, USPSTF/ACIP/ADA + eCQM crosswalk) · patient connect flow: identity-verified Fasten onboarding mints a webhook-gated, read-scoped 30-day agent token · prescription transfer requests (rx_transfer_request, Schedule II refused) — 29 MCP tools · per-agent quickstarts (Claude/Perplexity/ChatGPT/Telegram) · HBO export→FHIR converter + embedded-XML PHI scrubber · hardening: fail-closed webhook verify, scoped tokens, serverless write guard, live-path contract tests · clinical fixes: SNOMED diabetes detection, inclusive panic thresholds, one-sided-range honesty
v1.6.0Lab reference-range interpreter (Observation/$interpret) · NQF 0018 quality measure (Measure/$evaluate-measure) · any-agent-framework adapters (OpenAI/Gemini) · Medplum-in-front recipe · SMBP triage on 2025 AHA/ACC · ruff lint gate · all dependency advisories remediated
v1.5.0Read-auth hardening (tenant reads authenticated, not just scoped) · HL7 SDC forms — $populate / $extract
v1.4.0Six health-data connectors (Fasten TEFCA, HealthEx, Health Bank One, Flexpa, Epic, MEDENT) behind one guardrail stack
v1.3.0Wearables → FHIR Observations (8 providers, LOINC/UCUM mapping, device Provenance)
v1.2.0Compiled Truth — current state + append-only Provenance trail per resource

What It Does

This is a vendor-neutral guardrail proxy that sits between any AI agent and any FHIR server. Every request passes through:

  • PHI redaction — Names truncated to initials, identifier values removed (system and type kept), addresses stripped, birth dates truncated to year
  • Immutable audit trail — Every read/write logged with tenant, agent, timestamp
  • Step-up authorization — HMAC-SHA256 tokens required for writes
  • Human-in-the-loop — Clinical writes blocked until a human confirms (HTTP 428); real-world actions (calls, SMS, forms) go further: commit only submits, and execution requires a provably out-of-band single-use approval the agent's own toolchain cannot satisfy
  • Tenant isolation — Every query scoped to tenant, cross-tenant access blocked
  • Medical disclaimers — Injected on all clinical resource reads
  • Compiled Truth — Current state + append-only evidence trail for every resource
text
AI Agent ──▶ MCP Server ──▶ Guardrail Proxy ──▶ Any FHIR Server
                              ↓                    (HAPI, Epic,
                         PHI redaction              Medplum, etc.)
                         Audit trail
                         Step-up auth
                         Human-in-the-loop

Prove it: guardrail conformance

The guardrails are verifiable, not marketing. A runnable harness probes any deployment with synthetic data and emits a scorecard across all seven properties — run it against your own instance (or ours):

bash
python scripts/guardrail_conformance.py \
  --base-url https://app.healthclaw.io --tenant desktop-demo \
  --step-up-token "$(mint a token via POST /r6/fhir/internal/step-up-token)"
text
HealthClaw Guardrail Conformance — https://app.healthclaw.io [tenant=desktop-demo]
  Grade: A   (7/7 properties)
  [PASS] PHI Redaction            [PASS] Human-in-the-Loop
  [PASS] Immutable Audit Trail    [PASS] Tenant Isolation
  [PASS] Step-Up Authorization    [PASS] Medical Disclaimers
  [PASS] Error Fidelity — A (local-fhir-only)

Or hit the one-URL self-test on any running deployment — no token needed, it self-tenants internally and returns 200 at Grade A (503 otherwise):

bash
curl "https://app.healthclaw.io/r6/fhir/\$conformance?format=text"

The local FHIR profile is Grade A: unsupported local-search inputs are rejected or reported according to Prefer: handling, and every failure path is audited. The same harness runs against the Flask test client as a CI baseline (tests/test_guardrail_conformance.py). --json emits a machine-readable report; --mcp-url additionally grades MCP tools/call error signaling as a separate profile. For an authenticated MCP deployment, set MCP_AUTH_TOKEN or pass --mcp-auth-token. Library API: from r6.conformance import LiveProbeClient, ProbeContext, run_conformance.

What this grade means (and what it doesn't)

The grade covers the HealthClaw guardrail layer only — a self-test of the seven properties against synthetic data it just created. It is not a HIPAA Security Rule assessment, a third-party audit, or a penetration test of your deployment: infrastructure, BAAs, encryption at rest/in transit, and access controls remain the deployer's responsibility (see Known Limitations). Because the harness is deployment-agnostic, a third party can run it against any instance as one input to a real assessment — it does not substitute for one. The report states this scope itself in every output format.

Install as a Claude Plugin

HealthClaw ships as a Claude Code plugin marketplace. Two plugins are available:

bash
# Add the marketplace
claude plugin marketplace add aks129/HealthClawGuardrails

# Install the FHIR guardrail plugin (this repo)
claude plugin install healthclaw-guardrails@healthclaw-marketplace

# Install the personal-health companion plugin (frozen — upstream archived)
claude plugin install smarthealthconnect@healthclaw-marketplace
PluginSkillsSource
healthclaw-guardrailscuratr, fasten-connect, fhir-r6-guardrails, fhir-upstream-proxy, healthex-export, phi-redactionaks129/HealthClawGuardrails
smarthealthconnectcare-completion, diet-exercise, healthy-habits, kids-health, medication-refills, research-monitoraks129/SmartHealthConnect (archived — skills frozen at v1.2.0; live successors are CareAgents advisors)

Each skill is auto-discoverable — Claude loads it when your prompt matches the skill's trigger phrases (e.g. "check my care gaps", "redact this bundle", "run Curatr on my conditions").

Not on Claude/MCP? The same 28 guardrailed tools run on OpenAI, Gemini, LangChain, or plain HTTP via the framework-neutral bridge in adapters/ — see Recipe: run HealthClaw tools on any agent framework. Guardrails stay server-side, so no framework can bypass them.

Quick Start

bash
# Install dependencies
uv sync

# Apply deterministic database migrations
STEP_UP_SECRET=your-secret uv run flask --app main init-db
STEP_UP_SECRET=your-secret uv run flask --app main seed-demo --tenant-id desktop-demo

# Run (local mode with SQLite)
STEP_UP_SECRET=your-secret python main.py

# Run with upstream FHIR server
FHIR_UPSTREAM_URL=https://hapi.fhir.org/baseR4 STEP_UP_SECRET=your-secret python main.py

# Open browser
open http://localhost:5000            # Landing page with live demo
open http://localhost:5000/r6-dashboard  # Interactive dashboard

Docker

bash
docker-compose up -d --build

# macOS note: port 5000 conflicts with AirPlay Receiver — remap with:
# HOST_PORT=5050 docker-compose up -d --build

# Services:
# - fhir-mcp-guardrails (Flask, port 5000)
# - agent-orchestrator (MCP server, port 3001)
# - redis (port 6379)

MCP Tools (29)

Tool names use underscores (not dots) for Claude Desktop / MCP client compatibility.

Read tools (no step-up for public tenants):

ToolDescription
context_getRetrieve pre-built context envelopes
fhir_readRead a FHIR resource (redacted)
fhir_searchSearch with patient, code, status, date filters
fhir_validateStructural validation
fhir_statsObservation statistics (count/min/max/mean)
fhir_lastnMost recent N observations per code
fhir_interpret_labsLab reference-range interpretation ($interpret) — decision support, not diagnosis
care_gapsPreventive-care gaps ($care-gaps) — screenings/immunizations that may be due, from the patient's own records
guardrail_conformanceRun the guardrail conformance self-test — graded A–F scorecard across all seven properties
fhir_permission_evaluateR6 Permission access control evaluation
fhir_subscription_topicsList available SubscriptionTopics
questionnaire_populateSDC $populate — pre-fill a Questionnaire for a subject
curatr_evaluateEvaluate a FHIR resource for data quality issues
action_statusPoll a real-world action (call/SMS)
searchChatGPT-connector-compatible search — thin wrapper over fhir_search, returns compact {id, title, url} results
fetchChatGPT-connector-compatible fetch by ResourceType/id — thin wrapper over fhir_read, returns {id, title, text, url, metadata}

Write tools (require step-up token):

ToolDescription
fhir_propose_writeValidate + preview without committing
fhir_commit_writeCommit with step-up auth + human-in-the-loop
questionnaire_extractSDC $extract — extract resources from a completed QuestionnaireResponse
curatr_apply_fixApply patient-approved fixes with Provenance tracking
action_propose / action_commitPropose / commit a real-world phone call or SMS
rx_transfer_requestDraft a pharmacy-transfer request call from active meds (Schedule II refused); commit via action_commit
shl_generateGenerate an encrypted SMART Health Link (QR)

Utility tools:

ToolDescription
fhir_get_tokenIssue a 5-minute step-up token (call before any write)
fhir_seedSeed a tenant with demo Patient + Observations + Condition
fhir_compiled_truthCurrent state + Provenance evidence timeline

All tools add _mcp_summary with reasoning, clinical context, and limitations.

Guardrail Demo

The 6-step demo at /r6/fhir/demo/agent-loop shows the full guardrail sequence:

  1. PHI Redaction — Agent reads a patient, receives redacted data
  2. $validate Gate — Agent proposes an Observation, validated before write
  3. Permission Deny — No Permission rule exists, access denied with reasoning
  4. Permission Permit — Permit rule created, re-evaluation succeeds
  5. Step-up + Human-in-the-loop — Write requires both token and human confirmation
  6. Commit + Audit — Write succeeds, full audit trail generated

Comparison

FeatureThis ProjectAWS HealthLake MCPMedplum MCPRaw FHIR API
Works with any FHIR serverYesHealthLake onlyMedplum onlyN/A
PHI redaction on readsYesNoNoNo
Immutable audit trailYesCloudTrail (separate)PartialNo
Step-up auth for writesYesIAM (separate)Medplum authNo
Human-in-the-loopYesNoNoNo
Permission $evaluate (R6)YesNoNoNo
Setup time10 seconds30+ minutes15+ minutesVaries

FHIR Version Support

VersionProfileStatusResources
R4US Core v9StablePatient, Condition, AllergyIntolerance, Immunization, MedicationRequest, Procedure, DiagnosticReport, CarePlan, CareTeam, Goal, DocumentReference, Coverage, ServiceRequest, Location, Organization, Practitioner, PractitionerRole, RelatedPerson, Specimen, FamilyMemberHistory
R6v6.0.0-ballot3ExperimentalPermission, SubscriptionTopic, DeviceAlert, NutritionIntake, DeviceAssociation, NutritionProduct, Requirements, ActorDefinition

Both R4 and R6 resources flow through the same guardrail stack (PHI redaction, audit, step-up auth, tenant isolation). R6 ballot resources may change before final release.

Testing

bash
# Python tests (1,490+ across 90+ files; includes action-rail, SDC, quality, labs, ops, CareAgents suites)
uv run python -m pytest tests/ -v
uv run python -m pytest tests/test_r6_routes.py::test_name -v   # single test

# MCP server tests
cd services/agent-orchestrator && npm ci && npm test

# Playwright end-to-end tests (UI + API, requires Flask on :5000)
cd e2e && npm ci && npx playwright install --with-deps chromium && npm test
cd e2e && npm run test:headed    # headed browser
cd e2e && npm run test:ui        # interactive UI mode

API Endpoints

EndpointMethodDescription
/r6/fhir/metadataGETCapabilityStatement
/r6/fhir/healthGETLiveness probe (reports upstream status)
/r6/fhir/{type}POSTCreate resource (requires step-up)
/r6/fhir/{type}GETSearch resources
/r6/fhir/{type}/{id}GETRead resource (redacted)
/r6/fhir/{type}/{id}PUTUpdate resource (requires step-up + ETag)
/r6/fhir/{type}/$validatePOSTValidate resource
/r6/fhir/Questionnaire[/{id}]/$populatePOSTSDC — pre-fill a QuestionnaireResponse from a subject
/r6/fhir/QuestionnaireResponse/$extractPOSTSDC — extract a transaction Bundle (?dryRun=true to preview)
/r6/fhir/{type}/{id}/$deidentifyGETConservative de-identification preview (expert review required)
/r6/fhir/Observation/$statsGETObservation statistics
/r6/fhir/Observation/$lastnGETMost recent observations
/r6/fhir/Permission/$evaluatePOSTR6 access control evaluation
/r6/fhir/SubscriptionTopic/$listGETSubscription topic discovery
/r6/fhir/Bundle/$ingest-contextPOSTBundle ingestion + context envelope
/r6/fhir/context/{id}GETRetrieve context envelope
/r6/fhir/AuditEventGETSearch audit events
/r6/fhir/AuditEvent/$exportGETExport audit trail (NDJSON/Bundle)
/r6/fhir/demo/agent-loopPOST6-step guardrail demo
/r6/fhir/oauth/**OAuth 2.1 + PKCE + SMART discovery
/r6/fhir/{type}/{id}/$curatr-evaluateGETEvaluate resource data quality (Curatr)
/r6/fhir/{type}/{id}/$curatr-apply-fixPOSTApply patient-approved fixes with Provenance

Local search accepts the parameters advertised by /r6/fhir/metadata. Unknown parameters default to lenient handling (a bounded search.mode="outcome" warning); Prefer: handling=strict returns a 400 OperationOutcome. Unsupported modifiers and malformed supported values always return 400. _count=0 and _summary=count are count-only searches. Self links contain exactly the applied, URL-encoded parameters, and audit output never echoes submitted filter values or arbitrary parameter names.

Upstream Proxy

Connect to real FHIR servers while keeping all guardrails active:

bash
FHIR_UPSTREAM_URL=https://hapi.fhir.org/baseR4 python main.py
  • Reads: Fetched from upstream, then redacted + audited + disclaimers added
  • Searches: Forwarded with all query params, results redacted per entry
  • Writes: Validated locally first, then forwarded with step-up auth check
  • URL rewriting: Upstream URLs never leak to clients

Tested with: HAPI FHIR R4/R5, SMART Health IT, Epic Sandbox.

Put the guardrails in front of your FHIR server — recipe for running the redaction + audit + step-up + human-in-the-loop stack in front of Medplum (the same pattern works for Aidbox, Google Cloud Healthcare, or any FHIR R4 server): docs/recipes/healthclaw-in-front-of-medplum.md. A repeatable integration test (tests/test_medplum_in_front.py) proves a Medplum-returned Patient comes back redacted + audited and writes are step-up gated before reaching Medplum.

Curatr — Patient-Owned Data Quality

Curatr is a patient-facing data quality skill that evaluates FHIR health records for coding issues and lets the patient decide how to resolve them.

text
1. Patient connects data → HealthClaw Guardrails deidentifies and loads it
2. OpenClaw calls curatr.evaluate → checks codes against live terminology APIs
3. Issues presented in plain language with impact and fix suggestions
4. Patient approves fixes → curatr.apply_fix updates resource + creates Provenance
5. Optional: generate a structured correction request for the source provider

What Curatr checks on a Condition:

CheckServiceExample
Deprecated code systemLocal lookup (no network)ICD-9-CM → critical
ICD-10-CM code validityNLM Clinical Tables APIInvalid code → warning
SNOMED CT / LOINC validitytx.fhir.org (HL7 public)Unknown code → warning
RxNorm drug codeRXNAV API (NLM)Missing RXCUI → warning
Display name accuracyCross-checked with canonical termMismatch → suggestion
Missing required fieldsStructuralNo clinicalStatus → warning

Every fix creates a linked Provenance resource recording patient intent, field changes, and agent attribution. All changes are audited in the immutable trail.

OpenClaw skill: skills/curatr/SKILL.md

SMART Health Links (Kill the Clipboard)

Patient-controlled encrypted record sharing via QR code, implemented on top of jmandel/kill-the-clipboard-skill (MIT, pinned fa0020d) — credit Josh Mandel. HealthClaw governs what enters the bundle (step-up auth, profiles, guardrails, audit trail); KTC governs sharing (zero-knowledge server-side storage, SHL STU 1 protocol, revocation, in-browser viewer).

What it does: The shl_generate MCP tool (Write group, step-up required) fetches the patient's guardrailed FHIR bundle, encrypts it client-side in the MCP server (the SHL server never sees plaintext), uploads ciphertext, and returns:

  • shlink — the shlink:/ URI to encode in a QR (an encrypted pointer, not data)
  • viewer_link — browser URL for clinic staff
  • manage_link — patient-only revocation + access-log URL

Security: The QR encodes only the encrypted pointer. PHI never appears in the QR image. The SHL server stores only ciphertext + sha256(auth_token). Persona hard rule: see skills/share-health-qr/SKILL.md — never direct-encode PHI into QR images (incident 2026-06-12).

Quick Start (local)

bash
# Start the SHL storage server (profile `shl`)
docker-compose --profile shl up -d

# Tell the MCP server where the SHL server lives
# Add to services/agent-orchestrator/.env or export:
export SHL_SERVER_URL=http://localhost:8000

Without SHL_SERVER_URL, shl_generate returns an explicit simulation stub (simulated: true) — never a fake link.

Railway Deploy

bash
# 1. Add the SHL service
railway add --service shl-server

# 2. Attach a persistent volume (SQLite lives here)
railway service shl-server && railway volume add --mount-path /data

# 3. Configure the SHL server
railway variables --service shl-server \
  --set BASE_URL=<public-url-of-shl-server> \
  --set DB_PATH=/data/db.sqlite

# 4. Expose a public domain
railway domain --service shl-server

# 5. Deploy — MUST run from the shl-server directory
cd services/shl-server && railway up --service shl-server

# 6. Wire the MCP server to the SHL server
railway variables --service mcp-server \
  --set SHL_SERVER_URL=<public-url-of-shl-server>

Caveat 1 — deploy from the right directory: The repo-root railway.toml targets the Flask Dockerfile. If you run railway up --service shl-server from the repo root, Railway uses the wrong Dockerfile and the deploy fails. Always cd services/shl-server first — that directory has its own railway.toml that points to the correct image.

Caveat 2 — watchPatterns skip: A service that inherited watchPatterns from the root config may silently skip Dockerfile-only deploys (no source file changes detected). The per-service railway.toml in services/shl-server/ overrides this after the first successful build. If deploys are skipped, force one with railway up --service shl-server from the shl-server directory.

Caveat 3 — simulation mode: Without SHL_SERVER_URL on the MCP server, shl_generate returns { simulated: true, note: "SHL_SERVER_URL not configured — returned stub." }. Personas surface this note verbatim and never improvise an alternative.

OpenClaw skill: skills/share-health-qr/SKILL.md

R6-Specific Resources (Experimental)

These resources are part of the FHIR R6 ballot3 specification and may change before final release.

ResourceWhat's New in R6
PermissionAccess control (separate from Consent), $evaluate operation
SubscriptionTopicRestructured pub/sub (introduced R5, maturing R6)
DeviceAlertISO/IEEE 11073 device alarms
NutritionIntakeDietary consumption tracking
DeviceAssociationDevice-patient relationships
NutritionProductNutritional product definitions
RequirementsFunctional requirements tracking
ActorDefinitionActor role definitions

US Core v9 R4 Resources (Stable)

Standard FHIR R4 resources conforming to US Core Implementation Guide v9. These are widely deployed in US healthcare and stable for production use.

AllergyIntolerance, Immunization, MedicationRequest, Medication, MedicationDispense, Procedure, DiagnosticReport, CarePlan, CareTeam, Goal, DocumentReference, Location, Organization, Practitioner, PractitionerRole, RelatedPerson, Coverage, ServiceRequest, Specimen, FamilyMemberHistory

Environment Variables

VariableRequiredDefaultDescription
STEP_UP_SECRETProduction—HMAC-SHA256 signing secret
FHIR_UPSTREAM_URLNo—Upstream FHIR server (enables proxy mode)
SQLALCHEMY_DATABASE_URIProductionsqlite:///mcp_server.dbDatabase connection
SESSION_SECRETNo(dev key)Flask session secret
READ_AUTH_ENABLEDProductionfalseRequire tenant-bound credentials on protected reads
PUBLIC_TENANTSProduction—Explicit comma-separated synthetic/demo tenant allowlist
REDIS_URLProduction—Shared nonce, OAuth, rate-limit, and worker state
MCP_AUTH_TOKENHTTP MCP—Bearer credential required by MCP HTTP transports
MCP_PUBLIC_DEMONofalseRun an unauthenticated MCP server hard-pinned to a synthetic demo tenant (the public keyless demo). Never set on a server that reaches real tenants
MCP_DEMO_TENANTNodesktop-demoSynthetic tenant the demo server is pinned to when MCP_PUBLIC_DEMO is set
FHIR_UPSTREAM_TIMEOUTNo15Upstream request timeout (seconds)
FHIR_LOCAL_BASE_URLNo—Local URL for response URL rewriting

Database DDL is never run during WSGI import. Run flask --app main init-db before each release; it applies the locked Alembic revisions. Operators adopting Alembic on an existing v1.8.0 Postgres deployment must follow the database migration runbook to verify and stamp the compatibility baseline before upgrading.

Project Structure

text
main.py                         Flask app entry point
app.py                          Web UI routes (landing, dashboard)
r6/
  routes.py                     R6 FHIR REST Blueprint (1,732 lines)
  models.py                     R6Resource, ContextEnvelope, AuditEventRecord
  validator.py                  FHIR R6 structural validation
  redaction.py                  PHI redaction (names, identifiers, addresses, DOB, telecom)
  audit.py                      Immutable AuditEvent recording
  stepup.py                     HMAC-SHA256 step-up token management
  oauth.py                      OAuth 2.1 + PKCE + SMART-on-FHIR discovery
  health_compliance.py          Disclaimers, HITL, de-identification preview, audit export
  context_builder.py            Bundle ingestion + context envelopes
  rate_limit.py                 Per-tenant rate limiting
  fhir_proxy.py                 Upstream FHIR server proxy with URL rewriting
  curatr.py                     Curatr data quality engine (terminology lookups + fix application)
services/agent-orchestrator/
  src/index.ts                  MCP server (Streamable HTTP + SSE)
  src/tools.ts                  12 tool definitions + executor (incl. curatr.evaluate, curatr.apply_fix)
e2e/                            Playwright end-to-end tests
templates/                      Jinja2 (landing page, dashboard)
static/                         CSS + JS for interactive dashboard
skills/curatr/                  Curatr OpenClaw skill definition
tests/                          266 pytest tests (8 files, incl. test_us_core_r4.py)

Personal FHIR data store — patient import flow

This walkthrough shows how to go from a raw HealthEx export to querying your own records through Claude Code's MCP tools.

1. Start the stack

bash
uv sync
uv run python main.py                         # Flask on :5000
cd services/agent-orchestrator && npm ci && npm start  # MCP on :3001

2. Import your HealthEx / Flexpa / generic FHIR bundle

bash
# Dry-run first to preview without writing
python scripts/import_healthex.py \
  --bundle-file ~/Downloads/my-records.json \
  --dry-run

# Real import — prints context_id on success
python scripts/import_healthex.py \
  --bundle-file ~/Downloads/my-records.json \
  --tenant-id my-patient \
  --step-up-secret "$STEP_UP_SECRET"

3. Connect Claude Code via MCP

.mcp.json in this repo auto-configures Claude Code when you open the project. Update X-Tenant-ID to match your --tenant-id:

json
{
  "mcpServers": {
    "healthclaw-local": {
      "type": "http",
      "url": "http://localhost:3001/mcp",
      "headers": { "X-Tenant-ID": "my-patient" }
    }
  }
}

Then in Claude Code:

text
Use fhir_search to find all my Conditions
Use context_get with context_id <ctx-id> to get my full context envelope
Use curatr_evaluate on Condition/<id> to check data quality

4. Set up Fasten Connect (optional)

bash
# .env additions
FASTEN_PUBLIC_KEY=<key>
FASTEN_PRIVATE_KEY=<key>
FASTEN_WEBHOOK_SECRET=<secret>
FASTEN_CURATR_SCAN=true    # auto-run Curatr after each import

Records arrive via webhook at /r6/fasten/webhook and are stored under the patient's canonical tenant ID.

5. Deidentify for sharing

bash
# De-identification preview (not a legal Safe Harbor determination)
curl -H "X-Tenant-ID: my-patient" \
  http://localhost:5000/r6/fhir/Patient/pt-1/\$deidentify

# Patient-controlled (preserves birthDate, strips institutional identifiers)
curl -H "X-Tenant-ID: my-patient" \
  "http://localhost:5000/r6/fhir/Patient/pt-1/\$deidentify?mode=patient-controlled&patient_id=my-patient"

6. Telegram bot (optional)

bash
TELEGRAM_BOT_TOKEN=<token> TENANT_ID=my-patient \
FHIR_BASE_URL=http://localhost:5000/r6/fhir \
python openclaw/bot.py

Commands: /health, /conditions, /labs, /curatr, /curatr fix, /approve.

Or via Docker Compose:

bash
docker-compose --profile openclaw up -d

7. Use Medplum as the backing FHIR store (optional)

Set in .env (leave FHIR_UPSTREAM_URL empty):

bash
MEDPLUM_BASE_URL=https://api.medplum.com/fhir/R4
MEDPLUM_CLIENT_ID=<id>
MEDPLUM_CLIENT_SECRET=<secret>

All guardrails apply to Medplum responses identically to local SQLite mode. Access tokens are cached in Redis (key medplum:access_token; falls back to in-process cache when Redis is unavailable).


Known Limitations

  • The conformance grade is a self-test of the guardrail layer, not a HIPAA assessment or third-party audit — see What this grade means
  • Local mode: JSON blob storage with table-scan search (no indexed fields)
  • Redaction is HIPAA Safe-Harbor-style field redaction (demographics), not Expert Determination. It's a compensating control that removes identifier-class fields (identifier values are removed outright, not truncated); it is not a legal de-identification determination. Production de-id rigor (profile-specific recursive allowlists, an Expert-Determination path) is on the roadmap (#112).
  • Validation is structural, not full StructureDefinition/profile conformance or terminology binding. What's demonstrated is the guardrail contract (redact + audit + step-up + human-confirm + tenant isolation + error fidelity), not production validation depth — that's tracked in #112.
  • SubscriptionTopic stored but notifications not dispatched
  • Clinical FHIR writes gate human-in-the-loop with a header flag (X-Human-Confirmed), not cryptographic confirmation — a compensating control for the demo, not proof a human acted. Real-world actions (phone/SMS/etc.) no longer use that header: commit only submits the action for out-of-band approval (202 awaiting_confirmation), and the patient's Approve tap consumes a single-use ActionConfirmation credential server-side before anything executes.
  • OAuth endpoints are for discovery/SMART advertisement; route enforcement is via step-up + read-auth tokens, and the auto-approve authorize flow is limited to public/demo tenants (no per-user consent screen)
  • No historical versioning (version_id increments but old versions not retrievable)
  • Upstream proxy: no response caching, no cross-version translation
  • Security is config-dependent — production requires READ_AUTH_ENABLED=true (authenticate non-public reads), INTERNAL_TOKEN_MINT_SECRET (gate token mint/seed for non-public tenants; fail-closed in prod when unset), PUBLIC_TENANTS limited to synthetic demo tenants, a real SESSION_SECRET/STEP_UP_SECRET, and https-only upstreams
  • Step-up tokens are valid for multiple writes within their 5-min TTL (not single-use); irreversible actions rely on state-machine idempotency (guarded WHERE status='proposed' claim) rather than nonce consumption

Contributing — this is a community effort

HealthClaw Guardrails is developed in the open as a shared reference, not a commercial product. The guardrail layer between AI agents and clinical data only gets trustworthy if a lot of people with different vantage points pressure-test it. We especially want:

  • Implementers building FHIR × MCP integrations — tell us where the patterns break in the real world.
  • Clinicians & compliance folks — challenge the redaction profiles, audit model, and the documented HIPAA postures.
  • Standards people (HL7 / SDC / SMART) — tell us where we've diverged from the spec, especially on $populate/$extract.
  • Anyone — open an issue, file a "you got this wrong," or send a PR.

Start here: CONTRIBUTING.md · Roadmap · Dev Guide · Code of Conduct · CHANGELOG.md · Security policy

Good first contributions are labeled in the issue tracker. Contributions are DCO-signed (git commit -s) under the MIT license — see LICENSING.md for the project's licensing posture going forward.

Community

License

MIT — free to use, fork, and build on. See LICENSE.

Εγκατάσταση

TypingMind
{
  "mcpServers": {
    "healthclawguardrails": {
      "command": "claude",
      "args": [
        "plugin",
        "install",
        "healthclaw-guardrails@healthclaw-marketplace"
      ]
    }
  }
}

Χρησιμοποιήστε το MCP HealthClaw Guardrails με πολλά μοντέλα AI

Το TypingMind συνδέει τα εργαλεία MCP σε επίπεδο χώρου εργασίας. Έτσι, μόλις συνδεθεί το HealthClaw Guardrails, μπορείτε να το χρησιμοποιείτε με διαφορετικά μοντέλα AI στο TypingMind, αντί να το ρυθμίζετε ξεχωριστά για κάθε μοντέλο. Μπορείτε να εκτελέσετε το MCP τοπικά στη συσκευή σας ή να συνδεθείτε στο URL ενός απομακρυσμένου διακομιστή MCP.

Επιλογή 1: Χρησιμοποιήστε τον τοπικό σύνδεσμο

Επιλέξτε αυτή τη μέθοδο όταν ο διακομιστής MCP χρειάζεται πρόσβαση σε τοπικά αρχεία, εφαρμογές ή ιδιωτικούς πόρους στον υπολογιστή σας.

1

Ανοίξτε τις ρυθμίσεις MCP

Στο TypingMind, μεταβείτε στις «Ρυθμίσεις», έπειτα στις «Σύνθετες ρυθμίσεις» και στο «Model Context Protocol» και επιλέξτε «Ρύθμιση συνδέσμου».

  1. Ανοίξτε το TypingMind στο πρόγραμμα περιήγησής σας.
  2. Κάντε κλικ στο εικονίδιο «Ρυθμίσεις».
  3. Μεταβείτε στις «Σύνθετες ρυθμίσεις».
  4. Ανοίξτε την ενότητα Model Context Protocol.
  5. Κάντε κλικ στην επιλογή «Ρύθμιση συνδέσμου» και επιλέξτε «Αυτή η συσκευή».
Οθόνη ρύθμισης του συνδέσμου MCP του TypingMind με επιλεγμένη τη ρύθμιση «Αυτή η συσκευή»
2

Εκτελέστε την εντολή του συνδέσμου

Επιλέξτε «Αυτή η συσκευή», αντιγράψτε την εντολή από το TypingMind και εκτελέστε την στο Τερματικό. Διατηρήστε τη διεργασία σε λειτουργία όσο χρησιμοποιείτε το MCP.

  1. Αντιγράψτε την εντολή ρύθμισης που εμφανίζεται στο TypingMind.
  2. Ανοίξτε το Τερματικό στο macOS ή το Windows Terminal στα Windows.
  3. Επικολλήστε και εκτελέστε την εντολή.
  4. Εγκρίνετε την εγκατάσταση του πακέτου, αν το Τερματικό σάς ζητήσει επιβεβαίωση για να συνεχίσει.
  5. Διατηρήστε ανοιχτό το παράθυρο του Τερματικού και τη διεργασία σε λειτουργία όσο χρησιμοποιείτε εργαλεία MCP.
3

Προσθέστε το HealthClaw Guardrails ως διακομιστή

Όταν η κατάσταση του συνδέσμου είναι «Έτοιμος», κάντε κλικ στην επιλογή «Επεξεργασία διακομιστών» και επικολλήστε τις ρυθμίσεις του διακομιστή MCP.

  1. Περιμένετε μέχρι η κατάσταση του συνδέσμου να εμφανιστεί ως «Έτοιμος».
  2. Κάντε κλικ στην επιλογή «Επεξεργασία διακομιστών».
  3. Επικολλήστε τις ρυθμίσεις του διακομιστή MCP HealthClaw Guardrails.
  4. Αποθηκεύστε τη λίστα διακομιστών.
  5. Κάντε ανανέωση αν θέλετε να επιβεβαιώσετε ότι ο σύνδεσμος παραμένει έτοιμος για χρήση.
Ρυθμίσεις MCP του TypingMind με ενεργό διακομιστή και το κουμπί «Επεξεργασία διακομιστών»
{
  "mcpServers": {
    "healthclawguardrails": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

Χρησιμοποιήστε τη σύνδεση με διαφορετικά μοντέλα

Αποθηκεύστε τη λίστα διακομιστών, ανοίξτε τα «Πρόσθετα», ενεργοποιήστε τα εργαλεία MCP του HealthClaw Guardrails και έπειτα επιλέξτε οποιοδήποτε υποστηριζόμενο μοντέλο AI στο TypingMind. Χρησιμοποιήστε τα εργαλεία στη συνομιλία ή αναθέστε τα σε έναν πράκτορα AI.

  1. Ανοίξτε τη σελίδα «Πρόσθετα» στο TypingMind.
  2. Ενεργοποιήστε τα εργαλεία MCP του HealthClaw Guardrails.
  3. Ξεκινήστε μια συνομιλία και επιλέξτε το μοντέλο AI που θέλετε να χρησιμοποιήσετε.
  4. Χρησιμοποιήστε τα εργαλεία MCP στη συνομιλία ή αντιστοιχίστε τα σε έναν πράκτορα AI.
  5. Μεταβείτε σε άλλο μοντέλο AI όποτε χρειάζεται, χωρίς να συνδέσετε ξανά το MCP.
Συνομιλία στο TypingMind με ενεργοποιημένα εργαλεία MCP και επιλεγμένο μοντέλο AI
Μπορείτε να με βοηθήσετε με αυτή την εργασία χρησιμοποιώντας το HealthClaw Guardrails;
HealthClaw Guardrails
Βεβαίως. Το διάβασα.
Δείτε τι βρήκα μέσω του HealthClaw Guardrails.

Επιλογή 2: Προσθέστε URL διακομιστή MCP

Επιλέξτε αυτή τη μέθοδο όταν το HealthClaw Guardrails φιλοξενείται ήδη σε απομακρυσμένο διακομιστή ή η ομάδα σας θέλει έναν κοινόχρηστο σύνδεσμο στον οποίο μπορούν να έχουν πρόσβαση πολλοί χρήστες.

1

Ανοίξτε τους συνδέσμους MCP

Στο TypingMind, μεταβείτε στα «Πρόσθετα», ανοίξτε τους «Συνδέσμους MCP» και επιλέξτε «Προσθήκη URL».

  1. Ανοίξτε το TypingMind στο πρόγραμμα περιήγησής σας.
  2. Μεταβείτε στα «Πρόσθετα».
  3. Ανοίξτε τους συνδέσμους MCP.
  4. Κάντε κλικ στην επιλογή «Προσθήκη URL».
Φόρμα προσθήκης URL προσαρμοσμένου διακομιστή MCP στο TypingMind
2

Επικολλήστε το URL του διακομιστή

Στο πεδίο «URL διακομιστή», εισαγάγετε το URL του διακομιστή MCP που σας δίνει ο πάροχος. Προσθέστε όνομα σύνδεσης, περιγραφή, εικονίδιο, προσαρμοσμένες κεφαλίδες HTTP ή ρυθμίσεις πελάτη OAuth, εφόσον απαιτούνται από τον διακομιστή.

  1. Επικολλήστε το το URL του διακομιστή MCP που σας δίνει ο πάροχος στο πεδίο «URL διακομιστή».
  2. Εισαγάγετε ένα όνομα σύνδεσης για το HealthClaw Guardrails.
  3. Αν θέλετε να αναγνωρίζετε ευκολότερα τη σύνδεση, προσθέστε περιγραφή και εικονίδιο.
  4. Προσθέστε προσαρμοσμένες κεφαλίδες HTTP ή στοιχεία πελάτη OAuth, αν ο διακομιστής απαιτεί έλεγχο ταυτότητας.
3

Δημιουργήστε τη σύνδεση

Κάντε κλικ στην επιλογή «Δημιουργία σύνδεσης», επιστρέψτε στη λίστα προσθέτων και επιβεβαιώστε ότι η νέα σύνδεση MCP είναι ενεργή.

  1. Κάντε κλικ στην επιλογή «Δημιουργία σύνδεσης».
  2. Επιστρέψτε στη λίστα συνδέσμων MCP.
  3. Επιβεβαιώστε ότι η σύνδεση HealthClaw Guardrails εμφανίζεται ως ενεργή.
  4. Ανανεώστε τη λίστα προσθέτων αν η σύνδεση δεν εμφανιστεί αμέσως.
4

Αλλάξτε μοντέλα χωρίς επανασύνδεση

Ξεκινήστε μια συνομιλία με το μοντέλο που προτιμάτε, ενεργοποιήστε τα εργαλεία του HealthClaw Guardrails από τα «Πρόσθετα» και μεταβείτε σε άλλο μοντέλο όποτε χρειάζεται. Η σύνδεση MCP παραμένει διαθέσιμη στον χώρο εργασίας του TypingMind.

  1. Ξεκινήστε μια νέα συνομιλία στο TypingMind.
  2. Επιλέξτε το μοντέλο AI που θέλετε να χρησιμοποιήσετε.
  3. Ενεργοποιήστε τα εργαλεία του HealthClaw Guardrails από τα «Πρόσθετα».
  4. Ζητήστε από το μοντέλο να χρησιμοποιήσει το εργαλείο όταν χρειάζεται.
  5. Μεταβείτε σε άλλο μοντέλο AI και χρησιμοποιήστε ξανά την ίδια σύνδεση MCP.
Συνομιλία στο TypingMind με ενεργοποιημένα εργαλεία MCP και επιλεγμένο μοντέλο AI
Μπορείτε να με βοηθήσετε με αυτή την εργασία χρησιμοποιώντας το HealthClaw Guardrails;
HealthClaw Guardrails
Βεβαίως. Το διάβασα.
Δείτε τι βρήκα μέσω του HealthClaw Guardrails.

Συχνές ερωτήσεις

Σε τι χρησιμεύει ο διακομιστής MCP HealthClaw Guardrails;

Το HealthClaw Guardrails είναι ένας διακομιστής MCP που επιτρέπει σε συμβατές εφαρμογές AI να συνδέονται με εξωτερικά εργαλεία και να λαμβάνουν πληροφορίες που παρέχουν το απαραίτητο πλαίσιο. Στο TypingMind, μπορείτε να προσθέσετε αυτόν τον διακομιστή MCP μία φορά και να κάνετε τα εργαλεία του διαθέσιμα στον χώρο εργασίας σας για AI.

Μπορώ να χρησιμοποιήσω τον διακομιστή MCP HealthClaw Guardrails με πολλά μοντέλα AI στο TypingMind;

Ναι. Το TypingMind συνδέει τα εργαλεία MCP σε επίπεδο χώρου εργασίας, ώστε να μπορείτε να χρησιμοποιείτε το HealthClaw Guardrails με διαφορετικά μοντέλα AI, όπως τα Claude, ChatGPT, Gemini ή άλλα μοντέλα που έχετε ρυθμίσει στο TypingMind, χωρίς να ρυθμίζετε τον διακομιστή MCP ξεχωριστά για κάθε μοντέλο.

Γιατί να χρησιμοποιήσετε τον σύνδεσμο MCP HealthClaw Guardrails με το TypingMind;

Το TypingMind είναι ένα από τα καλύτερα περιβάλλοντα συνομιλίας με μεγάλα γλωσσικά μοντέλα, καθώς συγκεντρώνει πολλά μοντέλα AI, προτροπές, πρόσθετα, πράκτορες AI, κλειδιά API και εργαλεία MCP σε έναν χώρο εργασίας. Συνδέοντας το HealthClaw Guardrails, μπορείτε να χρησιμοποιείτε τα εργαλεία MCP του με τα μοντέλα που προτιμάτε, διατηρώντας οργανωμένη τη ροή εργασίας των συνομιλιών σας στο TypingMind.

Πώς συνδέω τον διακομιστή MCP HealthClaw Guardrails στο TypingMind;

Μπορείτε να συνδέσετε το HealthClaw Guardrails στο TypingMind με τον τοπικό σύνδεσμο MCP ή προσθέτοντας το URL ενός απομακρυσμένου διακομιστή MCP. Χρησιμοποιήστε τον τοπικό σύνδεσμο όταν ο διακομιστής χρειάζεται πρόσβαση σε αρχεία, εφαρμογές ή ιδιωτικούς πόρους στη συσκευή σας και ένα URL διακομιστή όταν ο διακομιστής MCP φιλοξενείται απομακρυσμένα.

Ποια εργαλεία παρέχει ο διακομιστής MCP HealthClaw Guardrails στο TypingMind;

Το HealthClaw Guardrails διαθέτει δυνατότητες MCP που μπορείτε να ενεργοποιήσετε από τη σελίδα Πρόσθετα του TypingMind και να χρησιμοποιήσετε σε συνομιλίες ή να αναθέσετε σε πράκτορες AI.

Χρειάζεται να κοινοποιήσω τα κλειδιά API μου στο TypingMind για να χρησιμοποιήσω τον διακομιστή MCP HealthClaw Guardrails;

Όχι. Το TypingMind δίνει προτεραιότητα στην τοπική λειτουργία και σας επιτρέπει να διατηρείτε τον έλεγχο των παρόχων μοντέλων, των κλειδιών API, των προτροπών και των ρυθμίσεων MCP σας. Αν το HealthClaw Guardrails απαιτεί έλεγχο ταυτότητας, προσθέστε τις απαιτούμενες κεφαλίδες, τις ρυθμίσεις OAuth ή τις τοπικές ρυθμίσεις για τον συγκεκριμένο διακομιστή MCP κατά τη δημιουργία της σύνδεσης.

Σχετικοί διακομιστές MCP

Προβολή όλων

Δημιουργήστε τώρα τον δικό σας χώρο εργασίας AI

Εγγραφείτε στο ενημερωτικό μας δελτίο για να ενημερώνεστε για νέες λειτουργίες και μελλοντικές κληρώσεις δώρων 👇