Mcp Secret Scrub

io.github.sudo-ai-git由 GitHub 账号 sudo-ai-git 发布v1.0.0更新于 Oct 24, 2026

Deterministic no-LLM MCP server that scrubs secrets before they reach an agent. Never leaks values.

已验证STDIO仅桌面开发者工具安全与监控

概览

AI 生成的概览

一个本地 MCP 服务器,在文本进入智能体上下文之前确定性地检测并脱敏其中的密钥。

可以做什么
它会扫描文本、日志和对话记录中的密钥模式,例如 AI 服务商密钥、云与 GitHub 令牌、JWT、PEM 私钥、Bearer 与 Basic 认证头、键值赋值以及连接字符串。工具包括 scrub_text(以脱敏、掩码或哈希方式处理匹配项)、scan_text(只报告存在哪些密钥类型而不做修改)、report_full(一次调用完成扫描与脱敏)以及 secret_profiles(列出支持的检测配置)。检测为纯模式匹配,不使用大模型,也不访问网络,相同输入的结果是确定的。
适用场景
当你经常把日志、配置文件或对话记录粘贴给智能体,并希望先剥离凭据时,值得添加。它适合需要可重复、离线脱敏步骤而非依赖模型猜测的场景,也适合只想了解出现了哪些密钥类型而不暴露其值的场景。
运行要求
作为本地进程通过 stdio 运行,从 PyPI 安装 mcp-secret-scrub(pip、pipx 或 uv)。未声明需要账户、API 密钥、环境变量或网络访问。可手动以端口参数启动可选的 HTTP 模式。
安装前请注意
它会处理你发送的任何文本,因此即使服务器只报告密钥类型、数量和位置,也应把输入视为敏感数据。掩码模式会显示匹配项的前四个和后两个字符,哈希模式输出确定性的无盐 SHA-256 前缀,结果可复现,可能被用于与已知值比对。脱敏基于模式匹配,可能漏掉不符合已知配置的密钥。

安装

在 SourceWeft 中

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

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

其他 MCP 客户端

参照 仓库 中的启动说明。

README

mcp-secret-scrub

mcp-name: io.github.sudo-ai-git/mcp-secret-scrub

Deterministic, no-LLM MCP server that scrubs secrets from text, logs, and transcripts before they enter agent context — and never leaks the value.

No LLM. No network. Pure structural detection. MIT. Crown-jewel-free.


The problem it solves

Before you hand raw text to an agent (or store it, or pass it to a tool), you often don't know whether it contains a live secret. Platform scrubbers miss patterns all the time — a private key, an nvapi- token, a github_pat_ token, an api_key= assignment mid-log. If that text reaches an LLM context or a persisted transcript, the secret is effectively exfiltrated.

This server answers, deterministically:

Which secrets are in this text, and can you redact them safely before it goes anywhere?

Detection coverage (deterministic profiles)

familyexamples
AI provider keyssk-proj-…, sk-ant-api…, sk-or-v1-…, sk-…, nvapi-…
Cloud / GitHubAKIA…, aws_secret_access_key=, ghp_…, gho_…, ghu_…, ghs_…, ghr_…, github_pat_…
Identity / authJWTs (eyJ…), PEM private keys, Bearer …, Basic …, OAuth client secrets
Assignmentsapi_key=, token=, secret=, password=, client_secret=, webhook_secret=
Endpoints / DSNsDiscord webhooks, Slack xox…, SQL/Redis/Mongo/AMQP connection strings

The scan never returns the secret value — only its type, count, and position. That is a hard safety contract, enforced by test.

Tools (MCP)

toolpurpose
scrub_text(text, mode, keep_label)redact / mask / hash secrets; returns scrubbed text (never the value)
scan_text(text)detect which secret types are present (no mutation)
report_full(text)scan + redact in one call, scrubbed preview + findings
secret_profiles()list all supported detection profiles

Modes:

  • redact (default) → [REDACTED:TYPE]
  • mask → shows first 4 + last 2 chars
  • hash → deterministic SHA-256 prefix (reproducible across calls)

Quick start (stdio)

bash
pip install mcp-secret-scrubmcp-secret-scrub          # stdio (default)

Or via uv/pipx for an installable console entry:

bash
pipx install mcp-secret-scrub

MCP client config:

json
{ "mcpServers": {    "secret-scrub": { "command": "mcp-secret-scrub" }}}

Streamable HTTP (remote / Smithery-publishable)

bash
python3 mcp_server.py --http --port 8138   # serves on http://<host>:8138/mcp/

Determinism & safety guarantees

  • Deterministic: same input → identical output in every mode, every call.
  • Never leaks: scan_text and scrub_text never emit the original token; _deterministic_hash is SHA-256 (no salt) so output is reproducible.
  • No LLM, no network: pure regex + reachable structure detection.
  • Input-safe: non-string input returns a clean error, not a traceback.

Verification

  • python3 test_detector.py — 14/14 core checks (detection, redaction, determinism, no-leak contract, benign/unicode/empty input, bad-mode)
  • python3 test_e2e.py — drives the real MCP stdio transport and asserts the secret does NOT cross the wire

License & provenance

MIT. Part of the sudo-ai-git deterministic no-LLM agent-trust MCP family (mcp-skill-sec · mcp-verify-claim · mcp-benchmark-hygiene · mcp-secret-scrub).

来源:README.md,提交 c5b3a04

工具

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

版本历史

1
  1. v1.0.0最新Sep 16, 2026

评分

已满足适用检查项的 50%

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

  • 近 30 天内可连通25 分

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

  • 已声明认证方式10 分

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

  • 已列出工具15 分

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

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