pii-filter
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@pii-filter redact any personal data from this customer email before I share it"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
gliner-claude-pii-filter
Local PII redaction for Claude Code, with a human review step before Claude sees anything.
It combines the GLiNER2 model fastino/gliner2-privacy-filter-PII-multi with Slovak/Czech and secret-detection regexes.
Claude ─ Bash hook ─► pii-redact ─┐
Claude ─ MCP tools ───────────────┼─► daemon 127.0.0.1:8765 ─► nothing found: auto-approve
Claude ─ PostToolUse (MCP loki) ──┘ └► found: browser review ─► approve / reject / timeoutPieces
Path | What |
| Checksum-validated detectors: rodné číslo, IČO, DIČ/IČ DPH, IBAN, SK accounts, +421/+420/landline phones, cards (Luhn), public IPs, JWT/bearer/keys/ |
| Builds log "skeletons" (timestamps, ids, IPs, numbers masked) so repeated lines run through the model once |
| Combines regex and model results, consistent |
| In-memory review queue, browser UI, |
| FastAPI daemon (launchd |
|
|
| MCP tools |
| Claude Code hook (Bash/Read/Grep PreToolUse, |
Related MCP server: redact-mcp
Install (macOS, Python 3.10+)
git clone https://github.com/bratislava/gliner-claude-pii-filter ~/tools/pii-filter && cd ~/tools/pii-filter
python3 -m venv .venv && .venv/bin/pip install -e '.[test]'
.venv/bin/python -c "from gliner2 import AutoExtractor; AutoExtractor.from_pretrained('fastino/gliner2-privacy-filter-PII-multi')" # download model once
sed "s#__REPO__#$PWD#g" deploy/sk.local.pii-filter.plist.template > ~/Library/LaunchAgents/sk.local.pii-filter.plist
launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/sk.local.pii-filter.plist # daemon runs offline (HF_HUB_OFFLINE=1)
ln -sf "$PWD/.venv/bin/pii-redact" ~/.local/bin/pii-redact
claude mcp add --scope user pii-filter -- "$PWD/.venv/bin/pii-filter-mcp"Then add the following to ~/.claude/settings.json, replacing <repo> with the clone path:
"env": { "MCP_TOOL_TIMEOUT": "600000" },
"hooks": {
"PreToolUse": [{ "matcher": "Bash|Read|Grep", "hooks": [{ "type": "command", "timeout": 10,
"command": "<repo>/.venv/bin/python -I <repo>/hooks/pii_guard.py" }] }],
"PostToolUse": [{ "matcher": "mcp__.*loki.*", "hooks": [{ "type": "command", "timeout": 600,
"command": "<repo>/.venv/bin/python -I <repo>/hooks/pii_guard.py" }] }]
}Optionally, add a short section to ~/.claude/CLAUDE.md telling Claude to read logs and official documents with mcp__pii-filter__redact_file.
Operate
open http://127.0.0.1:8765/reviews # pending reviews
curl -s http://127.0.0.1:8765/health
launchctl kickstart -k gui/$(id -u)/sk.local.pii-filter # restart after code changes
tail -f ~/tools/pii-filter/logs/daemon.err.txt
.venv/bin/python -m pytest -q tests/ # unit tests
.venv/bin/python -I tests/bench.py # throughputEnvironment variables:
PII_OPEN_BROWSER=0turns off auto-opening review tabs.PII_REVIEW_TTL_Ssets how long a review can stay pending (default 900).PII_DEADLINE_Ssets how long the client waits for a decision (default 570).
Tuning (config.toml)
Copy config.example.toml to config.toml. It is reloaded on save, so no restart is needed.
[model.labels]: the categories GLiNER looks for, each with its confidence threshold.Defaults:
person,address/street_address,national_id_number,passport_numberanddrivers_license_number.Structured data (emails, phones, IBAN/accounts, RČ/IČO/DIČ, cards, public IPs, secrets) is left to the checksum-validated regexes. Model labels such as
usernameorsecretcaused mostly false positives on slugs, IDs and role names.Add a line to enable another label (the full list is in the file header). Raise a threshold to make a label stricter.
[regex] disabled: turns off regex detectors, e.g.["IP_ADDRESS"].[allow]: values that are never flagged.values: exact values, case-insensitive. Ticking remember un-redacted values on the review page appends here.patterns: regexes matched against the whole flagged value.email_domains: email addresses on these domains are kept.
Model PERSON hits that look like identifiers (no uppercase letter, or containing -_/@:.= or digits) are always dropped. A single capitalised word needs a confidence of at least 0.9.
Installed into
~/Library/LaunchAgents/sk.local.pii-filter.plist, generated fromdeploy/sk.local.pii-filter.plist.template~/.local/bin/pii-redact, a symlink to.venv/bin/pii-redact~/.claude.json: user-scope MCP serverpii-filter~/.claude/settings.json:hooks tagged
"_source": "pii-filter"env.MCP_TOOL_TIMEOUT=600000
~/.claude/CLAUDE.md: the "PII filter" section
Uninstall
launchctl bootout gui/$(id -u)/sk.local.pii-filter && rm ~/Library/LaunchAgents/sk.local.pii-filter.plist
claude mcp remove --scope user pii-filter
rm ~/.local/bin/pii-redactThen remove the _source: pii-filter hook entries and MCP_TOOL_TIMEOUT from ~/.claude/settings.json, and the PII section from ~/.claude/CLAUDE.md.
Limits
The hooks recognise commands by pattern, so they are not a security boundary. A Python or awk script reading a log directly is not caught.
If no decision is made within about 9.5 minutes (the Bash tool's 10-minute cap), the output is rejected.
Follow mode (
-f,sternwithout--no-follow,logcli --tail) is blocked.Private, loopback and link-local IPs are kept on purpose. Public IPs are redacted.
Available Tools
3 toolsredact_fileA
Read a local file (log, .gz log, JSON, text document), redact PII/secrets and return the content after the user approves it in the review UI. Use this instead of Read for logs and official documents.
Inputs: path (required). Returns: result
redact_textA
Redact PII/secrets from text. Blocks until the user approves the redaction in the review UI (instant when nothing is detected). Returns the approved redacted text or a withheld notice.
Inputs: text (required), context. Returns: result
scan_piiB
Count PII by type in text or a file WITHOUT returning any content (no review needed).
Inputs: path, text. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 3 tools
Each tool targets a distinct input+mode: redact_text for strings, redact_file for on-disk files, and scan_pii for detection-only without content return. The descriptions explicitly contrast the approval-blocking redaction tools with the non-blocking scan, leaving little room for misselection.
All three names follow a clean verb_noun pattern (redact_text, redact_file, scan_pii) with a consistent verb-object grammar. The verbs are semantically precise and the resource portion is unambiguous.
Three tools is well-scoped for a focused PII redaction utility, and each one earns its place covering a distinct surface (text, file, scan-only). Nothing feels redundant or padded.
The core lifecycle — scan first, then redact text or files — is fully covered, including a gzip-aware file path. Minor gaps remain, such as batch/directory redaction or configuration of which PII types to target, but agents can work around these.
Maintenance
Related MCP Connectors
Find and redact personal and sensitive data in text and documents, with reviewable redactions.
Detects and redacts PII (emails, phones, SSNs, names, addresses) from text. $0.02/call via x402.
Detect and redact PII and secrets (API keys, tokens) in text, HTML or PDF before it reaches an LLM.
Detect and redact PII and secrets before text reaches an LLM, with reversible placeholders.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables AI agents to redact PII from text, summarize redacted content, and manage custom redaction patterns across multiple languages.-
- FlicenseNot gradedqualityDmaintenanceAutomatically detects and obfuscates sensitive data (PII, secrets, etc.) before Claude processes it, with lossless restoration for client deliverables.6-
- FlicenseNot gradedqualityDmaintenanceRedacts PII from LLM traces and tool payloads before they leave review, enabling PII scanning, payload redaction, sensitive field classification, privacy receipts, and trace audit exports.-
- AlicenseNot gradedqualityDmaintenanceEnables sanitizing PII from text, classifying data into sovereignty zones, and monitoring compliance scores to keep sensitive information out of AI outputs.MIT