Securedact MCP

io.github.GigantesHJI由 GitHub 帳號 GigantesHJI 發布v0.2.1更新於 Oct 27, 2026

Local-first privacy MCP server for sensitive AI workflows

已驗證STDIO僅桌面檔案與儲存安全與監控

概覽

AI 產生的概覽

本地優先的隱私 MCP 伺服器,在文字進入模型或外部工具前偵測並遮蔽個人資料、憑證與敏感檔案。

可以做什麼
  • 為外部 AI 準備文字:使用建議的 prepare_for_external_ai 流程,或較低階的 analyze_text 與 redact_text,依版本化政策處理。
  • 透過 restore_text 從本機一次性工作階段還原被遮蔽的內容。
  • 用 securedact_read_file 安全讀取本機檔案,只回傳遮蔽後的文字並攔阻受保護路徑。
  • 用 create_safe_copy 在指定根目錄下寫入已核准的遮蔽 .txt 或 .md 副本。
  • 套用 strict_external_ai、gdpr、identifiers_only 等內建政策,並提供 HIPAA Safe Harbor 機械式去識別化輔助。
適用情境
當助理處理的提示、檔案或工具呼叫可能含有個人資料、憑證或受監管資訊,且希望在資料離開本機前先做本機檢查時使用。適合依 GDPR 類或 HIPAA 類政策為外部模型準備文字的團隊,但要注意它只是輔助工具,並非合規認證。
執行需求
以本機 stdio 程序執行,從 PyPI 安裝 securedact-mcp,需要 Python 3.12.x。情境式偵測需要選用的 ml 附加套件與經使用者同意的本機模型安裝;正式環境預設在缺少模型時失敗關閉。僅用決定性偵測需設定 SECUREDACT_REQUIRE_FLAIR=0。除錯回應需在程序啟動時設定 SECUREDACT_ENABLE_DEBUG_RESPONSES=1。預設不需要供應商憑證,也不開放網路監聽。
安裝前請注意
MCP 模式不會自動攔截每一則提示:主機必須呼叫工具,且僅在 status 為 ok 時送出 sanitized_text,設定錯誤或惡意的主機可繞過此流程。review 模式的位移資訊可讓可信任的本機用戶端還原原值,應讓 review 回應留在本機。create_safe_copy 會寫入檔案,restore_text 會回傳原始內容。偵測可能漏掉新穎或對抗性揭露,HIPAA 與 GDPR 相關功能不構成合規認證。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Securedact MCP,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

SecuRedact MCP

[PyPI] [Python] [License: Apache-2.0]

SecuRedact is a local-first privacy and security layer for AI agents and AI workflows. It detects and protects sensitive data — personal data / PII, GDPR-sensitive information, credentials, API keys, tokens, secrets, and sensitive files — before that data reaches models, tools, files, or external destinations.

SecuRedact MCP is the Apache-2.0 open-source MCP server and reusable Python privacy engine. It detects sensitive text, applies versioned policies, redacts locally, and validates residual output before marking sanitized content approved.

MCP mode does not automatically intercept every prompt. The host must invoke the tool and send only sanitized_text when status == "ok"; a misconfigured or malicious MCP host can bypass that ordinary MCP workflow. Provider-native enforced hooks are separate integration assets: when a supported provider invokes such a hook at its prompt lifecycle boundary, it can apply the same deterministic decision before normal model processing. See SecuRedact Enforced.

Why SecuRedact

AI agents increasingly read files, call tools, and send prompts to external models. That exposes PII, credentials, and sensitive documents unless something checks the data first. SecuRedact is a privacy and security control for AI workflows:

  • Local-first — all detection, redaction, and policy evaluation run on your machine. No network listener by default, no telemetry, no provider calls.
  • PII / GDPR detection — names, emails, IBANs, identifiers, and special-category data are detected and pseudonymized or redacted.
  • Secret & credential protection — API keys, tokens, and passwords are detected and blocked from leaving your environment.
  • Filesystem protection — reads are defended against traversal/symlink escapes and blocked from protected paths such as .env.
  • AI Agent Privacy Firewall — enforced hooks for Claude Code and Gemini CLI run the same local decision before a prompt, model call, or tool action proceeds.
  • Network / egress awareness — outbound tool calls are classified (internal/external/unknown) so policy can require approval or block egress.

SecuRedact helps reduce exposure of sensitive data; it is not a guarantee of compliance or a claim that every leak is prevented. See Limitations.

HIPAA Safe Harbor (0.5.0)

