Pseudonymise medical and clinical documents by replacing patient identifiers with labelled tokens to protect privacy before AI processing.
Also known as nickjlamb/redacta, redacta
- Stars
- 9
- Tools
- 7
- Downloads, 30 days
- —
- Latest version
- 2.1.1
- Last commit
- Nov 9, 2026
- License
- MIT-0
What is Redacta MCP?
Redacta is an MCP server. Pseudonymise medical and clinical documents by replacing patient identifiers with labelled tokens to protect privacy before AI processing. It exposes 7 tools, such as protect, release_to_file, check_output.
Summary generated from the project's README
About Redacta MCP server
Redacta-mcp provides a privacy layer for medical and clinical documents by replacing sensitive patient identifiers with labelled tokens. This allows developers to process clinical text through AI models without exposing personally identifiable information. The server uses a two-layer approach combining deterministic pattern matching for structured data like NHS numbers, US SSNs, and postcodes with LLM reasoning to identify more complex details like patient names and addresses.
Users can run this server locally via npx or integrate it into environments like Claude Desktop and Cursor. It supports a complete privacy round trip where text is pseudonymised, processed by an external AI, and then re-identified locally using a token map. For organizations requiring strict data sovereignty, the engine can be self-hosted within a Kubernetes cluster as an HTTP service. This ensures that raw identifiers never leave the controlled environment before being tokenised.
What you can do with it
- 1Protect patient privacy during AI processingReplace sensitive identifiers in clinical notes with tokens before sending the text to an LLM.
- 2Perform HIPAA compliant de-identificationApply a strict redaction pass that removes all dates, specific ages, and other HIPAA-defined identifiers.
- 3Maintain data sovereignty in clinical environmentsDeploy the redaction engine within a private Kubernetes cluster to ensure identifiable text stays inside the organization.
Written from the project's README. Every use case is checked against a quote from it.
How to install Redacta MCP
Formats verified 10 Nov 2026Add to CursorAdd to GooseInstall Redacta MCP in Claude Code
$ claude mcp add redacta -- npx -y redacta-mcpInstall Redacta MCP in Cursor
~/.cursor/mcp.json
{
"mcpServers": {
"redacta": {
"command": "npx",
"args": [
"-y",
"redacta-mcp"
]
}
}
}Install Redacta MCP in VS Code
.vscode/mcp.json
{
"servers": {
"redacta": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"redacta-mcp"
]
}
}
}Install Redacta MCP in VS Code CLI
$ code --add-mcp '{"name":"redacta","type":"stdio","command":"npx","args":["-y","redacta-mcp"]}'Install Redacta MCP in Claude Desktop
claude_desktop_config.json
{
"mcpServers": {
"redacta": {
"command": "npx",
"args": [
"-y",
"redacta-mcp"
]
}
}
}Install Redacta MCP in Codex
$ codex mcp add redacta -- npx -y redacta-mcpInstall Redacta MCP in Codex config.toml
~/.codex/config.toml
[mcp_servers.redacta] command = "npx" args = ["-y", "redacta-mcp"]
Install Redacta MCP in Gemini CLI
$ gemini mcp add -s user redacta npx -- -y redacta-mcpInstall Redacta MCP in Gemini settings.json
~/.gemini/settings.json
{
"mcpServers": {
"redacta": {
"command": "npx",
"args": [
"-y",
"redacta-mcp"
]
}
}
}Started by HostedMCP on 16 Nov 2026
We ran this command for redacta-mcp 2.1.1 in an isolated container with no network and no keys. It answered and listed 7 tools.
Redacta MCP tools 7
Read from the server with tools/listprotectActionRedact 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.
release_to_fileActionRestore 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.
check_outputRead-onlyScan 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.
discard_sessionActionDelete a session's private mapping immediately instead of waiting for expiry. Idempotent. After this, no restoration is possible for that session.
redactRead-onlyLEGACY: 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.
reinstateRead-onlyLEGACY: 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.
self_checkRead-onlyScan 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.
Automated checks
Ran Nov 13, 2026Full report →Passed our automated checks. That is not a security audit: read the code and give the server the narrowest access it needs. How checks work
- Source repository linked and reachablenickjlamb/redacta is public and reachablegithub.com/nickjlamb/redacta ↗Pass
- Package names this repository as its sourceredacta-mcp names nickjlamb/redacta as sourcenpmjs.com/package/redacta-mcp ↗Pass
- Build provenance (Sigstore attestation)Sigstore attestation for redacta-mcpnpmjs.com/package/redacta-mcp/v/2.1.1#provenance ↗Pass
- Open source license (OSI)MIT-0spdx.org/licenses/MIT-0.html ↗Pass
- Commit or release in the last yearLast commit or release 2026-11-09github.com/nickjlamb/redacta ↗Pass
- OpenSSF ScorecardNot checked
- Package name not close to a popular packageNo popular package one edit away from redacta-mcpPass
- No critical advisory in the package or its dependencies100 resolved dependencies checked; no critical advisoryosv.dev ↗Pass
- No hidden instructions to the model0 tool descriptions and the README read; no override phrases, credential paths or hidden charactersPass
- Destructive tools are labelledNot checked
- Remote endpoint answers the MCP handshakeNot checked
README
View on GitHubRedacta
Pseudonymise medical and clinical documents before they're processed by AI or
shared. Redacta replaces patient identifiers with labelled tokens —
[PATIENT_NAME_1], [NHS_NUMBER_1], [DATE_OF_BIRTH_1], … — while leaving the
clinical meaning intact, and returns a redaction report alongside the cleaned
text.
It started as an Agent Skill and is now one engine shipped across eight surfaces — an iOS app, agent skill, MCP server, a self-hosted HTTP service with a Kubernetes deployment, two libraries, a CLI, and a FigJam whiteboard plugin.
Running this in production? Redacta offers a small number of fixed-price design-partner integrations for teams shipping AI agents on clinical or patient data — deployment in your environment, one real workflow integrated, and a data-flow document written for your DPO. Details →
One engine, many surfaces
| Surface | Folder | Get it |
|---|---|---|
| iOS app — iPhone (app, Share Extension, widget) | ios-app/ |
Build with Xcode — see ios-app/README.md |
| Agent skill (Claude Code / apps / API) | SKILL.md, scripts/ |
openclaw skills install redacta (ClawHub) |
| MCP server (Claude Desktop, Cursor, …) | mcp-server/ |
npx -y redacta-mcp (npm · MCP Registry · Anthropic MCP Directory) |
| TypeScript library | npm-package/ |
npm i @pharmatools/redacta (npm) |
| Python library | python-package/ |
pip install redacta (PyPI) |
| Command-line tool | cli-package/ |
npx redacta-cli (npm) |
| Self-hosted HTTP service + Kubernetes | gateway-service/ |
docker build — see gateway-service/README.md |
| FigJam plugin | figjam-plugin/ |
Figma Community |
The detection logic lives in one place — the TypeScript engine
(@pharmatools/redacta, in npm-package/), which the MCP server and the
FigJam plugin consume, and which the iOS app runs on-device via JavaScriptCore.
The Python package mirrors it for pip users; the agent skill adds LLM reasoning
for free-text names on top of the deterministic patterns.
How it works
Two layers:
- Patterns (deterministic). A bundled script (
scripts/redact_structured.py, Python standard library only, no network) matches fixed-format identifiers: NHS numbers (Modulus-11 validated), UK National Insurance numbers, dates of birth, UK postcodes, phone numbers, emails, and hospital/MRN numbers. US SSN and ZIP codes are also handled. - Reasoning (judgement). The skill then has the agent handle what patterns can't: patient names (told apart from the clinicians treating them), relatives and carers, postal addresses, and identifying ages.
- Self-check. A final pass re-reads the output for any identifier that slipped through before the report is written.
It also works in reverse. Re-identification (scripts/reinstate.py) takes the
token map from an earlier redaction and restores the original values — so you can
redact a document, run it through another AI tool, and put the real details back
locally. Redact → process → re-identify is a complete round trip, and identifiers
only ever exist on your machine.
Safe Harbor mode. Ask for HIPAA Safe Harbor (or "US de-identification") and Redacta applies a stricter pass: all dates (not just the date of birth), all specific ages, and the remaining HIPAA identifiers — fax, certificate/licence, device serial, VIN, and health-plan beneficiary numbers.
Self-hosting on Kubernetes
Organisations that can't let identifiable text leave their environment can
run Redacta inside their own infrastructure: a small HTTP service
(gateway-service/) deployable into an existing
Kubernetes cluster with plain YAML — two stateless replicas behind a
Service for redact/reinstate, an optional single-replica session boundary
for the protect → release loop, health probes, resource limits, restrictive
security defaults, and no-PHI logging. Text is pseudonymised before it
reaches any external AI service, and the processing boundary stays under
your control. Walkthrough (local kind cluster included):
gateway-service/k8s/README.md ·
concepts: docs/KUBERNETES.md.
Deploying somewhere a DPO will ask questions? There's a one-page security &
data-protection summary at
pharmatools.ai/redacta-security.
Install
Claude Code
git clone https://github.com/nickjlamb/redacta ~/.claude/skills/redacta
Then invoke it with /redacta, or let it trigger automatically when you ask to
redact or de-identify clinical text.
Claude apps / API
Zip the repository folder and upload it as a skill.
Contents
| Path | What it is |
|---|---|
SKILL.md |
The skill — instructions plus metadata |
reference.md |
Pattern specs, the Modulus-11 algorithm, NI prefix rules, the date-of-birth vs clinical-date rule, token vocabulary, limitations |
scripts/redact_structured.py |
The deterministic pattern layer |
scripts/reinstate.py |
The re-identification layer (restore originals from a token map) |
scripts/test_redact_structured.py |
Tests for the pattern layer |
scripts/test_reinstate.py |
Tests for the re-identification layer |
evaluations.json |
Example evaluation scenarios |
Run the tests:
python3 scripts/test_redact_structured.py
python3 scripts/test_reinstate.py
A note on limits
Redacta is a strong first line of defence, not a guarantee. It won't catch every possible identifier and isn't a substitute for formal data-protection processes. Always review the redaction report before sharing text.
License
MIT-0 (MIT No Attribution). Built by PharmaTools.AI.
Redacta MCP questions
How do I add Redacta MCP to Claude Code?
Run claude mcp add redacta -- npx -y redacta-mcp in your terminal. Add --scope user to make it available in every project.
How do I add Redacta MCP to Cursor?
Open ~/.cursor/mcp.json and add the server under mcpServers, using the Cursor config shown in the install section above.
What tools does Redacta MCP provide?
It exposes 7 tools, including protect, release_to_file, check_output, discard_session, redact.
How does Redacta protect patient privacy?
It replaces patient identifiers with labelled tokens like [PATIENT_NAME_1] while keeping clinical meaning intact, ensuring raw identifiers never cross the AI boundary.
Can I restore the original identifiers after processing?
Yes, the re-identification process uses a token map to restore original values locally after the text has been processed by an AI tool.
Does it support HIPAA compliance standards?
Yes, it includes a Safe Harbor mode that applies stricter redaction rules for HIPAA de-identification, including all dates and specific identifiers.
Is Redacta a guarantee of data protection?
No, it is a strong first line of defense but not a guarantee; users should always review the redaction report before sharing text.