Secretguard Mcp

io.github.vladimirbakalov由 GitHub 帳號 vladimirbakalov 發布v0.1.4更新於 Oct 24, 2026

Scans code for hardcoded secrets (AWS, Stripe, GitHub, JWTs) before an AI agent commits it.

已驗證STDIO僅桌面開發者工具安全與監控

概覽

AI 產生的概覽

本機 MCP 伺服器,掃描程式碼字串中的硬編碼密鑰並回傳去識別化結果,讓助理在寫入或提交前發現憑證。

可以做什麼
  • 掃描程式碼字串中的硬編碼密鑰:AWS、Stripe、GitHub、Google、Slack、Shopify、Telegram、OpenAI、Anthropic、npm、SendGrid、Twilio、Azure、Hugging Face、Notion、Postman、Linear、Pulumi 等廠商權杖,以及私鑰區塊、JWT 和內含密碼的資料庫連線字串。
  • 將指派給類密鑰變數名稱的高熵值標記為較低信賴度的通用發現。
  • 依檔名、行號、規則 ID、描述與信賴度回報每筆發現,並對密鑰值進行去識別化。
  • 掃描無發現時回傳「未偵測到密鑰」的簡單結果。
適用情境
適合 Claude Code、Cursor、Windsurf 等會產生或修改程式碼的 AI 編碼助理,在生成階段就檢查憑證,而不必等到 CI 或拉取請求審查。它只做一件事:在程式碼寫入磁碟或提交之前掃描程式碼字串。
執行需求
以 stdio 方式在本機執行,僅限桌面端。可透過 npx 從 GitHub 儲存庫安裝,或使用預先建置的 .mcpb 套件在 Claude Desktop 等相容 MCPB 的用戶端一鍵安裝。無需 API 金鑰、帳號或設定選項。
安裝前請注意
傳入的程式碼字串會交給本機伺服器程序掃描;該伺服器不進行任何網路呼叫,並在結果中對符合的值去識別化。通用信賴度的發現本身具有歧義,佔位符、雜湊與 UUID 都可能觸發熵偵測,應視為「值得再看一眼」而非已確認的密鑰。它只掃描收到的文字,無法取代對提交與拉取請求的 CI 掃描。

安裝

在 SourceWeft 中

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

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

其他 MCP 客戶端

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

README

secretguard-mcp

[CI] [Latest release] [License: MIT]

An MCP (Model Context Protocol) server that scans a code string for hardcoded secrets — AWS keys, Stripe keys, GitHub tokens, Google API keys and OAuth client secrets, Slack tokens and incoming webhook URLs, Shopify access tokens, Telegram bot tokens, DigitalOcean tokens, Hugging Face tokens, Notion API tokens, Mailchimp API keys, Postman API tokens, Linear API keys, Readme API keys, Clojars API tokens, Pulumi API tokens, OpenAI keys, Anthropic keys, npm access tokens, SendGrid keys, Twilio API keys, Azure Storage account keys, database connection strings with embedded passwords, private key blocks, JWTs, and generic high-entropy credentials — so an AI coding agent (Claude Code, Cursor, Windsurf, ...) can catch a secret before it writes the file or makes the commit, instead of finding out at CI/PR-review time. It exposes exactly one tool, scan_for_secrets, runs entirely locally over stdio, needs no API key, and never returns a raw secret value — every finding comes back redacted.

Why this exists

secret-scan-action already catches these secrets in CI, on every PR. That's necessary but late — by the time it runs, the secret has already been written, committed, and pushed. This project reuses that same detection engine (same rules, same entropy check, same redaction) but puts it in front of the agent as a tool call, so the check can happen at generation time, before the secret ever touches disk or history.

What it does