SecuRedact 0.5.0 adds a HIPAA Safe Harbor mechanical-de-identification aid for 45 CFR 164.514(b)(2) text processing. It builds on the existing deterministic detection stack and adds an 18-category Safe Harbor mapping, US-specific identifiers (SSN with area/group/serial validation, US ZIP/ZIP+4, health-plan beneficiary, account numbers, ages over 89, VIN-format vehicle identifiers, fax), and an optional validated Flair PERSON-only gate for Category A (Names).

Use engine.hipaa_safe_harbor(text) or the HIPAA_SAFE_HARBOR_POLICY policy. This is a mechanical aid, not a compliance certification: it cannot satisfy the actual-knowledge prong (164.514(b)(2)(ii)) or replace Expert Determination (164.514(b)(1)). See docs/hipaa-safe-harbor-profile.md and docs/hipaa-safe-harbor-gap-analysis.md.

Quick start

Install from PyPI and run the guided setup (Windows):

powershell
py -3.12 -m pip install "securedact-mcp[ml]"securedact-mcp setup

Linux / macOS:

bash
python3.12 -m pip install "securedact-mcp[ml]"securedact-mcp setup

Protect a piece of text in seconds (deterministic-only demo, no model needed):

python
import os
os.environ["SECUREDACT_REQUIRE_FLAIR"] = "0"  # deterministic detectors onlyfrom securedact_core import RedactionRequest, SecuredactEngine
engine = SecuredactEngine.from_environment()result = engine.prepare(    RedactionRequest(        text="Contact [email protected], IBAN NL91ABNA0417164300",        policy="strict_external_ai",    ))print(result.status)  # "ok"print(result.sanitized_text)  # "Contact [EMAIL_1], IBAN [IBAN_1]"

Reproducible synthetic security demos: docs/distribution/security-demo.md.

Safe default workflow

Use prepare_for_external_ai for normal external-AI preparation:

json
{  "text": "Contact [email protected]",  "policy": "strict_external_ai",  "language": "auto",  "response_mode": "minimal"}

Approved response:

json
{  "schema_version": "1",  "status": "ok",  "sanitized_text": "Contact [EMAIL_1]",  "counts": {"email": 1},  "policy": "strict_external_ai",  "policy_version": 1,  "policy_digest": "...",  "reason_codes": []}

review_required and blocked responses never contain approved sanitized_text. Minimal responses contain no original text, raw entity values, mapping, exception body, stack trace, model path, or restoration handle unless restore_capable was explicitly selected.

Architecture and trust boundary

mermaid
flowchart LR    H["MCP host"] --> M["Securedact MCP"]    M --> D["deterministic detectors"]    M --> C["contextual detectors"]    D --> P["policy engine"]    C --> P    P --> R["redactor"]    R --> V["residual validator"]    V --> O["approved sanitized output"]    O --> W["host-controlled downstream workflow"]    H -. "host may bypass MCP" .-> W

The server has no provider clients, OpenAI-compatible proxy, reverse proxy, website, desktop chatbot, provider credentials, or provider-specific forwarding. See ADR 0001 and the threat model.

Tools

ToolIntended useSensitive-response behavior
prepare_for_external_aiRecommended complete safe workflowMinimal by default
analyze_textLower-level local analysis/reviewMinimal; offsets in review; raw values only in enabled debug mode
redact_textLower-level compatibility operationMinimal by default; explicit legacy mode is sensitive and deprecated
restore_textConsume a local opaque sessionSingle-use by default; direct mappings require explicit trusted legacy mode
create_safe_copyWrite approved .txt/.md content under one configured rootReturns no mapping or absolute path
securedact_read_fileSafely read a local file and return only sanitized textBlocks protected paths before reading; rejects traversal/symlink/binary; minimal by default

Response modes are minimal, review, debug, and restore_capable. Debug is disabled unless the process was started with SECUREDACT_ENABLE_DEBUG_RESPONSES=1; an MCP request cannot enable it. In-memory restoration sessions use cryptographic random handles, bounded capacity, expiration, concurrency protection, and single-use consumption. Process exit destroys all sessions.

See MCP tools, response privacy, and restoration sessions.

Installation

Python >=3.12,<3.13 is supported.

For a normal installation from PyPI:

powershell
py -3.12 -m pip install "securedact-mcp[ml]"securedact-mcp setup

On Linux or macOS, use python3.12 -m pip install "securedact-mcp[ml]"; python -m pip install "securedact-mcp[ml]" is also appropriate when python already selects a supported 3.12 environment.

setup checks the package, Python and ML dependencies, inspects local model state, offers the existing consent-based model installer, runs the existing offline verifier, and offers the packaged Claude Code and Gemini CLI integrations when those hosts are detected. It uses the providers' official plugin/extension commands and is safe to rerun. It does not call a provider model API, accept provider trust automatically, or download a contextual model unless the user explicitly selects model setup and accepts the existing upstream prompt.

