EU PII Redaction

io.github.JulianJohansen由 GitHub 账号 JulianJohansen 发布v0.1.0更新于 Oct 24, 2026

Redact EU personal data (names, national IDs, IBANs) in text and files; restore it later.

已验证STDIO仅桌面文件与存储安全与监控

概览

AI 生成的概览

通过 EU PII Redaction API 对文本和文件中的欧盟个人数据(姓名、国家证件号、IBAN、银行卡、邮箱、电话)进行脱敏,并可稍后还原。

可以做什么
  • 对文本脱敏,返回脱敏后的文本以及实体列表(类型、偏移量和占位符),不含原始值。
  • 将 UTF-8 文件脱敏写入新文件,助手无需读取文件内容,只报告统计数量。
  • 使用保存的还原映射在本地离线把原始值写回文件。
  • 可只对指定类型脱敏,或用星号掩码代替占位符。
适用场景
当含有欧洲个人数据的提示词、日志或文档需要经过大模型或用于 RAG 索引,且之后要把真实值还原到回答中时适用。也适合在不把文件内容暴露给对话的情况下批量脱敏文件。
运行要求
以 Python 包形式在本地运行,通过 uvx 启动(需要 Python 环境)。需要一个已订阅 EU PII Redaction API 的 RapidAPI 密钥,通过环境变量 RAPIDAPI_KEY 提供;免费方案每月 500 次请求。脱敏需要访问该 API 的网络连接,还原可离线完成。
安装前请注意
必须提供 RAPIDAPI_KEY 密钥,且脱敏会把文本发送给第三方 RapidAPI 服务,请先确认其数据处理条款。redact_file 和 restore_file 会在磁盘上写入新文件和还原映射,该映射包含原始个人数据,需妥善保护。基于规则的识别只是第一层防护,并非合规保证,会漏掉部分姓名、地址以及无国家区号的电话。

安装

在 SourceWeft 中

  1. 打开 控制台中的 EU PII Redaction,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

eu-pii-redact

Keep European personal data out of LLM prompts and logs, and put it back in the answer. Python client, LangChain integration and MCP server for the EU PII Redaction API. Try it live without signing up · Quickstart · Privacy and data processing

text
Hi, my name is Karina Dahl. I was charged twice for order 88412.Please refund to DK50 0040 0440 1162 43 or call me on +45 32 12 34 56.Karina

becomes

text
Hi, my name is [PERSON_1]. I was charged twice for order 88412.Please refund to [IBAN_1] or call me on [PHONE_1].[PERSON_1]
  • Names from evidence, not capital letters: titles, greetings, roles, Name: labels, sign-offs, or a first name from 140,000 European names. "Best Practices" and "Court of Justice" stay as they are.
  • National ID numbers from 21 EU/EEA countries, checked by check digit and birth date (personnummer, HETU, DNI/NIE, codice fiscale, NIR, PESEL, BSN, CPR, ...).
  • IBANs (mod-97), cards (Luhn), EU VAT numbers, emails, phones (with + prefix), IPs.
  • Every mention of a person shares one placeholder; order and invoice numbers stay untouched.

You need a RapidAPI key with a plan for the API. The free plan gives 500 requests a month. Set it as RAPIDAPI_KEY.

Python

bash
pip install eu-pii-redact
python
from eu_pii_redact import Redactor
with Redactor() as r:                       # reads RAPIDAPI_KEY    redaction = r.redact(ticket)    reply = ask_llm(redaction.text)         # the model only sees placeholders    print(redaction.restore(reply))         # real values back in the answer

redaction.entities lists each finding with its type, offsets in the original text and placeholder (national IDs also carry country and scheme). Texts longer than 50,000 characters are sent in pieces with consistent placeholders. r.redact(text, types=["EMAIL", "IBAN"], mode="mask") masks with asterisks.

LangChain

bash
pip install "eu-pii-redact[langchain]"
python
from eu_pii_redact.langchain import protect, PIIRedactionTransformer
safe_llm = protect(llm)   # any model or chain that takes a stringsafe_llm.invoke("Draft a reply to Karina Dahl about her refund to DK50 0040 0440 1162 43")# the model sees [PERSON_1] and [IBAN_1]; the returned message has the real values again
docs = PIIRedactionTransformer().transform_documents(docs)   # e.g. before indexing for RAG

MCP server

Lets an AI assistant redact text and, more importantly, files without reading them: redact_file reads and writes the file itself and only reports counts, so the personal data never enters the conversation. restore_file puts the values back locally.

ToolWhat it does
redact_textRedact a text; returns the redacted text and entities (no original values)
redact_fileRedact a UTF-8 file into a new file; writes a restore mapping (owner-only permissions)
restore_filePut the original values back into a file using that mapping, offline

Claude Desktop (one click): download eu-pii-redact-0.1.0.mcpb from the latest release, open it, and paste your RapidAPI key when asked. The bundle sources are in mcpb/.

Claude Code

bash
claude mcp add eu-pii-redact -e RAPIDAPI_KEY=your-key -- uvx eu-pii-redact

Claude Desktop / Cursor / other hosts (mcpServers config)

json
{  "mcpServers": {    "eu-pii-redact": {      "command": "uvx",      "args": ["eu-pii-redact"],      "env": { "RAPIDAPI_KEY": "your-key" }    }  }}

Postman

Fork the public collection from the EU PII Redaction workspace (or import postman/eu-pii-redaction.postman_collection.json), set the collection variable rapidapi_key, and send: four requests with example responses and built-in tests.

Limits

Rule-based, which keeps it fast (about 0.1 s for 50,000 characters) and predictable: no street addresses yet, phone numbers need an international prefix, and a name without any cue whose surname is an English word ("Will Smith") is missed on purpose. Use it as a strong first layer, not as a compliance guarantee.

License

MIT for this client package. The API itself is a hosted service.

来源:README.md,提交 fcb3406

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.1.0最新Oct 1, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分