redacta-mcp

v2.1.1
io.github.nickjlamb/redacta-mcp Checked 1 day ago Published 1 month ago

Keep patient identifiers out of AI agent context — a local privacy boundary for healthcare agents.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

protect Protect text (mapping stays server-side)

Redact patient identifiers and PII, replacing each distinct value with a labelled token ([NHS_NUMBER_1], [PATIENT_NAME_1], ...). The reversal mapping is kept privately inside the Redacta server and is NEVER included in this response — you receive only the protected text, an opaque session_id for later controlled restoration, a count of what was replaced, and a self-check of possible leftovers. Sessions expire automatically.

ParameterTypeDescription
text *stringThe text to protect.
categoriesarrayWhich pattern sets to apply. Defaults to clinical + general. 'clinical' = NHS/NI/DOB/MRN/postcode/SSN/ZIP/email/phone/names; 'general' = URLs, IPs, payment cards, IBANs, account numbers, vehicle regs;…

release_to_file Restore identifiers into a local file

Restore original identifiers into text produced from a protected session, writing the result to a file inside the server's configured release directory (REDACTA_RELEASE_DIR). Returns only a receipt — file path, size, and counts — so restored data never enters the model context. This is the privacy-preserving way to complete the round trip.

ParameterTypeDescription
session_id *stringThe session_id returned by protect.
text *stringText containing Redacta tokens to restore.

check_output Check output for leaked identifiers

Scan generated text for verbatim reappearance of the original values held in a protected session (tolerant of spacing, dashes and case for identifier-like values) and re-tokenise anything found. Returns which token categories leaked — never the raw values — plus the sanitised text and a general self-check. Scope is verbatim reappearance only: paraphrases and inferred identities are not detected.

ParameterTypeDescription
session_id *stringThe session_id returned by protect.
text *stringModel output to inspect.

discard_session Discard a protection session

Delete a session's private mapping immediately instead of waiting for expiry. Idempotent. After this, no restoration is possible for that session.

ParameterTypeDescription
session_id *stringThe session_id to discard.

redact Redact / pseudonymise text (legacy — exposes token map)

LEGACY: like protect, but returns the token_map (token -> original value) in the response, which places the reversal key in the client and potentially the model context. Kept for backward compatibility and client-managed workflows. Prefer protect, which keeps the mapping server-side.

ParameterTypeDescription
text *stringThe text to redact.
categoriesarrayWhich pattern sets to apply. Defaults to clinical + general. 'clinical' = NHS/NI/DOB/MRN/postcode/SSN/ZIP/email/phone/names; 'general' = URLs, IPs, payment cards, IBANs, account numbers, vehicle regs;…

reinstate Re-identify from a client-held token map (legacy)

LEGACY: reverse a redaction using a token map held by the client (from the legacy redact tool). Restored personal data will appear in this tool result. For session-based restoration that keeps mappings server-side, use protect + release_to_file.

ParameterTypeDescription
text *stringText containing Redacta tokens to restore.
token_map *objectToken map, e.g. {"[NHS_NUMBER_1]": "943 476 5919"}.

self_check Self-check for residual identifiers

Scan already-redacted text for anything that still looks like an identifier (long numbers, emails, postcodes, URLs). A second pair of eyes, not a guarantee. Returns a list of possible leftovers to review.

ParameterTypeDescription
text *stringRedacted text to re-scan.