Env Secret Exposure Analyzer Mcp

io.github.vola-trebla由 GitHub 账号 vola-trebla 发布v0.2.0更新于 Oct 24, 2026

Scans projects for secret exposure: leaked API keys, unprotected .env files, and secrets in logs.

已验证STDIO仅桌面开发者工具安全与监控

概览

AI 生成的概览

本地 MCP 服务器,扫描项目中的密钥泄露风险:硬编码 API 密钥、未受保护的 .env 文件以及会打印凭据的日志调用,结果仅显示掩码预览。

可以做什么
  • 扫描源码、配置和 .env 文件中的 20 多种密钥模式(云服务、支付、聊天、AI 服务商密钥、私钥、含凭据的数据库 URL),返回路径、行号、严重级别和掩码预览
  • 检查 .env、secrets.json、私钥和证书等敏感文件是否被 .gitignore 覆盖
  • 扫描源码中打印环境变量或名称含密钥字样的对象的 console.log 或 logger 调用
  • 按严重级别汇总发现项,便于助手在改动代码前说明暴露风险
适用场景
适合在助手于代码库中工作、可能读取配置或环境文件时使用,先做一次检查,了解哪些内容被硬编码、未被忽略或被打印,避免密钥进入模型上下文或被提交。
运行要求
通过 stdio 在本地运行,使用 npx 启动 npm 包 env-secret-exposure-analyzer-mcp,需要 Node.js,首次安装需要网络访问。未声明认证、环境变量或请求头。仅支持桌面端。
安装前请注意
它会读取本机项目文件,包括 .env 和配置文件;结果以掩码预览而非完整值返回给助手。它只报告发现项,不会修改文件或 .gitignore。注意所扫描的目录范围,因为扫描会把该目录的文件内容交给该工具。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Env Secret Exposure Analyzer Mcp,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

🔐 env-secret-exposure-analyzer-mcp

[npm] [CI] [License: MIT]

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:

typescript
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. 🔐


🛠️ 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 SID
  • Google 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****7890

check_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.json

scan_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

json
{  "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:


📦 Links

License

MIT

来源:README.md,提交 5c1970f

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.2.0最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分