pii-mcp
Redact PII from MCP tool results before they reach the LLM. One-line FastMCP middleware, Python + TypeScript, Rust core.
Install / Use
claude mcp add foro-sh -- npx -y github:foro-sh/pii-mcpIf the server publishes to npm under a different name, use that package instead — check the repo README.
MCP Server
Model Context Protocol server
Quality Score
Category
SecuritySupported Platforms
Our assessment of pii-mcp
pii-mcp scores 83/100 on our quality scale, 890th of 1,117 Security skills we index.
Its MCP Server is 6.7 KB long, well organised into 16 sections with 6 code examples: a thorough specification that gives an agent plenty to work with.
It has 10 GitHub stars, so there is little community track record yet; judge it on its content.
Maintenance, license and trust
- The repository was last updated today, so pii-mcp is actively maintained.
- It is released under the MIT license, a permissive license that allows use, modification and commercial use with attribution.
- Its trust signals score 97/100, with no cautions. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.
pii-mcp compared with similar skills
All 4 of these similar skills score higher than pii-mcp; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| pii-mcp (this skill)by foro-sh | 83 | 10 | today | MCP Server |
| Agent-Reachby Panniantong | 100 | 100.5k | 1d ago | CLAUDE.md |
| headroomby headroomlabs-ai | 100 | 77.0k | today | CLAUDE.md |
| CowAgentby zhayujie | 100 | 47.5k | today | CLAUDE.md |
| Scraplingby D4Vinci | 100 | 89.0k | today | MCP Server |
Frequently asked questions
- How do I install pii-mcp?
- Run
claude mcp add foro-sh -- npx -y github:foro-sh/pii-mcp. The install tabs above show the steps for each supported agent. - Which AI agents does pii-mcp work with?
- It is written for Claude Code and Claude Desktop, as a MCP Server file. Other agents that read the same format can often use it too.
- Is pii-mcp safe to use?
- It is MIT-licensed and scores 97/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is pii-mcp still maintained?
- The repository was last updated today, so pii-mcp is actively maintained.
Skill content
View source on GitHubpii-mcp
Pattern-based PII redaction for MCP servers (regex + checksums). Masks emails,
IBANs, cards, BICs, MACs, IMEIs, IPs, coordinates, BSNs, US SSNs and ITINs, UK
National Insurance and NHS numbers, German tax IDs, Dutch BTW-ids, Dutch
passport/ID numbers, phones, street + house number addresses, Dutch and UK
postcodes, and Dutch license plates in tool results.
Language packs: en, nl, and opt-in de.
If pii-mcp saves you time, a ⭐ helps others find it.
Example
from pii_mcp import scrub_text
scrub_text(
"Contact ada@example.com. IBAN NL91 ABNA 0417 1643 00. card 4111111111111111"
)
# Contact [EMAIL]. IBAN [IBAN]. card [CREDIT_CARD]
For runnable scripts including a FastMCP server and payload scrubbing, see the examples/ directory.
Install
pip install "pii-mcp[fastmcp]" # FastMCP >= 3.0.0
# or
pip install pii-mcp # core; platform wheels include Rust acceleration
# or
npm install pii-mcp
FastMCP
from fastmcp import FastMCP
from pii_mcp.fastmcp import PiiScrubMiddleware
mcp = FastMCP("MyServer")
mcp.add_middleware(PiiScrubMiddleware()) # languages=["en", "nl"] by default
# mcp.add_middleware(PiiScrubMiddleware(languages=["en", "nl", "de"]))
Results only. On scrub failure or oversize, the result is withheld, never forwarded unmasked.
Core
from pii_mcp import scrub_text, scrub_payload
scrub_text("mail ada@example.com")
scrub_payload({"email": "ada@example.com"}, languages=["en"])
Scope
Pattern Tier 1 only: structured identifiers that regex and checksums can reach. Aligned with AP: wat zijn persoonsgegevens where that layer applies. Free-text health data (allergies), photos/audio/ video, and unstructured klant-/personeelsnummers stay out of scope.
person is pattern / key-aware when available (issue #52); until then the
count stays 0. Prose name NER is out of band — this package does not ship
an in-process NER model. Decimal/DMS location coordinates stay here;
free-text place names do not.
Using with foro / Presidio
| Layer | Owner | | ----- | ----- | | Pattern / checksum / language packs / MCP middleware | this package (Tier 1) | | PERSON / LOCATION NER on API paths | Presidio or another NER sidecar (Tier 2) |
Live MCP gates in user containers should run Tier 1 only (no model). On platforms such as foro, keep NER in one Presidio sidecar on API paths — do not stack a second in-process NER beside it.
AP coverage (pattern layer)
| AP example / category | Detector | Notes |
| --------------------------------------------- | -------------------------------------- | ------------------------------- |
| e-mail / contact | email, phone | Incl. Unicode (EAI/IDN) email |
| IP-adres | ip | Indirect identifier |
| Locatiegegevens | location | Decimal and DMS lat/lon |
| Financiële gegevens | iban, credit_card, bic, vat_id | NL BTW / DE USt-IdNr |
| BSN / nationaal ID | bsn, passport | Passport/NIK format (nl pack) |
| Nationaal ID (US / UK) | ssn, tax_id | US SSN/ITIN, UK NINO (en pack) |
| Gezondheidsgegevens (health ID) | ssn | UK NHS number, grouped (en) |
| Online / device IDs | mac, imei | IMEI: grouped forms + Luhn |
| Adres | address | Street + number; NL/UK postcode |
| Kenteken | license_plate | nl pack |
| Naam | person | Pattern/key-aware when available (#52); prose NER out of band |
| Pasfoto, allergieën, koopgedrag, camera | | Media / free text |
Packages
| Runtime | Path | Install |
| ---------- | ----------------- | ----------------------------- |
| Python | src/pii_mcp | pip install pii-mcp |
| TypeScript | typescript/ | npm install pii-mcp |
| Gate (JS) | typescript/gate/ | COPY pii-gate.mjs (zero npm deps) |
| Rust core | crates/pii-core | shared by both (PyO3 / N-API) |
Tier 1 gate contract for foro user containers (caps, placeholders, binary skip):
docs/tier1-gate.md.
Rust core (Python)
Published platform wheels ship pii_mcp._native (PyO3 over pii-core). Pip
prefers those on supported OS/arch; elsewhere (or with --no-binary) you get
the pure-Python hatchling wheel/sdist and the same scrub API.
When _native is importable, scrub_text / scrub_payload use it. Force the
Python path with PII_MCP_BACKEND=python; require native with
PII_MCP_BACKEND=native.
Local development from a clone (optional):
pip install -e ".[native]"
maturin develop --release --manifest-path crates/pii-mcp-native/Cargo.toml
Performance (Python vs Rust release)
Medians from scripts/bench_backends.py on macOS arm64 / CPython 3.14.7
(release native build; debug builds are not representative):
| Case | Python | Rust | Speedup |
| --------------------- | -------- | -------- | ------- |
| Short clean text | 0.234 ms | 0.023 ms | 10.2x |
| Short mixed PII | 0.058 ms | 0.007 ms | 8.9x |
| 100 KiB sparse PII | 20.4 ms | 2.0 ms | 10.2x |
| 1 MiB sparse PII | 203 ms | 20.4 ms | 10.0x |
| Nested JSON payload | 12.4 ms | 1.2 ms | 10.3x |
| 1k x tiny scrub_text | 54.3 ms | 6.8 ms | 8.0x |
python scripts/bench_backends.py
Contributing
See CONTRIBUTING.md for setup, how to add a detector, and the checks a PR must pass.
Related Skills
Agent-Reach
100.5kGive your AI agent eyes to see the entire internet. Read & search Twitter, Reddit, YouTube, GitHub, Bilibili, XiaoHongShu — one CLI, zero API fees.
headroom
77.0kCompress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.
CowAgent
47.5kOpen-source personal AI assistant & Agent Harness. Plans tasks, runs tools and skills, self-evolves with memory and knowledge. Multi-agent, multi-model, multi-channel. Lightweight, extensible, one-line install.
Scrapling
89.0k🕷️ A Web Scraping framework that handles everything from a single request to a full-scale crawl! Don't be shy, join here: https://discord.gg/EMgGbDceNQ and follow here for daily tips and tricks: https://x.com/Scrapling_dev
Languages
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.
