agentgate scan
Scan MCP servers for security issues.
agentgate scan [target] [options]Without a target, AgentGate auto-discovers MCP client configs (Claude Desktop, Claude Code, Cursor, VS Code, Codex, OpenCode). Pass a directory to also run a repo/source scan over it, or a config file to scan just that config.
| Mode | What it does |
|---|---|
| static (default) | Analyzes client configs and (for a directory target) source files. Never executes server code. |
--live |
Additionally connects to each stdio server, performs the MCP handshake, and analyzes the tool surface the server actually exposes. Explicit opt-in because it runs server code. |
Options
Section titled “Options”| Flag | Default | Description |
|---|---|---|
--live |
off | Connect to stdio servers and analyze their live tool surface. |
-c, --config <file> |
auto-discover | Explicit MCP client config file (skips auto-discovery). Codex config.toml and OpenCode opencode.json are also understood. |
-s, --server <names...> |
all | Restrict to specific server names. |
-f, --format <format> |
table |
Output format: table, json, sarif. JSON follows the scan output spec. |
-o, --output <file> |
stdout | Write the report to a file. |
--fail-on <severity> |
off | Exit non-zero when findings reach this severity: info, low, medium, high, critical. |
-t, --timeout <ms> |
15000 |
Per-server connect timeout for --live. |
Examples
Section titled “Examples”agentgate scan # audit everything your clients are configured to runagentgate scan --live # also audit the live tool surfaceagentgate scan --format json -o report.json # machine-readable report (open it in the report viewer)agentgate scan --format sarif -o report.sarif # for GitHub code scanningagentgate scan path/to/repo # source-level scan of an MCP server repoagentgate scan -c ~/.cursor/mcp.json --fail-on highFindings come from seven rules, one per category — see the rule reference for what each detects: tool-poisoning, credential-leak, overprivileged, auth-missing, ssrf, rce-vectors, supply-chain.
Exit codes
Section titled “Exit codes”| Code | Meaning |
|---|---|
| 0 | No findings at or above the --fail-on threshold (or no --fail-on given). |
| 1 | Findings at or above the threshold. |
| 2 | Execution error (bad target, unreadable config). |