Redactor MCP
A zero-egress local MCP server and in-memory vault for redacting state-work PII (SSN, ITIN, EIN, DOB, addresses, bank routing/account numbers, state/case IDs) and software engineering secrets (API keys, tokens, private keys, DB URIs, .env values) before they reach AI agents (Antigravity and Amazon Kiro), with deterministic placeholder mapping and one-way egress rehydration.
Architecture
- Persistent Docker Vault (
network_mode: none,tmpfsRAM only): Holds session placeholder mappings (<<REDACT:PII_SSN:a9f3:1>>or format-preserving synthetic tokens like900-00-0001) strictly in memory with TTL expiration and zero network access. - Schema / Key-Aware & Document Redaction: Automatically redacts sensitive keys/columns (names, DOBs, SSNs, Medicaid/case IDs, secrets) in
.json,.jsonl,.csv,.tsv, and SQLINSERTdumps, plus extracts and redacts text/tables from.pdf,.docx, and.xlsxfiles. - Scrubbed Execution (
vault_run_scrubbed): Runs test suites or linters strictly insideclean-staging/and scrubs any secrets/PII fromstdout/stderrbefore returning output. - Batch Output Sync & Auto-Watch:
vault_sync_outputbatch-rehydratesclean-staging/intofinal-output/, andredactor-mcp watch <dir>pollssensitive/(WSL2/mnt/c/safe) to auto-stage new files. - Allowlists &
.redactorignore: Skip noisy lockfiles/assets and allowlist known benign placeholder strings. - Compliance Audit & Encrypted Pause/Resume: Append-only non-secret JSONL audit log (
REDACTOR_AUDIT_LOG) plus AES-256 encryptedsnapshot-save/snapshot-loadCLI commands. - MCP
stdioBridge (docker exec -i): Both Antigravity and Amazon Kiro connect overstdioviawsl.exeinto the same running container, sharing the same session vault without opening any TCP ports. - One-Way Egress:
vault_write_file,vault_rehydrate_file, andvault_sync_outputrestore placeholders back into real values only when writing to approvedfinal-output/paths (neverclean-staging/or symlinks), and return only byte/token counts—never raw secrets—to the agent. - Antigravity Plugin & Guardrails: Drop-in plugins/redactor-vault bundle (MCP config +
PreToolUse/PreInvocationhooks + rule + skill), plus standalonehooks.json/hooks.windows.jsontemplates.
Quick Start (Windows + WSL2 + Docker)
-
Copy this repository into your WSL2 filesystem (e.g.,
~/redactor-mcp) for POSIX permissions and fast I/O:cd ~/redactor-mcp chmod +x scripts/wsl_setup.sh scripts/hooks/agy_guard.py ./scripts/wsl_setup.sh(To enable offline Microsoft Presidio + spaCy NER for unstructured person names/locations in case notes, build with
INSTALL_NER=trueindocker-compose.ymland setREDACTOR_ENABLE_NER: "true".) -
Connect Antigravity:
- Copy
configs/antigravity/mcp_config.jsoninto~/.gemini/config/mcp_config.json(merge undermcpServers). - Copy
configs/antigravity/hooks.jsonto your project's.agents/hooks.json(adjusting the path toagy_guard.py) andconfigs/antigravity/GEMINI.mdto your workspace root.
- Copy
-
Connect Amazon Kiro:
- Copy
configs/kiro/mcp.jsoninto.kiro/settings/mcp.json(or~/.kiro/settings/mcp.json). - Copy
configs/kiro/hooks/protect-sensitive.jsoninto.kiro/hooks/.
- Copy
-
Clipboard Sanitize / Restore on Windows:
- Before pasting sensitive text into chat:
powershell -File .\scripts\win_clipboard.ps1 -Mode sanitize - After copying an agent response with placeholders:
powershell -File .\scripts\win_clipboard.ps1 -Mode restore
- Before pasting sensitive text into chat:
Running Tests Locally
Works on Python 3.9+ with zero external dependencies (or via pytest):
PYTHONPATH=src python3 -m unittest discover -s tests -v