env-secret-exposure-analyzer-mcp
Identifies exposed Datadog API keys in project files to prevent accidental leakage.
Scans for unprotected .env files and checks gitignore coverage to prevent accidental exposure of environment variables.
Detects exposed GitHub tokens (e.g., ghp_, gho_, ghs_) in source files and environment files to prevent accidental leakage.
Identifies exposed Google API keys and OAuth client secrets in project files to prevent accidental leakage.
Detects exposed OpenAI API keys in source files and environment files to prevent accidental leakage.
Identifies exposed SendGrid API keys (SG.xxx) in project files to prevent accidental leakage.
Detects exposed Sentry DSNs in source files and environment files to prevent accidental leakage.
Identifies exposed Slack tokens (xox*) in project files to prevent accidental leakage.
Detects exposed Stripe secret/publishable keys and webhook secrets in source files and environment files to prevent accidental leakage.
Identifies exposed Twilio auth tokens and account SIDs in project files to prevent accidental leakage.
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., "@env-secret-exposure-analyzer-mcp scan this project for secret exposure risks"
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.
π env-secret-exposure-analyzer-mcp
Your AI agent is one debug session away from leaking your secrets.
MCP server that scans your project for secret exposure risks β hardcoded API keys, unprotected .env files, and console.log calls that print credentials at runtime. Before your agent accidentally reads them out loud.
π€ The problem
You ask your AI agent to debug a config issue. It reads src/config.ts. Inside:
console.log('Config loaded:', JSON.stringify(config));
console.log(process.env.DATABASE_PASSWORD);The agent now has your database password in its context. It might log it, include it in a summary, or pass it to another tool. And your .env isn't in .gitignore, so the next git push will do the rest.
None of this requires the agent to be malicious. It just needs to be helpful.
env-secret-exposure-analyzer-mcp catches this before it happens. π
Related MCP server: GuardX
π οΈ Tools
scan_for_secrets
Scans source files, config files, and .env files for 20+ secret patterns. Returns file path, line number, severity, and a masked preview β never the full value.
Detects:
AWS access keys + secret keys
GitHub tokens (
ghp_,gho_,ghs_)Stripe secret/publishable keys + webhook secrets (
whsec_)Anthropic, OpenAI API keys
SendGrid (
SG.xxx), Twilio auth token + account SIDGoogle API keys + OAuth client secrets (
GOCSPX-)Slack tokens (
xox*)Private keys (
-----BEGIN ... PRIVATE KEY-----)Database URLs with embedded credentials (
postgres://user:pass@host)JWT secrets, session secrets, encryption keys
Sentry DSN, Datadog API key
Generic hardcoded passwords, secrets, tokens
Secret Scan Results
Project: /project
Files scanned: 24
Findings: 5
[CRITICAL] .env:3 β AWS Access Key
Preview: AKIA****MPLE
[CRITICAL] .env:7 β Database URL with password
Preview: post****sswd
[CRITICAL] src/auth.ts:12 β Hardcoded JWT secret
Preview: my-s****ecret
[HIGH] .env:14 β Hardcoded session secret
Preview: sess****key!
[MEDIUM] .env:28 β Sentry DSN
Preview: http****7890check_gitignore_coverage
Checks whether sensitive files (.env, .env.local, secrets.json, private keys, certificates) are covered by .gitignore. Flags files that could be accidentally committed.
Gitignore Coverage Check
Project: /project
β .env β Add to .gitignore: .env
β .env.local β Add to .gitignore: .env.local
β secrets.jsonscan_for_log_leaks
Scans source files for console.log / logger calls that print process.env variables or objects with secret-sounding names at runtime. Catches the most common "it's just a debug line" mistakes.
Log Leak Scan
Project: /project
Files scanned: 18
Findings: 3
[CRITICAL] src/config.ts:8
console.log("Config loaded:", JSON.stringify(config));
[HIGH] src/server.ts:42
console.log(process.env.AWS_SECRET_ACCESS_KEY);
[HIGH] src/db.ts:15
logger.info({ password: dbConfig.password });π§ͺ What it looks like in practice
A realistic .env with 20 secrets β database URLs, AWS, Stripe, Twilio, SendGrid, Google OAuth, Sentry, JWT secrets, encryption keys. Before this MCP: an AI agent reads the file, has no idea what's sensitive, and proceeds to use those values in generated code or responses.
After one scan_for_secrets call: 16 findings, all categorized by severity, all previews masked. The agent knows exactly what's dangerous before it touches anything.
β‘ Setup
{
"mcpServers": {
"secret-scanner": {
"command": "npx",
"args": ["-y", "env-secret-exposure-analyzer-mcp"]
}
}
}π Usage
"Scan this project for any secrets or API keys that might be exposed. Check if .env files are in .gitignore, and look for any console.log calls that might be leaking credentials."
The agent runs all three tools in sequence and reports a full picture: what's hardcoded, what's not protected, what's being logged.
Works great alongside:
tsconfig-inheritance-flattener-mcp β for TypeScript config analysis
release-readiness-triage-mcp β for CI triage before release
ast-impact-mapper-mcp β for codeβtest correlation
π¦ Links
License
MIT
Available Tools
5 toolscheck_gitignore_coverageA
Check whether sensitive files (.env, .env.local, secrets.json, etc.) are properly covered by .gitignore rules. Flags files that contain secrets but could be accidentally committed.
Inputs: projectPath (required).
scan_ci_workflowsA
Scans GitHub Actions (.github/workflows/.yml), CircleCI (.circleci/config.yml), and GitLab CI (.gitlab-ci.yml) workflow files for dangerous secret interpolation patterns. Detects ${{ secrets. }} and ${{ github.token }} used directly in run: steps (log_leak risk β GitHub Actions logs the expanded plaintext) and ${{ github.event.pull_request.* }} / issue / commit content interpolated in shell commands (injection risk β attacker-controlled input). Returns file, job, step, pattern_found, risk, and recommendation.
Inputs: repo_path (required).
scan_for_log_leaksA
Scan source files for console.log / logger calls that may print environment variables or secrets at runtime. Catches patterns like console.log(process.env.SECRET) or logger.info({ apiKey }) before they reach production logs.
Inputs: projectPath (required).
scan_for_secretsA
Scan a project directory for hardcoded secrets, API keys, tokens, and passwords. Detects patterns like AWS keys, GitHub tokens, Stripe keys, private keys, and generic high-entropy strings. Returns file path, line number, severity, and a masked preview.
Inputs: projectPath (required), extensions.
scan_git_historyA
Scan the git commit history of a repository for secrets that were ever committed, even if later deleted. Detects hardcoded API keys, tokens, passwords, and other credentials added in diff hunks across recent commits. Returns each finding with its commit hash, file, line, severity, a masked preview, entropy score, whether the secret is still present in the working tree, and whether rotation is required. Respects .gitleaksignore.
Inputs: repo_path (required), since_days, last_n_commits.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
TDQS
Scored across 5 tools
Each tool targets a distinctly different aspect of secret exposure: hardcoded secrets in files, .gitignore coverage, log statement leaks, CI workflow risky patterns, and git history. There is no overlap or ambiguity between them.
The verbs are mostly consistent (scan_for_* vs scan_* vs check_*), with scan_ as a common prefix. The inconsistent use of 'for' and the odd one out 'check_' create minor deviation, but the pattern is still recognizable.
Five tools is well-scoped for a secret exposure analyzer. Each tool covers a relevant and non-redundant aspect, and the number is appropriate for the domain.
The set covers the primary surface areas for secret exposure: current source code, gitignore protection, runtime log leakage, CI workflow secret handling, and historical git leaks. This provides comprehensive coverage for the stated purpose.
Maintenance
Related MCP Connectors
Checks AI-written code for leaked keys and made-up packages, on your machine. Never uploads code.
Deep security scans of repos you own from your editor: dependency CVEs, SAST, git-history secrets.
Scan configs, files, or text for leaked secrets and obvious misconfigurations. Nothing stored.
Code security scanner for founders and small teams: leaked secrets, missing RLS, injection, CVEs
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceScans code for exposed secrets, API keys, tokens, and credentials across 69 patterns covering cloud services, AI platforms, payment providers, authentication services, and databases.MIT
- AlicenseNot gradedqualityBmaintenanceA keyless, defensive code-security auditor that scans codebases for hardcoded secrets, audits dependencies for known CVEs, and checks passwords against breach data using k-anonymity.1MIT
- AlicenseNot gradedqualityDmaintenanceLocal-first security check for AI coding agents β finds hardcoded secrets, exposed .env files, git-history leaks and vulnerable dependencies (OSV), entirely on your machine. Ask your agent "is this safe to ship?" and get a Launch Readiness score with a fix for every finding.MIT
- AlicenseNot gradedqualityDmaintenanceDetects leaked credentials in source code with tools to scan text, files, and directories for API keys, tokens, and private keys across 30+ providers.1MIT