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 分