Scan code for leaked secrets (AWS keys, GitHub tokens, Stripe keys, RSA private keys) via @mukundakatta/secretsniff-mcp (npx)
Common agent task: after writing or editing a config file, .env, or source module, scan it for hardcoded credentials before committing. secretsniff-mcp provides two tools — scan_text (inline string) and scan_file (read from disk) — that detect AWSACCESSKEY, GITHUBTOKEN, STRIPEKEY, SLACKTOKEN, RSAPRIVATEKEY, GENERICAPI_KEY, and high-entropy strings. Each finding includes kind, line, column, byte offsets, matched substring, and Shannon entropy.
Recipe: Scan code for leaked secrets via secretsniff-mcp
Server: @mukundakatta/secretsniff-mcp v0.1.0 Launch: npx -y @mukundakatta/secretsniff-mcp (stdio) Tools: scan_text (inline string), scan_file (read from disk path) Auth: none required
What it detects
AWS_ACCESS_KEY— AKIA… patternGITHUB_TOKEN— ghp… / githubpat_… patternsSTRIPE_KEY— sklive… / sktest… patternsSLACK_TOKEN— xoxb-… / xoxp-… patternsRSA_PRIVATE_KEY— BEGIN RSA PRIVATE KEY headerGENERIC_API_KEY— apiKey/api_key assignment patternsHIGH_ENTROPY— any 32+ char string above 4.5 bits/char Shannon entropy
scan_text — inline string scan
// Request
{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{
"name":"scan_text",
"arguments":{
"text":"const config = {\n apiKey: \"AKIAIOSFODNN7EXAMPLE\",\n ghToken: \"ghp_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghij\",\n stripeKey: \"sk_live_abcdefghijklmnopqrstuvwx\",\n slackWebhook: \"xoxb-1234567890-1234567890123-AbCdEfGhIjKlMnOpQrStUvWx\"\n};"
}
}}
// Response — 5 findings, each with kind, line, column, entropy
{
"count": 5,
"findings": [
{"kind":"GENERIC_API_KEY","line":2,"column":3,"matched":"apiKey: \"AKIAIOSFODNN7EXAMPLE\"","entropy":4.35},
{"kind":"AWS_ACCESS_KEY","line":2,"column":12,"matched":"AKIAIOSFODNN7EXAMPLE","entropy":3.68},
{"kind":"GITHUB_TOKEN","line":3,"column":13,"matched":"ghp_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghij","entropy":5.22},
{"kind":"STRIPE_KEY","line":4,"column":15,"matched":"sk_live_abcdefghijklmnopqrstuvwx","entropy":4.56},
{"kind":"SLACK_TOKEN","line":5,"column":18,"matched":"xoxb-1234567890-1234567890123-AbCdEfGhIjKlMnOpQrStUvWx","entropy":5.02}
]
}scan_file — scan a file on disk
// Request
{"jsonrpc":"2.0","id":4,"method":"tools/call","params":{
"name":"scan_file",
"arguments":{"path":"/tmp/test_config.js"}
}}
// Response — finds AWS secret (high entropy), GitHub PAT, and RSA key header
{
"path": "/tmp/test_config.js",
"count": 3,
"findings": [
{"kind":"HIGH_ENTROPY","line":6,"column":18,"matched":"wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY","entropy":4.66},
{"kind":"HIGH_ENTROPY","line":7,"column":15,"matched":"github_pat_11ABCDEF_abcdefghijklmnop...","entropy":5.87},
{"kind":"RSA_PRIVATE_KEY","line":8,"column":16,"matched":"-----BEGIN RSA PRIVATE KEY-----","entropy":3.38}
]
}Agent integration pattern
After writing or editing any config, .env, or source file, call scan_file on it. If count > 0, replace the hardcoded secrets with env-var references before committing. The entropy score helps triage — pattern-matched kinds (AWSACCESSKEY, STRIPEKEY) are high confidence; HIGHENTROPY findings may be false positives on hashes or encoded data.
Optional params
min_entropy(default 4.5) — Shannon entropy threshold for high-entropy fallbackmin_entropy_length(default 32) — minimum string length for entropy ruleinclude_high_entropy(default true) — set false to skip entropy-based detection entirely
{ "server": "@mukundakatta/secretsniff-mcp", "version": "0.1.0", "transport": "stdio", "launcher": "npx -y @mukundakatta/secretsniff-mcp", "tools": ["scan_text", "scan_file"], "handshake": { "initialize": { "protocolVersion": "2024-11-05", "capabilities": { "tools": {} }, "serverInfo": { "name": "secretsniff", "version": "0.1.0" } }, "tools_list": [ { "name": "scan_text", "inputSchema": { "required": ["text"], "properties": { "text": { "type": "string" }, "min_entropy": { "type": "number", "default": 4.5 }, "min_entropy_length": { "type": "integer", "default": 32 }, "include_high_entropy": { "type": "boolean", "default": true } } } }, { "name": "scan_file", "inputSchema": { "required": ["path"], "properties": { "path": { "type": "string" }, "min_entropy": { "type": "number", "default": 4.5 }, "min_entropy_length": { "type": "integer", "default": 32 }, "include_high_entropy": { "type": "boolean", "default": true } } } } ] }, "trace_scan_text": { "request": { "name": "scan_text", "arguments": { "text": "const config = { apiKey: "AKIAIOSFODNN7EXAMPLE", ghToken: "ghp_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghij", stripeKey: "sk_live_abcdefghijklmnopqrstuvwx", slackWebhook: "xoxb-1234567890-1234567890123-AbCdEfGhIjKlMnOpQrStUvWx" };" } }, "response": { "count": 5, "findings": [ { "kind": "GENERIC_API_KEY", "line": 2, "column": 3, "entropy": 4.348 }, { "kind": "AWS_ACCESS_KEY", "line": 2, "column": 12, "entropy": 3.684 }, { "kind": "GITHUB_TOKEN", "line": 4, "column": 13, "entropy": 5.222 }, { "kind": "STRIPE_KEY", "line": 5, "column": 15, "entropy": 4.563 }, { "kind": "SLACK_TOKEN", "line": 6, "column": 18, "entropy": 5.018 } ] }, "success": true }, "trace_scan_file": { "request": { "name": "scan_file", "arguments": { "path": "/tmp/test_config.js" } }, "response": { "path": "/tmp/test_config.js", "count": 3, "findings": [ { "kind": "HIGH_ENTROPY", "line": 6, "entropy": 4.663 }, { "kind": "HIGH_ENTROPY", "line": 7, "entropy": 5.867 }, { "kind": "RSA_PRIVATE_KEY", "line": 8, "entropy": 3.382 } ] }, "success": true } }