scan_text
Scan a text string or code snippet for exposed secrets and API keys
labelcontent必填entropy
io.github.GuardBee由 GitHub 账号 GuardBee 发布v1.1.1更新于 Nov 3, 2026
Scans files for leaked secrets and API keys
本地 MCP 服务器,可扫描文本、文件、目录、Git 历史和编码代理会话记录,查找泄露的密钥和 API Key。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
参照 仓库 中的启动说明。
🇬🇧 English | 🇹🇷 Türkçe | 🇨🇳 中文 | 🇯🇵 日本語 | 🇰🇷 한국어 | 🇧🇷 Português | 🇪🇸 Español | 🇩🇪 Deutsch
[npm version] [npm downloads] [License: MIT]
An MCP server that scans your source files, directories, and environment configs for exposed API keys, passwords, tokens, and other secrets. Ask Claude directly whether your project is leaking secrets.
Telemetry is off by default. With
GUARDBEE_TELEMETRY=1it sends the server, tool, success, duration and short parameter values such as a file path; longer strings and fields likecontent,tokenorpasswordare replaced with a placeholder. See@guardbee/mcp-telemetry.
@guardbee/guard-core, so @guardbee/mcp-security-proxy masks the same formats in tool results at runtime--history scans every line any commit added, so a key deleted from the files but still in the repository is found, reported once at the commit that added it (with author and date); --staged scans only what you are about to commit--write-baseline records today's findings as hashes (never the secrets, safe to commit); --baseline then reports only new ones, so an existing repo can adopt the scanner in CI without fixing everything first. SARIF results carry a stable partialFingerprints valueWEBHOOK_SIGNING_SECRET=… in .env, client_secret: in YAML, "internalApiKey" in JSON) is reported even when no provider rule knows its format. Randomness is measured as Shannon entropy (hex values need 32+ characters; values without digits need more bits, so a camel-case passphrase does not count); public/publishable, *_hash, *_id and *_url names, placeholders and ${VAR} references are left alone, and a value a provider rule already reported is not reported twice. Medium severity, low in test files; --no-entropy (or entropy: false in the MCP tools) turns it offscan --agent-history (MCP: scan_agent_history) scans what coding agents keep on your machine: Claude Code (~/.claude/projects, ~/.claude.json), Codex (~/.codex), Gemini CLI (~/.gemini/tmp) and Continue (~/.continue/sessions). A key pasted into a chat or printed by a command the agent ran stays there — and was already sent to the model provider, so rotate it. Each secret is reported once per agent with how often it appears; the entropy check is off here unless --entropy, since transcripts are full of code the agent read.jsonl, .ndjson, .ipynb and .log files over 1 MB (transcripts, notebooks with outputs, logs) are read line by line instead of being skipped--verify asks each provider whether a found key still works, through a read-only identity endpoint (GitHub /user, OpenAI /models, Slack auth.test, …): GitHub, GitLab, OpenAI, Anthropic, Slack, Stripe, Hugging Face, npm, SendGrid, Groq, OpenRouter and DigitalOcean. Each key goes only to its own provider, once, and never appears in the output; findings are marked live / invalid / unknown and live ones are listed first. --fail-on=live fails CI only for keys that still work. The MCP tools never verify, so an agent cannot send your secrets anywhere on its ownnode_modules, .git, dist, build, .next are skipped automaticallyAdd to claude_desktop_config.json:
You can ask Claude:
"Scan my project for secrets:
/Users/me/my-app"
"Are there any secrets in this
.envfile?"
"Is this text safe:
export API_KEY=sk-abc123..."
This tool partially redacts matched values in scan results (e.g. sk_live_abc1...xyz9). Full values are never logged or exported.
In addition to MCP server mode, this can also be used directly as a CLI:
Exit codes: 0 = no secrets found · 1 = secrets found · 2 = error
MIT — GuardBee
Questions, ideas, or a false positive? Start a thread in GitHub Discussions or open an issue. If GuardBee is useful to you, a ⭐ on the repository helps others find it.
来源:packages/secret-scanner/README.md,提交 bc5997d
Scan a text string or code snippet for exposed secrets and API keys
labelcontent必填entropyScan a single file for exposed secrets and API keys
path必填entropyRecursively scan a directory for exposed secrets and API keys. Automatically skips node_modules, .git, dist, and binary files.
path必填entropyexcludeincludebaselinemaxFilesScan a git repository for secrets in what git says was added: the staged changes (before a commit) or every commit's added lines (history). History finds secrets that were deleted from the files but are still in the repository.
mode必填path必填rangeentropybaselinemaxCommitsScan the transcripts coding agents keep on this machine (Claude Code, Codex, Gemini CLI, Continue) for secrets that were pasted into a chat or printed by a command. Such a secret was already sent to the model provider and should be rotated. Each secret is reported once with how often it appears.
entropyList all secret patterns that the scanner can detect
无需输入参数。
已满足适用检查项的 90%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
npm install -g @guardbee/mcp-secret-scanner{ "mcpServers": { "guardbee-secret-scanner": { "command": "npx", "args": ["-y", "@guardbee/mcp-secret-scanner"] } }}# Scan a project directorynpx @guardbee/mcp-secret-scanner scan ./my-project
# Scan a single filenpx @guardbee/mcp-secret-scanner scan .env
# Fail only on critical/highnpx @guardbee/mcp-secret-scanner scan . --fail-on=high
# JSON output (for CI reporting)npx @guardbee/mcp-secret-scanner scan . --format=json# Secrets pasted into Claude Code / Codex / Gemini CLI / Continue sessions on this machinenpx @guardbee/mcp-secret-scanner scan --agent-history# Which of the found keys still work? (sends each key to its own provider)npx @guardbee/mcp-secret-scanner scan . --history --verify --fail-on=live# Pre-commit: only the lines you are about to commitnpx @guardbee/mcp-secret-scanner scan --staged
# Every commit on every branch (finds keys deleted from the files)npx @guardbee/mcp-secret-scanner scan . --historynpx @guardbee/mcp-secret-scanner scan . --history=main..HEAD # just this branch
# Adopt an existing repo: record known findings once, then fail only on new onesnpx @guardbee/mcp-secret-scanner scan . --history --write-baseline=.guardbee-secrets-baseline.jsonnpx @guardbee/mcp-secret-scanner scan . --history --baseline=.guardbee-secrets-baseline.jsonname: Secret Scanon: [push, pull_request]
jobs: secret-scan: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 0 # full history for --history - name: Scan for exposed secrets run: npx @guardbee/mcp-secret-scanner scan . --history --baseline=.guardbee-secrets-baseline.json --fail-on=highsecret-scan: image: node:20 script: - npx @guardbee/mcp-secret-scanner scan . --fail-on=high only: - merge_requests - main# .git/hooks/pre-commitnpx @guardbee/mcp-secret-scanner scan --staged --fail-on=high || exit 1npm installnpm test # 71 unit testsnpm run build # TypeScript compile