Redacts PII/PHI from text before it reaches an LLM. Fail-closed, self-hosted, no egress.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
π‘ Paste into ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows)
An MCP server that redacts PII/PHI from text before it ever reaches an LLM β self-hosted, fail-closed, and HIPAA-aware.
Teams building LLM and agent pipelines in regulated domains have no clean, drop-in way to strip PHI/PII from a payload before it crosses into a model provider's infrastructure. umbryn-mcp is that boundary: three MCP tools β redact, restore, detect β that scrub sensitive values into reversible placeholders, run entirely inside infrastructure you control, and block the request if detection is uncertain instead of leaking data.
Send the redacted text to the model; keep the token_map local; call restore afterward to rehydrate the result. Round-trips are byte-exact and proven with property-based tests.
The PHI/PII-redaction MCP niche is real but underserved β the existing options are thin Presidio wrappers with no HIPAA-specific detection and, critically, no guarantee that a detection failure blocks the request instead of silently passing raw data through. So teams either roll their own boundary or ship sensitive data to a provider and lean on a BAA to cover it β the design-time mistake that causes real compliance incidents.
| Naive Presidio wrapper | Regex-in-your-app | Cloud DLP API | umbryn-mcp | |
|---|---|---|---|---|
| Drop-in MCP tools | sometimes | β | β | β |
| Fail-closed on uncertain detection | β | β | β | β |
| HIPAA identifiers (NPI, DEA, MBI, MRN, CLIA) | β | partial | partial | β |
| Reversible (restore original) | rarely | DIY | some | β |
| Runs self-hosted, zero egress | β | β | β (sends data out) | β |
| Works with zero heavy deps | β (needs spaCy) | β | n/a | β (regex engine) |
| Optional ML NER (names, addresses) | β | β | β | β
([presidio] extra) |
Why it was built: MCP went mainstream fast β it's now first-class in Claude, Cursor, and ChatGPT, across thousands of servers β but the PHI/PII-redaction corner was left to a few unmaintained wrappers. This fills that gap with a single honest, auditable, fail-closed boundary, kept open source so the redaction logic you depend on is fully inspectable rather than a black box.
redact (β scrubbed text + reversible token map), restore (β original), detect (β entities found, no mutation).pip install "umbryn-mcp[presidio]" adds Microsoft Presidio + spaCy for PERSON/LOCATION NER, transparently.restore(redact(x)) == x for arbitrary input; same input + config always yields the same output.Reach for umbryn-mcp when:
redact β send to model β restore.Reach for something else when:
Then register it with your MCP client.
Claude Desktop / Claude Code (claude_desktop_config.json, or claude mcp add umbryn-mcp -- umbryn-mcp):
Cursor (.cursor/mcp.json) and VS Code use the same shape β see examples/ for ready-to-paste configs.
Want name/address detection too?
The server auto-detects Presidio and upgrades β no config change needed. (Set UMBRYN_ENGINE=regex to force the dependency-free engine, or =presidio to require the ML one.)
A tool call comes in over stdio; the Redactor core runs the configured detection engine, resolves overlaps deterministically, applies the fail-closed threshold check, and swaps detected spans for reversible typed placeholders. Only scrubbed text is meant to leave the boundary you run.
The Redactor core depends only on a small DetectionEngine interface β never on Presidio or MCP directly. Raw data and the detection engine stay inside the boundary you run; only scrubbed text leaves it. See docs/ARCHITECTURE.md and docs/THREAT_MODEL.md.
redact(text) β { redacted_text, token_map, entities }Replaces detected PHI/PII with typed placeholders like [NPI_1]. token_map maps each placeholder back to its original value β keep it local; never send it to the model. entities lists what was redacted (type/span/score) for auditing.
restore(redacted_text, token_map) β { text }Reverses a redaction, recovering the original text exactly. Safe to call on model output that still contains the placeholders.
detect(text) β { entities, count }Reports the entities found β type, span, confidence β without modifying the text. Unlike redact, it surfaces low-confidence hits rather than blocking, so you can inspect coverage before trusting the boundary in a pipeline.
The pattern is redact β model β restore, with the token map never leaving your side:
redact(user_text). Send only redacted_text to the LLM. Keep token_map in your process β treat it as sensitively as the raw input, and never pass it to the model.[NPI_1], [US_SSN_1], etc. β semantically neutral tokens it can reason about and echo back.restore(model_output, token_map) to swap the real values back into the model's response before it reaches your user or database.redact returns a [LOW_CONFIDENCE] or [DETECTION_ERROR] tool error, the boundary refused to leak β surface it, tighten input, or lower the risk, but don't send the raw text onward.Before trusting it in a pipeline, call detect(sample_text) on representative (synthetic) data to see exactly what is and isn't caught, and tune the thresholds (below) to your risk tolerance.
Two thresholds govern every redact call:
detection_floor (default 0.35) β the sensitivity boundary. Signals below it are treated as noise.min_confidence (default 0.5) β the trust threshold.Any candidate that survives the floor but scores below min_confidence puts the call into fail-closed mode: it returns a [LOW_CONFIDENCE] error rather than redacting the confident spans and passing the uncertain one through. Engine errors return [DETECTION_ERROR]. On any error, no redacted text is returned. Both thresholds are configurable (see below).
All optional; sane defaults mean it runs with zero config. Set via the client's env block.
| Variable | Default | Meaning |
|---|---|---|
UMBRYN_ENGINE | auto | auto (Presidio if installed, else regex), regex, or presidio |
UMBRYN_MIN_CONFIDENCE | 0.5 | Trust threshold; detections below it fail closed |
UMBRYN_DETECTION_FLOOR | 0.35 | Below this, a signal is treated as noise |
UMBRYN_MAX_INPUT_CHARS | 100000 | Reject larger input with a typed error |
UMBRYN_SPACY_MODEL | en_core_web_lg | spaCy model for the Presidio engine |
UMBRYN_AUDIT_LOG | false | Emit a structured audit record per redact call (counts and types only) |
UMBRYN_CONFIG | (unset) | Path to a JSON config file (below) |
For settings that don't fit a flat environment variable, point UMBRYN_CONFIG at a JSON file. Environment variables still win over the file for the scalar values above, so you can ship one file and tweak per launch. A malformed file (bad JSON, unknown threshold, un-compilable regex) fails closed at startup rather than degrading silently.
A ready-to-copy example lives at examples/umbryn_config.json.
| Entity | Regex engine (default) | Presidio engine ([presidio]) |
|---|---|---|
| Email, Phone, SSN, Credit card, IP, URL | β | β |
| NPI (Luhn + 80840 check digit) | β | β |
| DEA (check digit) | β | β |
| Medicare MBI (position-typed) | β | β |
| MRN (context-anchored) | β | β |
| Medicare HICN (SSN + beneficiary code) | β | β |
| CLIA lab number | β | β |
| US ITIN (9XX-range structure) | β | β |
| UK NHS number (mod-11 check) | β | β |
| Canadian SIN (Luhn check) | β | β |
| US driver's license (context-anchored) | β | β |
| IBAN (mod-97 / ISO 7064 check) | β | β |
| Person names | β | β (spaCy NER) |
| Addresses / locations | β | β (spaCy NER) |
| Custom recognizers (your regex + check digit, via config) | β | β |
Detection quality is measured, not asserted. The numbers below are the default (zero-dependency) engine scored against the synthetic eval corpus β 200 generated documents, ~1,800 labeled spans, with checksum-failing look-alikes woven in as distractors to keep precision honest. Reproduce them with python eval/run_eval.py --markdown.
| Entity | Precision | Recall | F1 | TP | FP | FN |
|---|---|---|---|---|---|---|
CANADA_SIN | 1.00 | 1.00 | 1.00 | 87 | 0 | 0 |
CLIA_NUMBER * | 1.00 | 1.00 | 1.00 | 105 | 0 | 0 |
CREDIT_CARD | 1.00 | 1.00 | 1.00 | 72 | 0 | 0 |
DEA_NUMBER * | 1.00 | 1.00 | 1.00 | 119 | 0 | 0 |
EMAIL_ADDRESS | 1.00 | 1.00 | 1.00 | 144 | 0 | 0 |
IBAN_CODE | 1.00 | 1.00 | 1.00 | 87 | 0 | 0 |
IP_ADDRESS | 1.00 | 1.00 | 1.00 | 62 | 0 | 0 |
MEDICAL_RECORD_NUMBER * | 1.00 | 1.00 | 1.00 | 200 | 0 | 0 |
MEDICARE_BENEFICIARY_ID * | 1.00 | 1.00 | 1.00 | 126 | 0 | 0 |
MEDICARE_HICN * | 1.00 | 1.00 | 1.00 | 78 | 0 | 0 |
NPI * | 0.94 | 1.00 | 0.97 | 200 | 12 | 0 |
PHONE_NUMBER | 1.00 | 1.00 | 1.00 | 144 | 0 | 0 |
UK_NHS_NUMBER | 1.00 | 1.00 | 1.00 | 95 | 0 | 0 |
US_DRIVERS_LICENSE * | 1.00 | 1.00 | 1.00 | 81 | 0 | 0 |
US_ITIN | 1.00 | 1.00 | 1.00 | 97 | 0 | 0 |
US_SSN * | 1.00 | 1.00 | 1.00 | 136 | 0 | 0 |
\* = HIPAA-relevant identifier, subject to the CI quality gate. Aggregate over the gated set: precision 0.99, recall 1.00. The gate fails the build if recall drops below 0.90 or precision below 0.80. (NPI's 12 false positives are look-alike 10-digit numbers that happen to pass the Luhn/80840 check digit β a deliberate, fail-safe bias toward over-redaction.)
These are synthetic, best-case conditions with clean formatting and nearby context words; real-world text is messier. Treat this as a regression guardrail and a sanity check, not a guarantee β always evaluate on your own representative data.
This tool reduces PHI/PII exposure at one boundary. It does not make a system "HIPAA compliant." Compliance is a property of an entire system and organization β its policies, contracts, access controls, audit posture, and people β not of any single library. Running umbryn-mcp can be part of a compliant design, but it is not a certification, a guarantee, or a substitute for a Business Associate Agreement, a risk assessment, or legal counsel.
Concretely, this project does not: guarantee 100% detection (no detector does), de-identify beyond reversible redaction, cover non-text data, or act as a transparent proxy in v1 (redaction is via explicit tool calls you wire in). No detector is perfect β evaluate on your own representative data before relying on it. See docs/THREAT_MODEL.md for the full boundary, assumptions, and residual risks, and SECURITY.md to report issues.
Contributions are very welcome β this is a deliberately friendly place to make your first open-source PR, and the maintainer tries to respond quickly.
The easiest high-value contribution: add a detection recognizer for a new identifier (a regex + an optional check-digit validator + a test). The add-a-recognizer issue form doubles as the spec, and CONTRIBUTING.md walks through the six steps.
Other good ways to help: improve docs, add test cases or example client configs, or pick up something from the roadmap. Browse good first issues or open an issue to propose something.
The full guide β dev setup, conventions, and the no-real-PHI rule for fixtures β is in CONTRIBUTING.md. By contributing you agree your work is MIT-licensed.
MIT β matches Presidio and maximizes reuse. Built with Microsoft Presidio (optional) and the MCP Python SDK.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/umbryn-mcp)<a href="https://allmcps.com/mcp/umbryn-mcp"><img src="https://allmcps.com/api/badge/umbryn-mcp?style=directory" alt="Umbryn Mcp on AllMCPs" /></a>