---
name: security:mcp-inspect
description: Connect to running MCP servers and scan live tool descriptions for injection, shadowing, and drift
allowed-tools: Bash, Read
model: sonnet
---

# /security mcp-inspect [path]

Live MCP runtime inspection — connects to each configured MCP stdio server via JSON-RPC 2.0, fetches tool/prompt/resource lists, and scans descriptions for injection patterns and tool shadowing.

## Step 1: Run Scanner

Determine plugin root (parent of this `commands/` folder) and target path from `$ARGUMENTS` (default `.`).

```bash
node <plugin-root>/scanners/mcp-live-inspect.mjs "<target>"
```

Parse stdout as JSON. If exit code is non-zero and no JSON output, show the error and STOP.

## Step 2: Report

Display:

```
## MCP Live Inspection: <VERDICT>

**Servers:** <discovered> discovered | <contacted> contacted | <timed_out> timed out | <skipped_sse> SSE skipped | <failed> failed

### Server Details
| Server | Status | Tools | Prompts | Resources | Time |
```

For each finding (sorted critical → info):

```
### Findings (<count>)

| # | Severity | Title | OWASP | Recommendation |
```

If zero findings: "No injection, shadowing, or drift detected across N servers."

## Step 3: Advisory

- If `servers_timed_out > 0`: "N servers timed out (10s). Ensure they can start independently — check command, env vars, and args."
- If `servers_skipped_sse > 0`: "N SSE servers skipped — live inspection requires stdio transport."
- If `servers_failed > 0`: "N servers failed to start. Verify the command path exists and is executable."
- If `servers_discovered == 0`: "No MCP servers found in config locations. Check .mcp.json, .claude/settings.json, or ~/.claude/settings.json."

## Step 4: Combined Use

Mention: "For combined static + live analysis, use `/security mcp-audit --live`."
