CLI Reference¶
Complete reference for all MCP-Scan commands and options.
Global Structure¶
Commands¶
scan¶
Primary command - Scan a project for security vulnerabilities.
Options¶
| Option | Short | Default | Description |
|---|---|---|---|
--mode |
-m |
fast |
Analysis mode: fast or deep |
--output |
-o |
json |
Output format: json, sarif, evidence |
--fail-on |
-f |
(none) | Fail on severity: info, low, medium, high, critical |
--config |
-c |
.mcp-scan.yaml |
Path to configuration file |
--rules |
(all) | Comma-separated rule IDs or classes: A,B,E or MCP-A003,MCP-E001 |
|
--exclude |
(none) | Additional glob patterns to exclude | |
--timeout |
5m |
Maximum scan duration | |
--workers |
-w |
0 (auto) |
Number of parallel workers |
--baseline |
-b |
(none) | Baseline file for accepted findings |
Examples¶
# Basic scan
mcp-scan scan ./my-project
# Deep analysis with SARIF output
mcp-scan scan ./my-project --mode deep --output sarif
# Only run specific rules
mcp-scan scan ./my-project --rules A,E,G
# Fail CI on high severity
mcp-scan scan ./my-project --fail-on high
# Use baseline to ignore accepted findings
mcp-scan scan ./my-project --baseline .mcp-scan-baseline.json
# Custom config and timeout
mcp-scan scan ./my-project --config custom-config.yaml --timeout 10m
version¶
Display version information.
Output:
init¶
Initialize a configuration file in the current directory.
Options¶
| Option | Default | Description |
|---|---|---|
--output |
.mcp-scan.yaml |
Output file path |
--force |
false |
Overwrite existing file |
Creates a .mcp-scan.yaml with default settings that you can customize.
surface¶
Display the detected MCP surface without running a full security scan.
Understanding
surfacevsscan: Thesurfacecommand extracts only the MCP metadata (tools, transport, auth signals) from your code. Thescancommand runs the full pipeline which includes surface extraction PLUS vulnerability analysis. Think ofsurfaceas a "preview" of what the scanner sees before analyzing.
scan = [discovery] → [parsing] → [SURFACE] → [analysis] → [findings]
↑
surface command
(extracts only this part)
When to use surface:
- Debug/understand what tools mcp-scan detects in your code
- Quick preview before running a full scan
- Generate inventory of your MCP server's exposed surface
- Verify that expected tools are being detected correctly
When to use scan:
- Find actual security vulnerabilities
- CI/CD integration for automated security checks
- Security audits and compliance scoring
Options¶
| Option | Default | Description |
|---|---|---|
--config |
.mcp-scan.yaml |
Configuration file |
--format |
text |
Output format: text, json |
Example Output¶
MCP Surface Analysis
====================
Transport: stdio
Tools (3 detected):
- read_file
Description: Read contents of a file
Handler: handle_read_file (src/tools.py:45)
- write_file
Description: Write contents to a file
Handler: handle_write_file (src/tools.py:78)
- execute_command
Description: Execute a shell command
Handler: handle_execute (src/tools.py:112)
Auth Signals:
- JWT verification detected (src/auth.py:23)
baseline¶
Manage baseline files for tracking accepted findings.
baseline generate¶
Generate a baseline from current findings.
| Option | Short | Default | Description |
|---|---|---|---|
--output |
-o |
.mcp-scan-baseline.json |
Baseline file path |
--reason |
-r |
(none) | Reason for accepting findings |
--accepted-by |
-a |
(none) | Who accepted the findings |
--config |
-c |
.mcp-scan.yaml |
Configuration file |
--mode |
-m |
fast |
Scan mode |
# Generate baseline with metadata
mcp-scan baseline generate ./my-project \
--reason "Reviewed and accepted" \
--accepted-by "security@example.com"
baseline show¶
Display baseline contents.
| Option | Short | Description |
|---|---|---|
--stats |
-s |
Show only statistics |
# Show full baseline
mcp-scan baseline show .mcp-scan-baseline.json
# Show only stats
mcp-scan baseline show .mcp-scan-baseline.json --stats
baseline merge¶
Merge multiple baseline files.
| Option | Short | Default | Description |
|---|---|---|---|
--output |
-o |
(first file) | Output file |
Exit Codes¶
| Code | Meaning |
|---|---|
| 0 | Success, no findings above threshold |
| 1 | Findings found above --fail-on threshold |
| 2 | Configuration or usage error |
| 3 | Scan error (timeout, parse failure, etc.) |
Environment Variables¶
| Variable | Description |
|---|---|
MCP_SCAN_CONFIG |
Default config file path |
MCP_SCAN_MODE |
Default scan mode |
NO_COLOR |
Disable colored output |
Analysis Modes¶
Fast Mode (Default)¶
- Intra-procedural taint analysis
- Pattern-based rule detection
- Typical runtime: 2-5 seconds
- Best for: CI/CD, quick checks
Deep Mode¶
- Inter-procedural taint analysis
- Cross-function data flow tracking
- Additional rules (H, I, J, K)
- Typical runtime: 10-60 seconds
- Best for: Security audits, thorough analysis
Output Formats¶
JSON (Default)¶
Machine-readable format with full details:
SARIF¶
GitHub Code Scanning compatible format:
Evidence Bundle¶
Directory with individual evidence files:
See Output Formats for detailed schema documentation.