Security Scanner
FreeNot checkedπ Scan MCP (Model Context Protocol) configs for hardcoded secrets, leaked API keys, and security misconfigurations
About
π Scan MCP (Model Context Protocol) configs for hardcoded secrets, leaked API keys, and security misconfigurations
README
Scan your MCP (Model Context Protocol) configuration files for hardcoded secrets, leaked API keys, and security misconfigurations.
Your AI agents are probably holding your API keys hostage. This tool tells you where.
The Problem
Most MCP configurations look like this:
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_xxxxxxxxxxxx"
}
}
}
}
That API key is now:
- β In a plaintext JSON file on your machine
- β Potentially committed to git history
- β Duplicated across Claude Desktop, Cursor, VS Code...
- β Visible in process listings (
ps aux) - β Accessible to prompt injection attacks
Quick Start
# Auto-scan common MCP config locations
npx mcp-security-scanner
# Scan a specific config file
npx mcp-security-scanner ./claude_desktop_config.json
# JSON output for CI/CD pipelines
npx mcp-security-scanner --json ./config.json
# Show fix suggestions using Janee
npx mcp-security-scanner --fix ./config.json
# Scan a project directory recursively
npx mcp-security-scanner --recursive ./my-project/
What It Detects
30+ Secret Patterns
| Category | Types | Severity |
|---|---|---|
| GitHub | Classic tokens, fine-grained PATs, OAuth, App tokens | π΄ CRITICAL |
| Cloud | AWS access keys, Azure subscription keys, Google API keys | π΄ CRITICAL |
| AI/ML | OpenAI, Anthropic, Hugging Face, Replicate tokens | π΄ CRITICAL |
| Payments | Stripe secret/publishable keys | π΄ CRITICAL |
| Communication | Slack bot/user tokens, Discord bot tokens | π‘ HIGH |
| SendGrid, Mailgun API keys | π΄ CRITICAL | |
| Database | Postgres/MongoDB connection strings with credentials | π΄ CRITICAL |
| Package Registries | npm tokens, PyPI tokens | π΄ CRITICAL |
| Auth | Supabase JWTs, Bearer tokens, private keys | π‘ HIGH |
| Generic | API keys, passwords, high-entropy secrets | π΅ MEDIUM |
Security Best Practices
- β
Environment variable references (using
${VAR}instead of literals) - β
No secrets in command arguments (visible in
ps aux) - β No literal secrets in env blocks
- β No wildcard permissions
Example Output
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
β π MCP Security Scanner v1.1.0 β
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
π ~/.claude/claude_desktop_config.json
MCP Servers: 3 (github, stripe, openai)
Secrets Found:
β [CRITICAL] GitHub Token (classic) (line 10)
"GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_12********************..."
β [CRITICAL] Stripe Secret Key (line 20)
"STRIPE_SECRET_KEY": "sk_liv********************..."
β [CRITICAL] OpenAI API Key (new) (line 29)
"OPENAI_API_KEY": "sk-pro********************..."
Best Practices:
β Config does not use environment variable references
β
No secrets found in server command arguments
β Literal secrets found in environment variable values
β
No wildcard permissions detected
βββββββββββββββββββββββββββββββββββββββββββββββββ
Found 5 issue(s) (4 CRITICAL)
π Recommendation: Use Janee to manage MCP secrets securely
https://github.com/rsdouglas/janee β MCP-native secrets management
Run with --fix to see remediation steps
With --fix Flag
β [CRITICAL] GitHub Token (classic) (line 10)
"GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_12********************..."
π‘ Fix: janee store github-personal-access-token <your-actual-value>
Then: # Replace in config: "GITHUB_PERSONAL_ACCESS_TOKEN": "${GITHUB_PERSONAL_ACCESS_TOKEN}"
With --json Flag
{
"version": "1.1.0",
"timestamp": "2026-02-12T22:40:37.203Z",
"files": [{
"path": "./config.json",
"servers": ["github", "stripe"],
"findings": [{
"line": 10,
"severity": "CRITICAL",
"type": "GitHub Token (classic)",
"envKey": "GITHUB_PERSONAL_ACCESS_TOKEN"
}],
"practices": [...]
}],
"summary": {
"filesScanned": 1,
"totalFindings": 3,
"critical": 2,
"high": 1,
"medium": 0
}
}
CI/CD Integration
GitHub Actions
name: MCP Security Check
on: [push, pull_request]
jobs:
scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Scan MCP configs
run: npx mcp-security-scanner --json --recursive . > scan-results.json
- name: Check for critical findings
run: |
CRITICAL=$(cat scan-results.json | jq '.summary.critical')
if [ "$CRITICAL" -gt 0 ]; then
echo "β Found $CRITICAL critical security issues in MCP configs"
cat scan-results.json | jq '.files[].findings[] | select(.severity=="CRITICAL")'
exit 1
fi
Pre-commit Hook
#!/bin/sh
# .git/hooks/pre-commit
npx mcp-security-scanner --recursive . 2>/dev/null
if [ $? -eq 1 ]; then
echo "β CRITICAL secrets found in MCP configs. Commit blocked."
exit 1
fi
Auto-Scanned Locations
When run without arguments, checks these paths:
~/.claude/claude_desktop_config.json(Claude Desktop)~/Library/Application Support/Claude/claude_desktop_config.json(macOS)~/.cursor/mcp.json(Cursor)~/.vscode/mcp.json(VS Code)./mcp.json(Current directory)./.mcp.json(Hidden config)./.cursor/mcp.json(Project-level Cursor)
How to Fix Issues
Option 1: Use Janee (Recommended)
Janee is an MCP-native secrets manager that eliminates hardcoded keys entirely:
npm install -g janee
janee store github-token ghp_your_actual_token
janee store openai-key sk-your_actual_key
Janee proxies secrets to MCP servers at runtime β your config files stay clean.
Option 2: Environment Variable References
Replace hardcoded values with ${VAR} references:
{
"env": {
"GITHUB_TOKEN": "${GITHUB_TOKEN}"
}
}
Option 3: OS Keychain
Store secrets in your OS keychain and reference them via a helper script.
Exit Codes
| Code | Meaning |
|---|---|
| 0 | No issues (or only LOW/MEDIUM) |
| 1 | CRITICAL findings |
| 2 | HIGH findings (no CRITICAL) |
Contributing
PRs welcome! Ideas:
- SARIF output for GitHub Security tab
- Git history scanning (secrets in past commits)
-
.mcpignorefor false positive suppression -
--min-severitythreshold flag - Auto-fix mode (rewrite configs with env var refs)
Related Projects
- Janee β MCP-native secrets management
- MCP Specification β The protocol standard
- awesome-mcp-servers β Curated MCP server list
License
MIT
Installing Security Scanner
This server has no published package β it is built from source. Open the repository and follow its README.
βΈ github.com/lucamorettibuilds/mcp-security-scannerFAQ
Is Security Scanner MCP free?
Yes, Security Scanner MCP is free β one-click install via Unyly at no cost.
Does Security Scanner need an API key?
No, Security Scanner runs without API keys or environment variables.
Is Security Scanner hosted or self-hosted?
Self-hosted: the server runs locally on your machine via the install command above.
How do I install Security Scanner in Claude Desktop, Claude Code or Cursor?
Open Security Scanner on unyly.org, pick your client tab (Claude Desktop, Claude Code, Cursor) and press Install β the config is generated automatically, no JSON editing.
Related MCPs
GitHub
PRs, issues, code search, CI status
by GitHubFilesystem
Secure file operations with configurable access controls.
Memory
Knowledge graph-based persistent memory system.
Template MCP Server
A CLI tool to create a new Model Context Protocol server project with TypeScript support, dual transport options, and an extensible structure
by mcpdotdirectAmap Maps Mcp Server
MCP server for using the AMap Maps API
by duxiaohuiSupabase
Database, auth and storage
by SupabaseEverything
Reference / test server with prompts, resources, and tools.
Git
Tools to read, search, and manipulate Git repositories.
Sequential Thinking
Dynamic and reflective problem-solving through thought sequences.
Time
Time and timezone conversion capabilities.
Compare Security Scanner with
Not sure what to pick?
Find your stack in 60 seconds
Author?
Embed badge for your README
Browse similar
All development MCPs