Manual model commands remain available for advanced or unattended operation:

powershell
securedact-mcp installsecuredact-mcp models verifysecuredact-mcp

The last command starts a local stdio server. Standard output is reserved for MCP protocol messages. securedact-mcp setup --non-interactive reports state without implying upstream acceptance or configuring a new provider. Use --host claude, --host gemini, or --host all for targeted interactive provider setup.

Developer/source installation

To work from a reviewed source checkout instead:

powershell
git clone https://github.com/GigantesHJI/securedact-mcp.gitcd securedact-mcppython -m pip install ".[ml]"securedact-mcp setup

No model checkpoint is included in the repository or wheel, and startup never downloads one. Securedact does not redistribute these model weights. Upstream model weights retain their own licenses and are not relicensed by Apache-2.0. See model installation and third-party licenses.

Deterministic-only local development must be explicitly selected:

powershell
$env:SECUREDACT_REQUIRE_FLAIR = "0"securedact-mcp

Production defaults to requiring contextual capability and fails closed while a configured model is missing, loading, corrupt, or unavailable.

Host packages

Tested configuration assets and safe-workflow instructions are under integrations/ for Codex, Cursor, and Windsurf. The automated MCP client harness validates server startup, tool listing, calls, minimal response shape, stdout integrity, and shutdown. It does not prove that a real host invokes the tool for every prompt. See the compatibility evidence.

The repository is also a Gemini CLI extension root: gemini extensions install https://github.com/GigantesHJI/securedact-mcp can install the hooks. The gemini-cli-extension topic and a release whose tag tree contains the root manifest are required for that path to resolve; without pip install "securedact-mcp[ml]" and the local models the installed hooks do not enforce anything. See SecuRedact Enforced.

Policies and Python API

Built-ins include default, strict_external_ai, gdpr, identifiers_only, and review_all_contextual; compatibility policies remain available. Local organization policy files load only from the controlled policy directory, use a strict declarative schema, and cannot disable fail-closed invariants. Unknown, duplicate, oversized, malformed, or symlinked policies fail closed.

python
from securedact_core import RedactionRequest, SecuredactEngine
engine = SecuredactEngine.from_environment()result = engine.prepare(    RedactionRequest(        text="Contact [email protected]",        policy="strict_external_ai",    ))

from_environment() preserves the contextual-model requirement. Standalone deterministic development requires SECUREDACT_REQUIRE_FLAIR=0; applications may also inject tested detector implementations. See public API and policies.

Reproducible development

The committed uv.lock resolves runtime, ML, development, benchmark, and security extras for Python 3.12.

powershell
uv sync --frozen --extra dev --extra benchmarkuv run python scripts\verify.py

Never use real personal information, private documents, credentials, customer logs, or model weights in tests, issues, screenshots, fixtures, or pull requests. See CONTRIBUTING.md.

Evaluation and performance

powershell
uv run python -m securedact_eval quality --mode deterministic --gate `  --thresholds benchmarks\thresholds.json `  --baseline benchmarks\baselines\quality-deterministic.jsonuv run python -m securedact_eval performance --mode deterministic

The versioned synthetic corpus reports exact and relaxed span precision, recall, F1, false-positive and false-negative rates, per-entity/language/domain/split results, action/category accuracy, and bootstrap recall intervals. True negatives are document-level negative examples, not token-level safety. The GDPR-related suite is detection evaluation, not legal compliance certification. Real Flair and GPU benchmarks require an explicitly configured local model and are not ordinary CI. See benchmarking. The benchmark framework documents local data tiers and large profiles; the migration plan defines its future extraction boundary. For a failure before GitHub executes repository steps, use the CI troubleshooting decision tree. Local success does not replace a required GitHub check.

Security and limitations

  • No prompt, finding, mapping, restoration handle, secret, model input, or restored output is logged by application code.
  • Deterministic and contextual detection can miss novel, ambiguous, or adversarial disclosure; coreference and universal obfuscation resistance are not claimed.
  • Review offsets let a trusted local client with the original input reconstruct a value; keep review responses local.
  • Host behavior and downstream provider behavior are outside the trust boundary.
  • Repository security settings documented in files still require administrator verification.

Report vulnerabilities privately using SECURITY.md. Do not put vulnerability details or real data in a public issue.

License

Original repository source and documentation are licensed under the Apache License 2.0. Copyright attribution is recorded in NOTICE. Third-party dependencies and model weights retain their own licenses.

來源:README.md,提交 39974b9

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.2.1最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分