On a scan_for_secrets call:

  1. Splits the input code string into lines.
  2. Runs the same two-tier ruleset secret-scan-action uses:
    • Pattern rules (high confidence) — distinctive formats that are near-certain secrets when matched: AWS access key IDs (AKIA...) and contextual secret keys, Stripe live keys (sk_live_, rk_live_), GitHub tokens (ghp_, gho_, github_pat_, ...), Google API keys (AIza...), Google OAuth client secrets (GOCSPX-...), Slack tokens (xox[baprs]-...), Slack incoming webhook URLs (hooks.slack.com/services/...), Shopify access tokens (shpat_..., shpca_..., shpss_..., shppa_..., shpua_...), Telegram bot tokens (<bot_id>:A..., 35-char secret), DigitalOcean tokens (dop_v1_..., doo_v1_..., dor_v1_..., 64-char hex), Hugging Face tokens (hf_..., api_org_..., 34-char alpha), Notion API tokens (ntn_..., 11 digits + 35 alphanumeric), OpenAI keys (sk-..., sk-proj-..., sk-svcacct-...), Anthropic keys (sk-ant-...), npm access tokens (npm_...), SendGrid keys (SG....), Twilio API keys (SK...), Azure Storage account keys (contextual AccountKey=...), private key blocks (-----BEGIN ... PRIVATE KEY-----), and JWTs. One pattern rule — database connection strings with an embedded password (postgres://, mysql://, mongodb(+srv)://, redis(s)://, amqp(s)://) — is deliberately not near-certain even after excluding known placeholder passwords (user, password, changeit, ...) and ${...}-style env-var references, since a real value there could still be a low-stakes tutorial example rather than a live credential; it's returned at generic confidence, same as the entropy rule below. Another pattern rule — Mailchimp API keys (a 32-char hex value followed by a -usNN datacenter suffix) — is also generic confidence: it only fires when a mailchimp-prefixed variable/key name immediately precedes the value, but that keyword gate still doesn't rule out an unrelated hex value that happens to end in the same suffix shape. Postman API tokens (PMAK-..., 24-char hex + - + 34-char hex), Linear API keys (lin_api_..., 40-char alphanumeric), Readme API keys (rdme_..., 70-char lowercase alphanumeric), Clojars API tokens (CLOJARS_..., case-insensitive, 60-char alphanumeric), and Pulumi API tokens (pul-..., 40-char lowercase hex) are high confidence — a fixed prefix and exact length, same as the other provider-token rules.
    • Generic entropy rule — a value assigned to a variable named like secret, token, password/credential, or a *key compound commonly used for real secret material (apiKey, sessionKey, signingKey, clientKey, webhookKey, ...) whose value also has high Shannon entropy (looks random, not like a placeholder or an env-var reference). Deliberately does not match a bare *Key — that would also catch partitionKey, cacheKey, queryKey, and similar non-secret identifiers common in ordinary code.
  3. Returns every finding's filename, line, ruleId, description, confidence ("high" | "generic"), and a redacted line — the raw secret value never leaves the process. If nothing is found, it returns a plain "No secrets detected." result.

Example output

Calling scan_for_secrets with:

json
{  "code": "const key = \"AKIAIOSFODNN7EXAMPLE\";\nconst greeting = \"hello\";",  "filename": "src/config.ts"}

returns:

json
{  "findings": [    {      "filename": "src/config.ts",      "line": 1,      "ruleId": "aws-access-key-id",      "description": "AWS Access Key ID",      "confidence": "high",      "redactedLine": "const key = \"AKIA************MPLE\";"    }  ],  "summary": "Found 1 potential secret (1 high-confidence, 0 needs-review).\n\n- [high] src/config.ts:1 — AWS Access Key ID (aws-access-key-id)\n  const key = \"AKIA************MPLE\";"}

(The AWS key above is AWS's own public documentation placeholder, not a live credential.) A clean scan — e.g. { "code": "const greeting = \"hello world\";" } — returns { "findings": [], "summary": "No secrets detected." }.

Setup

Not yet published to the npm registry — install directly from GitHub via npx. npm install from a git source runs this package's prepare script automatically, which builds dist/ on the fly, so no separate build step is needed.

Claude Code

Add to your project's .mcp.json (or run claude mcp add):

json
{  "mcpServers": {    "secretguard": {      "command": "npx",      "args": ["-y", "github:vladimirbakalov/secretguard-mcp"]    }  }}

Claude Desktop

Add to claude_desktop_config.json:

json
{  "mcpServers": {    "secretguard": {      "command": "npx",      "args": ["-y", "github:vladimirbakalov/secretguard-mcp"]    }  }}

No API key, no account, no config options — restart Claude Code / Claude Desktop and scan_for_secrets is available. The tool description tells the agent to call it before writing code that could contain a credential, and again before a commit or PR — most of the time you won't need to ask for it explicitly.

Cursor / Windsurf

Both read the same command/args shape from their own MCP settings UI or config file — point them at npx -y github:vladimirbakalov/secretguard-mcp the same way.

Once this package is published to npm, the args above can drop to ["-y", "secretguard-mcp"] instead — that's a follow-up, not a blocker.

One-click install (.mcpb)

A prebuilt MCP Bundle is attached to the v0.1.4-mcpb release — download secretguard-mcp-0.1.4.mcpb and open it in Claude Desktop (or any other MCPB-compatible client) for a one-click local install, no npx/Node setup required on the client side. Rebuild it yourself with npm run package:mcpb (see scripts/build-mcpb.sh).

This same .mcpb release asset is what server.json at the repo root points at for the official MCP Registry — secretguard-mcp is published and listed there as io.github.vladimirbakalov/secretguard-mcp, so MCP clients that browse the official registry can discover and install it directly, in addition to the npx/.mcpb paths above. Publishing runs unattended in CI (.github/workflows/publish-mcp.yml) via mcp-publisher login github-oidc on every v*-mcpb tag push — no interactive login step.

Security notes

  • The raw secret value matched by a rule is held in memory only for the duration of a single scan_for_secrets call and is redacted (redactLine/redactSecret) before the tool result is built — it never appears in the returned content, structuredContent, or any log line.
  • The server does no network calls of any kind. It reads stdin, writes stdout (MCP stdio transport), and does nothing else.
  • Generic-tier findings are ambiguous by nature (config placeholders, hashes, and UUIDs can trip the entropy check) — that's expected. Treat confidence: "generic" as "worth a second look," not "confirmed."

Development

bash
npm installnpm run typecheck   # tsc --noEmitnpm test            # vitest runnpm run build       # tsc -p tsconfig.build.json -> dist/

dist/ is not committed — it's built from src/ via the prepare script, which runs both on a git-based npx/npm install and before any future npm publish.

Scope (v1)

One tool, one job: scan a code string, return redacted findings. No allowlist file, no AI triage step, no config options, no persistent state. If this needs any of that later, it'll get added once real usage shows it's needed — not before.

Relationship to secret-scan-action

secretguard-mcp and secret-scan-action share the same detection engine (rules.ts, redact.ts, and the core of scan.ts) but are independent, separately distributed packages: one is a GitHub Action that scans PR diffs in CI, the other is an MCP server that scans arbitrary code strings locally, before a commit exists. Fixing a false positive/negative in the ruleset means updating both.

License

MIT.

來源:README.md,提交 749c696

工具

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

版本歷史

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

評分

已滿足適用檢查項的 50%

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

  • 近 30 天內可連通25 分

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

  • 已宣告認證方式10 分

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

  • 已列出工具15 分

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

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