MCPeek
FreeNot checkedStatic AST-level security scanner for MCP server source code vulnerabilities.
About
Static AST-level security scanner for MCP server source code vulnerabilities.
README
npm version npm downloads License: MIT
Source-code security scanner for MCP (Model Context Protocol) server implementations.
Unlike config/runtime scanners, mcpeek reads your source code and detects vulnerabilities at the AST level — understanding MCP SDK patterns like server.tool() and server.setRequestHandler() and tracking taint from handler parameters to dangerous sinks.
Quick start
# Scan a GitHub repo
npx mcpeek scan https://github.com/org/your-mcp-server
# Scan a local directory
npx mcpeek scan ./my-mcp-server
# Run only specific rules
npx mcpeek scan ./my-server --rules command-injection,sql-injection
# CI mode (exit 1 on high+ severity findings)
npx mcpeek scan ./my-server --ci --fail-on high
# Output as SARIF (GitHub Code Scanning compatible)
npx mcpeek scan ./my-server --format sarif --output findings.sarif
Scan options
| Flag | Description |
|---|---|
-f, --format <format> |
Output format: markdown (default), json, or sarif |
-o, --output <file> |
Write output to a file instead of stdout |
--rules <list> |
Comma-separated rules to run (default: all) |
--registrations <names> |
Comma-separated custom tool-registration wrapper functions (e.g. registerMyTool) to treat like server.tool() |
--taint-context |
Treat the handler's second (context) parameter as attacker-controlled |
--include-tests |
Also scan example/test/demo files that are excluded by default |
--ci |
Exit with code 1 if findings at or above --fail-on severity are present |
--fail-on <severity> |
Minimum severity to trigger CI failure: critical / high / medium / low (default: high) |
Detection rules
| Rule | Severity | CWE | Description |
|---|---|---|---|
mcp-command-injection |
Critical | CWE-78 | Tool handler param flows to exec / spawn / execFile without sanitization |
mcp-code-injection |
Critical | CWE-94 | Tool handler param flows to eval, new Function, or vm.runIn* / vm.Script |
mcp-sql-injection |
Critical | CWE-89 | Tool handler param flows to raw DB query sinks (query, $queryRawUnsafe, execute, …) |
mcp-path-traversal |
High | CWE-22 | Tool handler param flows to fs operations without a boundary check |
mcp-ssrf |
High | CWE-918 | Tool handler param flows to fetch / axios / got without an allowlist |
mcp-tool-poisoning |
High | CWE-74 | Tool name/description contains prompt-injection keywords, hidden Unicode, ANSI escapes, or violates MCP naming rules |
mcp-missing-input-validation |
High | CWE-20 | Tool registered without a Zod schema |
mcp-hardcoded-credential |
High | CWE-798 | API key / token / secret hardcoded in source or committed .env files |
mcp-weak-input-validation |
Medium | CWE-20 | Schema uses z.any() / z.unknown() |
mcp-weak-schema-bounds |
Medium | CWE-20 | Zod schema accepts user input without size, range, or pattern bounds |
Each finding includes a taintChain showing how user input reaches the sink — e.g. cmd (handler param) → command (line 3) → execSync() (line 5).
Batch audit
# Scan all servers in a targets file
npx mcpeek audit --targets targets/top-30.json --output results/
The bundled targets/top-30.json lists verified TypeScript MCP servers and is what we use for the project's own corpus runs.
Output formats
--format markdown (default), json, or sarif. SARIF 2.1.0 output includes codeFlows derived from the taint chain, so findings render in GitHub Code Scanning with the full path from parameter to sink.
Install
npm install -g mcpeek
# or one-shot
npx mcpeek scan <target>
Use in CI
Run MCPeek directly with npx in any GitHub Actions workflow:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
- run: npx mcpeek scan . --ci --fail-on high
To upload findings to GitHub Code Scanning, emit SARIF and hand it to upload-sarif (the job needs security-events: write):
permissions:
contents: read
actions: read
security-events: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
- run: npx mcpeek scan . --format sarif --output mcpeek.sarif
- uses: github/codeql-action/upload-sarif@v3
if: always()
with:
sarif_file: mcpeek.sarif
License
MIT
Install MCPeek in Claude Desktop, Claude Code & Cursor
unyly install mcpeekInstalls into Claude Desktop, Claude Code, Cursor & VS Code — handles npx, uvx and build-from-source repos for you.
First time? Get the CLI: curl -fsSL https://unyly.org/install | sh
Or configure manually
Run in your terminal:
claude mcp add mcpeek -- npx -y mcpeekStep-by-step: how to install MCPeek
FAQ
Is MCPeek MCP free?
Yes, MCPeek MCP is free — one-click install via Unyly at no cost.
Does MCPeek need an API key?
No, MCPeek runs without API keys or environment variables.
Is MCPeek hosted or self-hosted?
Self-hosted: the server runs locally on your machine via the install command above.
How do I install MCPeek in Claude Desktop, Claude Code or Cursor?
Open MCPeek 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 mcpdotdirectCompare MCPeek with
Not sure what to pick?
Find your stack in 60 seconds
Author?
Embed badge for your README
Browse similar
All development MCPs
