mcp-secrets-guard
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-secrets-guard scan my .env file for any hard-coded secrets"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mcp-secrets-guard
An MCP server that lets AI assistants check your project for exposed secrets without the secret values ever entering the model's context.
Instead of letting an assistant cat .env (and leak your keys into a chat log), the assistant calls a tool. The tool reads the file locally and returns only a sanitized report:
.env: Found 3 potential secrets: 1 AWS access key ID, 1 Stripe live secret key, 1 High-entropy secret value.
- line 2: AWS access key ID [high] (variable AWS_ACCESS_KEY_ID)
- line 3: Stripe live secret key [high] (variable STRIPE_SECRET_KEY)
- line 4: High-entropy secret value [medium] (variable SESSION_SECRET)
! This env file does not appear to be covered by .gitignore.
Secret values are never included in this report.No value, prefix, suffix or masked fragment is ever returned. The test suite asserts this against the real MCP protocol.
Install
Claude Desktop — add to claude_desktop_config.json:
{
"mcpServers": {
"secrets-guard": {
"command": "npx",
"args": ["-y", "mcp-secrets-guard"],
"env": { "MCP_SECRETS_GUARD_ROOT": "/absolute/path/to/your/project" }
}
}
}Claude Code:
claude mcp add secrets-guard -- npx -y mcp-secrets-guard(Claude Code launches servers in your project directory, so the root defaults to it.)
Related MCP server: trestle
Tools
Tool | What it does |
| Scans one env file (default |
| Recursively scans the project (skips |
What it detects
Anthropic, OpenAI, AWS access key IDs, Stripe (live/test/webhook), GitHub (classic and fine-grained), Slack tokens and webhooks, Google API keys, SendGrid, Twilio, npm tokens, private key blocks, JWTs, passwords in connection strings (postgres://user:pass@host), plus a generic entropy check for values under names like *_SECRET, *_TOKEN, *PASSWORD*, *API_KEY*. Placeholders (your_key_here, ${VAR}, changeme, <...>) are ignored.
This is a fast heuristic scanner, not a replacement for tools like gitleaks or trufflehog in CI. Expect some false negatives (and the occasional false positive).
Safety model
Read-only. Nothing is written, deleted or sent anywhere. No network access.
Root-confined. Paths are resolved (including symlinks) and must stay inside the project root (
MCP_SECRETS_GUARD_ROOT, default: current directory).../and symlink escapes are refused.Errors never echo file contents.
One dependency: the official
@modelcontextprotocol/sdk.
A note on trust: this protects the secret values from the model. It cannot stop an assistant that also has a general file-read tool from reading .env anyway. Pair it with your client's permission rules (e.g. deny reads of .env*) so the guarded tool is the only path.
CLI
npx mcp-secrets-guard --scan # scan the project, exit code 1 if anything is found
npx mcp-secrets-guard --scan .envHandy as a pre-commit hook or CI step.
Develop
npm install
npm testLicense
MIT
Available Tools
2 toolscheck_env_for_secretsARead-only
Check a local env file (default: .env) for exposed secrets such as API keys, tokens, private keys and passwords. Returns only a sanitized report (line numbers, secret types, variable names). Secret values are NEVER returned, so it is safe to call. Do not try to read the env file directly.
Inputs: path.
scan_project_for_secretsARead-only
Recursively scan the project (skipping node_modules, .git, build output and binaries) for hard-coded secrets and env files that may be committed. Returns only file paths, line numbers and secret types. Secret values are NEVER returned.
Inputs: path, max_files.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 2 tools
The two tools are differentiated by scope: check_env_for_secrets targets a single env file while scan_project_for_secrets recursively scans the whole project. However, the recursive scan likely also covers env files, creating partial overlap that an agent must reason about from the descriptions rather than from distinct purposes.
Both tools follow a clear, consistent verb_noun_for_secrets pattern (check_env_for_secrets, scan_project_for_secrets) with matching suffix semantics. The verb difference (check vs scan) also maps sensibly to single-file vs recursive scope.
Two tools is thin for a scanner/guard server; it sits at the borderline where the surface feels minimal. The split is defensible (file-level vs project-level), but there is little room for configuration, baselines, or reporting tools.
Detection coverage is reasonable for the domain, but the lifecycle is incomplete: there is no way to configure ignore rules/custom patterns, manage an allowlist or baseline, export reports, or receive remediation guidance. These are notable gaps for a 'guard' toolset, though agents can still perform the core detection workflow.
Maintenance
Related MCP Connectors
Checks AI-written code for leaked keys and made-up packages, on your machine. Never uploads code.
Scan configs, files, or text for leaked secrets and obvious misconfigurations. Nothing stored.
Secrets for developers and agents—secure context and workflows without exposing secret values.
Security scanner for AI agents: prompt injection, leaked secrets, PII, and SSRF-risk URL detection.
Related MCP Servers
- AlicenseAqualityCmaintenanceEnables AI assistants to scan multiple services and local filesystems for leaked secrets using n0s1 secret-scanning capabilities.1338 PyPIGPL 3.0
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to scan source code for secrets like API keys and passwords locally without network requests.2Apache 2.0
- AlicenseAqualityBmaintenanceEnables AI assistants to audit and clean development workspaces safely by detecting reclaimable artifacts, exposed .env files, and potential secret leaks.6MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to scan and audit environment files for leaked secrets, sanitize them, encrypt/decrypt vaults, and run processes with zero-disk secret injection.MIT