MCP server that scans text/diffs for accidentally-committed secrets (API keys, tokens, private keys) so an agent can self-check its own changes before committing or opening a PR.
Single tool with strong naming (verb-first: scan_for_secrets), comprehensive description (450+ chars, covers WHAT/WHEN/WHY), and well-defined input schema with type, length constraints, and clear parameter description. Output schema documented in description with structured JSON format including riskLevel enum and findings array. Error handling guidance present. Main gaps: output schema not formally declared in tool registration (only in description text); no explicit error categorization or recovery guidance in code; no per-finding error details if scan fails.
Scan text (a git diff, a file's contents, a pasted snippet) for accidentally-committed secrets: cloud provider keys (AWS, Google), platform tokens (GitHub, Slack, npm), payment keys (Stripe), private key blocks, JWTs, and a generic entropy-gated check for anything assigned to a secret-sounding variable name. Use this before committing, opening a PR, or pasting logs/config anywhere -- a committed secret is one of the most common real-world causes of account and infrastructure compromise, and is easy to miss in a large diff. Findings are always redacted (first/last few characters only) -- this tool never returns a full secret value, so its own output is safe to log or display. Args: - text (string, 1-200000 chars): the text to scan. Returns: For JSON format: { "found": boolean, "riskLevel": "none" | "medium" | "high" | "critical", "findings": [ { "detector": string, "category": string, "severity": "low"|"medium"|"high"|"critical", "line": number, "column": number, "redacted": string } ] } Examples: - Use when: about to run "git commit" or "git push" -- scan the staged diff first - Use when: about to paste a config file, log excerpt, or error message into a chat or issue tracker - Don't use when: you need certainty nothing sensitive is present -- this is a fixed-pattern + heuristic scan, not exhaustive; a clean result means "no known pattern matched," not "definitely safe" Error Handling: - Returns an error if text is empty or exceeds 200000 characters.
Output schema not formally registered in tool definition, only documented in description text. LLMs cannot parse structured output format from prose; formal schema declaration enables downstream tool chaining and validation.
Error handling lacks categorization and recovery guidance. Code returns generic errors for empty/oversized input but does not guide LLM on retry strategy or alternative actions (e.g., 'text exceeds 200k chars, split into chunks and scan separately').
No tool annotations (readOnlyHint, idempotentHint) declared. scan_for_secrets is read-only and idempotent, explicit annotations help agents reason about safety and retry behavior.
Parameter description mentions 'git diff, file contents, pasted snippet' as examples but does not formally constrain input format. LLMs may pass binary data or non-text MIME types; add format constraint (e.g., 'UTF-8 text only').
| Scored | Grade | Overall | Spec posture | Rubric |
|---|---|---|---|---|
| 2026-09-23 | C | 64 | 2025-06-18+ | v2 |