@mcp-shark/mcp-shark 1.5.13 → 1.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/README.md +482 -56
  2. package/bin/mcp-shark.js +146 -52
  3. package/core/cli/AutoFixEngine.js +93 -0
  4. package/core/cli/ConfigScanner.js +193 -0
  5. package/core/cli/DataLoader.js +200 -0
  6. package/core/cli/DeclarativeRuleEngine.js +363 -0
  7. package/core/cli/DoctorCommand.js +218 -0
  8. package/core/cli/FixHandlers.js +222 -0
  9. package/core/cli/HtmlReportGenerator.js +203 -0
  10. package/core/cli/IdeConfigPaths.js +175 -0
  11. package/core/cli/ListCommand.js +255 -0
  12. package/core/cli/LockCommand.js +164 -0
  13. package/core/cli/LockDiffEngine.js +152 -0
  14. package/core/cli/RuleRegistryConfig.js +131 -0
  15. package/core/cli/ScanCommand.js +244 -0
  16. package/core/cli/ScanService.js +200 -0
  17. package/core/cli/SecretDetector.js +92 -0
  18. package/core/cli/SharkScoreCalculator.js +109 -0
  19. package/core/cli/ToolClassifications.js +51 -0
  20. package/core/cli/ToxicFlowAnalyzer.js +212 -0
  21. package/core/cli/UpdateCommand.js +188 -0
  22. package/core/cli/WalkthroughGenerator.js +195 -0
  23. package/core/cli/WatchCommand.js +129 -0
  24. package/core/cli/YamlRuleEngine.js +197 -0
  25. package/core/cli/data/rule-packs/aauth-visibility.json +117 -0
  26. package/core/cli/data/rule-packs/agentic-security-2026.json +180 -0
  27. package/core/cli/data/rule-packs/general-security.json +173 -0
  28. package/core/cli/data/rule-packs/owasp-mcp-2026.json +244 -0
  29. package/core/cli/data/rule-packs/toxic-flow-heuristics.json +21 -0
  30. package/core/cli/data/rule-sources.json +5 -0
  31. package/core/cli/data/secret-patterns.json +18 -0
  32. package/core/cli/data/tool-classifications.json +111 -0
  33. package/core/cli/data/toxic-flow-rules.json +47 -0
  34. package/core/cli/index.js +23 -0
  35. package/core/cli/output/Banner.js +52 -0
  36. package/core/cli/output/Formatter.js +183 -0
  37. package/core/cli/output/JsonFormatter.js +106 -0
  38. package/core/cli/output/index.js +16 -0
  39. package/core/cli/secureRegistryFetch.js +157 -0
  40. package/core/cli/symbols.js +16 -0
  41. package/core/configs/environment.js +3 -1
  42. package/core/configs/index.js +3 -64
  43. package/core/container/DependencyContainer.js +4 -1
  44. package/core/mcp-server/index.js +4 -1
  45. package/core/mcp-server/server/external/all.js +10 -3
  46. package/core/mcp-server/server/external/config.js +62 -5
  47. package/core/models/RequestFilters.js +3 -0
  48. package/core/repositories/PacketRepository.js +16 -0
  49. package/core/services/AuditService.js +2 -0
  50. package/core/services/ConfigService.js +9 -1
  51. package/core/services/ConfigTransformService.js +34 -2
  52. package/core/services/RequestService.js +58 -5
  53. package/core/services/ServerManagementService.js +59 -4
  54. package/core/services/security/StaticRulesService.js +69 -13
  55. package/core/services/security/TrafficAnalysisService.js +19 -1
  56. package/core/services/security/TrafficToxicFlowService.js +154 -0
  57. package/core/services/security/aauthGraph.js +199 -0
  58. package/core/services/security/aauthParser.js +274 -0
  59. package/core/services/security/aauthSelfTest.js +346 -0
  60. package/core/services/security/index.js +2 -1
  61. package/core/services/security/rules/index.js +25 -59
  62. package/core/services/security/rules/scans/configPermissions.js +91 -0
  63. package/core/services/security/rules/scans/duplicateToolNames.js +85 -0
  64. package/core/services/security/rules/scans/insecureTransport.js +148 -0
  65. package/core/services/security/rules/scans/missingContainment.js +123 -0
  66. package/core/services/security/rules/scans/shellEnvInjection.js +101 -0
  67. package/core/services/security/rules/scans/unsafeDefaults.js +99 -0
  68. package/core/services/security/toolsListFromTrafficParser.js +70 -0
  69. package/core/tui/App.js +144 -0
  70. package/core/tui/FindingsPanel.js +115 -0
  71. package/core/tui/FixPanel.js +132 -0
  72. package/core/tui/Header.js +51 -0
  73. package/core/tui/HelpBar.js +42 -0
  74. package/core/tui/ServersPanel.js +109 -0
  75. package/core/tui/ToxicFlowsPanel.js +100 -0
  76. package/core/tui/h.js +8 -0
  77. package/core/tui/index.js +11 -0
  78. package/core/tui/render.js +22 -0
  79. package/package.json +24 -16
  80. package/ui/dist/assets/index-D6zDrtMV.js +81 -0
  81. package/ui/dist/index.html +1 -1
  82. package/ui/server/controllers/AauthController.js +279 -0
  83. package/ui/server/controllers/RequestController.js +12 -1
  84. package/ui/server/controllers/SecurityFindingsController.js +46 -1
  85. package/ui/server/routes/aauth.js +18 -0
  86. package/ui/server/routes/requests.js +8 -1
  87. package/ui/server/routes/security.js +5 -1
  88. package/ui/server/setup.js +224 -6
  89. package/ui/server/swagger/paths/components.js +55 -0
  90. package/ui/server/swagger/paths/securityTrafficFlows.js +59 -0
  91. package/ui/server/swagger/paths.js +2 -2
  92. package/ui/server/swagger/swagger.js +5 -2
  93. package/ui/server.js +1 -1
  94. package/ui/src/App.jsx +26 -52
  95. package/ui/src/PacketFilters.jsx +31 -1
  96. package/ui/src/PacketList.jsx +2 -2
  97. package/ui/src/Security.jsx +10 -0
  98. package/ui/src/TabNavigation.jsx +8 -0
  99. package/ui/src/components/AAuthBadge.jsx +92 -0
  100. package/ui/src/components/AauthExplorer/AauthExplorerGraph.jsx +231 -0
  101. package/ui/src/components/AauthExplorer/AauthExplorerView.jsx +387 -0
  102. package/ui/src/components/AauthExplorer/NodeDetailPanel.jsx +272 -0
  103. package/ui/src/components/App/ActionMenu.jsx +4 -31
  104. package/ui/src/components/App/ApiDocsButton.jsx +0 -1
  105. package/ui/src/components/App/ShutdownButton.jsx +0 -1
  106. package/ui/src/components/App/useAppState.js +19 -26
  107. package/ui/src/components/DetailsTab/AAuthIdentitySection.jsx +119 -0
  108. package/ui/src/components/DetailsTab/RequestDetailsSection.jsx +2 -0
  109. package/ui/src/components/DetailsTab/ResponseDetailsSection.jsx +2 -0
  110. package/ui/src/components/DetectedPathsList.jsx +1 -5
  111. package/ui/src/components/FileInput.jsx +0 -1
  112. package/ui/src/components/PacketFilters/AAuthPostureFilter.jsx +81 -0
  113. package/ui/src/components/RequestRow/RequestRowMain.jsx +7 -1
  114. package/ui/src/components/Security/AAuthPosturePanel.jsx +360 -0
  115. package/ui/src/components/Security/ScannerContent.jsx +33 -1
  116. package/ui/src/components/Security/TrafficToxicFlowsPanel.jsx +253 -0
  117. package/ui/src/components/Security/securityApi.js +15 -0
  118. package/ui/src/components/Security/useSecurity.js +60 -3
  119. package/ui/src/components/ServerControl.jsx +0 -1
  120. package/ui/src/components/TabNavigation/DesktopTabs.jsx +0 -11
  121. package/ui/src/components/TabNavigationIcons.jsx +5 -0
  122. package/ui/src/components/ViewModeTabs.jsx +0 -1
  123. package/ui/src/utils/animations.js +26 -9
  124. package/core/services/security/rules/scans/agentic01GoalHijack.js +0 -130
  125. package/core/services/security/rules/scans/agentic02ToolMisuse.js +0 -129
  126. package/core/services/security/rules/scans/agentic03IdentityAbuse.js +0 -130
  127. package/core/services/security/rules/scans/agentic04SupplyChain.js +0 -130
  128. package/core/services/security/rules/scans/agentic06MemoryPoisoning.js +0 -130
  129. package/core/services/security/rules/scans/agentic07InsecureCommunication.js +0 -135
  130. package/core/services/security/rules/scans/agentic08CascadingFailures.js +0 -135
  131. package/core/services/security/rules/scans/agentic09TrustExploitation.js +0 -135
  132. package/core/services/security/rules/scans/agentic10RogueAgent.js +0 -130
  133. package/core/services/security/rules/scans/hardcodedSecrets.js +0 -130
  134. package/core/services/security/rules/scans/mcp01TokenMismanagement.js +0 -127
  135. package/core/services/security/rules/scans/mcp02ScopeCreep.js +0 -130
  136. package/core/services/security/rules/scans/mcp03ToolPoisoning.js +0 -132
  137. package/core/services/security/rules/scans/mcp04SupplyChain.js +0 -131
  138. package/core/services/security/rules/scans/mcp06PromptInjection.js +0 -200
  139. package/core/services/security/rules/scans/mcp07InsufficientAuth.js +0 -130
  140. package/core/services/security/rules/scans/mcp08LackAudit.js +0 -129
  141. package/core/services/security/rules/scans/mcp09ShadowServers.js +0 -129
  142. package/core/services/security/rules/scans/mcp10ContextInjection.js +0 -130
  143. package/ui/dist/assets/index-CiCSDYf-.js +0 -97
  144. package/ui/server/routes/help.js +0 -44
  145. package/ui/server/swagger/paths/help.js +0 -82
  146. package/ui/src/HelpGuide/HelpGuideContent.jsx +0 -118
  147. package/ui/src/HelpGuide/HelpGuideFooter.jsx +0 -59
  148. package/ui/src/HelpGuide/HelpGuideHeader.jsx +0 -57
  149. package/ui/src/HelpGuide.jsx +0 -78
  150. package/ui/src/IntroTour.jsx +0 -154
  151. package/ui/src/components/App/HelpButton.jsx +0 -90
  152. package/ui/src/components/TourOverlay.jsx +0 -117
  153. package/ui/src/components/TourTooltip/TourTooltipButtons.jsx +0 -120
  154. package/ui/src/components/TourTooltip/TourTooltipHeader.jsx +0 -71
  155. package/ui/src/components/TourTooltip/TourTooltipIcons.jsx +0 -54
  156. package/ui/src/components/TourTooltip/useTooltipPosition.js +0 -135
  157. package/ui/src/components/TourTooltip.jsx +0 -91
  158. package/ui/src/config/tourSteps.jsx +0 -140
package/README.md CHANGED
@@ -2,97 +2,523 @@
2
2
 
3
3
  <img src="https://smart.mcpshark.sh/icon_512x512.png" alt="MCP Shark Logo" width="128" height="128">
4
4
 
5
- <h1>@mcp-shark/mcp-shark</h1>
5
+ <h1>mcp-shark</h1>
6
6
 
7
- <p>Aggregate multiple Model Context Protocol (MCP) servers into a single unified interface with a powerful monitoring UI</p>
7
+ <div style="text-align: left; max-width: 42rem; margin: 0 auto;">
8
+ <p><strong>Security scanner for AI agent tools</strong> — built for security and platform engineers working with MCP in the IDE.</p>
9
+ <p>Run a local static <code>scan</code> over MCP <strong>IDE configs</strong> and embedded tool metadata: <strong>41 rules</strong> (including <strong>AAuth visibility</strong>), toxic-flow heuristics, and <strong>SARIF</strong> / <strong>HTML</strong> / <strong>JSON</strong> reports. There is no hosted config-scan backend.</p>
10
+ <p>Add an optional <strong>local HTTP proxy</strong> with an <strong>in-browser dashboard</strong> so live traffic, findings, AAuth signals, and playground checks stay in one place—without sending your configs to a vendor.</p>
11
+ <p><strong>You can</strong></p>
12
+ <ul style="margin: 0.35rem 0 0.75rem; padding-left: 1.25rem;">
13
+ <li>Use <strong>Traffic</strong> for live JSON-RPC capture, filters, export, and AAuth posture chips</li>
14
+ <li>Run <strong>Local Analysis</strong> for OWASP-style findings over captured traffic</li>
15
+ <li>Run <strong>YARA Detection</strong> for traffic pattern rules (native engine when installed, regex fallback otherwise)</li>
16
+ <li>Open <strong>AAuth Explorer</strong> for a graph of agents, missions, resources, and signing / access signals</li>
17
+ <li>Use <strong>MCP Playground</strong> to call tools, prompts, and resources through the proxy</li>
18
+ <li>Optionally run <strong>Smart Scan</strong> (AI-backed; uses <strong>your</strong> API token when enabled)</li>
19
+ <li>Use <strong>Server setup</strong> to detect configs, convert format, and route the editor through the proxy</li>
20
+ </ul>
21
+ <p><strong>Privacy:</strong> static scans need no cloud and send no telemetry. Refreshing rule catalogs is opt-in HTTPS (<code>update-rules</code>).</p>
22
+ </div>
23
+
24
+ [![npm version](https://img.shields.io/npm/v/@mcp-shark/mcp-shark.svg)](https://www.npmjs.com/package/@mcp-shark/mcp-shark)
25
+ [![License: Non-Commercial](https://img.shields.io/badge/License-Non--Commercial-red.svg)](LICENSE)
8
26
 
9
27
  </div>
10
28
 
11
- [![npm version](https://img.shields.io/npm/v/@mcp-shark/mcp-shark.svg)](https://www.npmjs.com/package/@mcp-shark/mcp-shark)
12
- [![License: Non-Commercial](https://img.shields.io/badge/License-Non--Commercial-red.svg)](LICENSE)
29
+ ## Dashboard at a glance
30
+
31
+ These captures are from the live **dashboard** with **real captured traffic** (dummy MCP or your own upstreams). Start with `npx @mcp-shark/mcp-shark serve --open`. **Smart Scan** is not shown below — it depends on an optional remote API token. **MCP Playground** appears once you have at least one MCP upstream configured (the Playground capture uses a demo server with tools loaded).
32
+
33
+ ### Live traffic capture
34
+
35
+ Every JSON-RPC frame between your IDE and each MCP upstream is captured with full headers, body, timing, and an AAuth posture chip. Filter by method, status, server, session, AAuth agent / mission / posture.
36
+
37
+ ![Traffic Capture](docs/assets/hero-traffic.png)
38
+
39
+ ### MCP Playground
40
+
41
+ Pick an upstream, load **tools**, **prompts**, and **resources** from that server, then call tools or read resources through the proxy — useful for validating behavior before it hits your IDE. The view below shows the tools list for a configured demo MCP.
42
+
43
+ ![MCP Playground](docs/assets/playground.png)
44
+
45
+ ### AAuth Explorer
46
+
47
+ Force-directed knowledge graph of every Agent / Mission / Resource / Signing algorithm / Access mode observed across captured traffic. Use **Generate sample data** for a quick demo graph, or capture real AAuth-shaped traffic through the proxy.
48
+
49
+ ![AAuth Explorer](docs/assets/aauth-explorer.png)
50
+
51
+ ### Local Analysis
52
+
53
+ Offline rule-based scanner over captured traffic. The **AAuth Posture** card summarizes signed / aauth-aware / bearer / no-auth distribution; the **Toxic flows (proxy traffic)** panel infers cross-server pairings from observed `tools/list` responses. With packets already in the database, use **Replay from DB** (when no live MCP is attached) and then **Analyse** to populate findings — the view below is after that run.
54
+
55
+ ![Local Analysis](docs/assets/local-analysis.png)
56
+
57
+ ### YARA Detection
58
+
59
+ Same **Local Analysis** tab: switch to **YARA Detection** for the traffic rule engine — engine status, eight predefined rules (toggle, edit, delete), and **New Rule** for your own patterns. When the native `yara` module is not installed, scans still run using the built-in regex fallback (see [docs/local-analysis.md](docs/local-analysis.md)).
60
+
61
+ ![YARA Detection](docs/assets/yara-detection.png)
62
+
63
+ **New Rule** opens the editor with a starter template (meta, `strings`, and `condition`). Edit the rule text, then **Save Rule** to add it as a custom pattern alongside the built-ins.
64
+
65
+ ![Adding a custom YARA rule](docs/assets/yara-new-rule.png)
66
+
67
+ ### Server setup
68
+
69
+ Auto-detects Cursor / Codex / Windsurf configs, converts them to mcp-shark format, and patches the IDE to route through the proxy on start.
70
+
71
+ ![Server Setup](docs/assets/setup.png)
72
+
73
+ ## Why mcp-shark?
74
+
75
+ MCP setups commonly mix secrets, broad tool access, and multiple servers in one agent context; issues are easy to miss without checking configs. See the [OWASP MCP Top 10](https://owasp.org/www-project-mcp-top-10/) for a structured view of what can go wrong.
76
+
77
+ mcp-shark runs on your machine — no API keys or hosted scan backend. Install with `npx` and review findings locally.
78
+
79
+ ### Toxic flow analysis
80
+
81
+ The scanner models how MCP servers **compose in the agent context** and flags risky capability pairings (for example, secret access combined with external egress):
82
+
83
+ ```
84
+ ▲ HIGH notify-server → repo-server
85
+ Untrusted content in one tool’s channel could lead the agent to
86
+ take a destructive action in another (e.g. push code).
87
+
88
+ ▲ MEDIUM browser-server → filesystem-server
89
+ Web-sourced context could be chained into local file operations.
90
+ ```
91
+
92
+ Use mcp-shark findings as input to your own threat model, not as a complete audit.
93
+
94
+ ## Features
95
+
96
+ | Feature | Description |
97
+ |---------|-------------|
98
+ | **41 security rules** | OWASP MCP Top 10 + Agentic Security Initiative + AAuth visibility + general checks |
99
+ | **Toxic flow analysis** | Cross-server attack path detection from tool capability heuristics |
100
+ | **Attack walkthroughs** | Step-by-step exploit narratives from findings |
101
+ | **Shark Score** | Transparent security posture score (0-100, A-F) |
102
+ | **Auto-fix** | `--fix` replaces hardcoded secrets, fixes permissions, with backup/undo |
103
+ | **Tool pinning** | Git-committable `.mcp-shark.lock` with SHA-256 hashes |
104
+ | **15 IDE detection** | Cursor, Claude Desktop, VS Code, Windsurf, Codex, Amp, Kiro, and more |
105
+ | **4 output formats** | Terminal, JSON, SARIF v2.1.0, HTML |
106
+ | **Health checks** | `doctor` command for environment validation |
107
+ | **Server inventory** | `list` command shows all servers in a table |
108
+ | **Watch mode** | Live re-scan on config changes |
109
+ | **HTML reports** | Self-contained offline security reports |
110
+ | **Downloadable rule packs** | [Rule pack registry](https://github.com/mcp-shark/rule-packs) (manifest + JSON); `update-rules` syncs declarative packs and toxic-flow heuristics — zero code changes |
111
+ | **YAML rules** | Per-project custom rules via `.mcp-shark/rules/` |
112
+ | **GitHub Action** | CI/CD integration with SARIF upload |
113
+ | **Interactive TUI** | lazygit-style terminal UI for scan, fix, and server browsing |
114
+ | **Browser dashboard** | Live traffic, Local Analysis, YARA rules, AAuth Explorer, Playground, setup, and logs |
115
+ | **Proxy toxic flows** | Local Analysis panel + `GET/POST /api/security/traffic-toxic-flows*` infer cross-server pairs from captured **tools/list** traffic (see [docs/local-analysis.md](docs/local-analysis.md)) |
116
+ | **YARA-style traffic rules** | In **Local Analysis → YARA Detection**, enable or edit built-in pattern rules, add custom rules, and inspect engine status (native YARA when available, regex fallback otherwise) |
117
+ | **Local static scans** | No hosted scan backend; `update-rules` is opt-in HTTPS to the registry |
13
118
 
14
119
  ## Quick Start
15
120
 
16
- **Run instantly with npx (no installation required):**
17
121
  ```bash
18
- npx @mcp-shark/mcp-shark --open
122
+ # Scan your MCP setup (default command)
123
+ npx @mcp-shark/mcp-shark
124
+
125
+ # Auto-fix issues (with interactive confirmation)
126
+ npx @mcp-shark/mcp-shark scan --fix
127
+
128
+ # See full attack chain narratives
129
+ npx @mcp-shark/mcp-shark scan --walkthrough
130
+
131
+ # Pin tool definitions (lockfile) to spot unexpected changes
132
+ npx @mcp-shark/mcp-shark lock
133
+
134
+ # Check environment health
135
+ npx @mcp-shark/mcp-shark doctor
136
+
137
+ # Show all detected servers
138
+ npx @mcp-shark/mcp-shark list
139
+
140
+ # Download latest rule packs (OWASP, Agentic Security)
141
+ npx @mcp-shark/mcp-shark update-rules
142
+
143
+ # Watch for config changes
144
+ npx @mcp-shark/mcp-shark watch
145
+
146
+ # Interactive terminal UI
147
+ npx @mcp-shark/mcp-shark tui
148
+
149
+ # Generate HTML report
150
+ npx @mcp-shark/mcp-shark scan --format html --output report.html
151
+
152
+ # CI mode (exits 1 on critical/high)
153
+ npx @mcp-shark/mcp-shark scan --ci --format sarif
19
154
  ```
20
155
 
21
- The server will start on `http://localhost:9853` and automatically open your browser.
156
+ ## Commands
157
+
158
+ | Command | Description |
159
+ |---------|-------------|
160
+ | `scan` (default) | Run security scan with 41 rules |
161
+ | `lock` | Create `.mcp-shark.lock` file |
162
+ | `lock --verify` | Verify current state matches lockfile |
163
+ | `diff` | Show tool definition changes since last lock |
164
+ | `doctor` | Run environment health checks |
165
+ | `list` | Show inventory of all detected servers (`--format json` supported) |
166
+ | `update-rules` | Download latest rule packs from remote registry |
167
+ | `watch` | Watch config files and re-scan on changes |
168
+ | `tui` | Interactive terminal UI (lazygit-style) |
169
+ | `serve` | Start the local proxy and monitoring dashboard |
170
+
171
+ ## CLI flags
172
+
173
+ ### `scan` (default command)
174
+
175
+ | Flag | Description |
176
+ |------|-------------|
177
+ | `--fix` | Auto-fix issues (interactive confirmation) |
178
+ | `--fix --yes` | Auto-fix without prompting |
179
+ | `--fix --undo` | Restore backups from previous fix |
180
+ | `--walkthrough` | Show full attack chain narratives |
181
+ | `--ci` | CI mode: exit code 1 on critical/high |
182
+ | `--format <fmt>` | Output: `terminal`, `json`, `sarif`, `html` |
183
+ | `--output <path>` | Write report to file (for `html` format) |
184
+ | `--strict` | Count advisory findings in score |
185
+ | `--ide <name>` | Scan specific IDE only |
186
+ | `--rules <path>` | Load custom YAML rules from directory |
187
+ | `--refresh-rules` | Fetch rule packs from registry before scan (HTTPS; see rule registry config) |
188
+
189
+ ### Other commands
190
+
191
+ | Command | Flags / notes |
192
+ |---------|----------------|
193
+ | `list` | `--format terminal` or `--format json` |
194
+ | `update-rules` | `--source <url>` for a custom pack manifest |
195
+ | `serve` | `--open` / `-o` to open the browser |
196
+ | `lock` | `--verify` to check lockfile match |
197
+
198
+ ## How `scan` works
199
+
200
+ The CLI **`scan`** command is **static**: it reads MCP entries from your IDE config files (see [Supported IDEs](#supported-ides) and optional project `./mcp.json`) and analyzes **what is written there**. It does **not** connect to running MCP servers or call `tools/list`.
201
+
202
+ - **Always scanned:** each server block’s `command`, `args`, `env`, `url`, and related fields (secrets in `env`, unsafe spawn patterns, HTTP URLs, etc.).
203
+ - **Tool-level rules** (declarative packs, command-injection heuristics, toxic-flow classification from tool **names**, etc.) run only when that server entry includes an embedded **`tools`** array (name, description, schemas). If `tools` is omitted—typical for `command`/`stdio`-only configs—the scan may report **0 tools checked** even though Cursor is running the server fine.
204
+
205
+ To exercise full rule coverage in CI or test repos, either embed tool metadata in the same JSON your scanner reads, or use a project-local `mcp.json` harness (see `--ide Project`).
206
+
207
+ ## What it covers
208
+
209
+ mcp-shark is aimed at **config and metadata you already have on disk** (plus optional local monitoring). It helps catch common misconfigurations and risky combinations; treat output as input to your own review, not a guarantee nothing is wrong.
210
+
211
+ | Area | Notes |
212
+ |------|--------|
213
+ | Install / run | Node.js 20+; `npx @mcp-shark/mcp-shark` |
214
+ | Security rules | 41 checks — 30 declarative JSON packs, 11 JS where heuristics need code |
215
+ | Toxic flow analysis | Heuristic cross-server paths; quality depends on embedded `tools` / classifications |
216
+ | Attack walkthroughs | Narratives derived from findings |
217
+ | Auto-fix | Supported for a subset of issues; confirm changes in your repo |
218
+ | Tool pinning | `.mcp-shark.lock` with SHA-256 hashes |
219
+ | Live traffic | Dashboard (`serve`) for monitoring; separate from static `scan` |
220
+ | Custom rules | YAML under `.mcp-shark/rules/` and JSON rule packs |
221
+ | Findings & score | confirmed / advisory tiers plus Shark Score (0–100, A–F) |
222
+ | IDE configs | 15 built-in paths + project-local `mcp.json` variants — see [Supported IDEs](#supported-ides) |
223
+ | Output | Terminal, JSON, SARIF v2.1.0, HTML |
224
+ | Health | `doctor` for environment checks |
225
+ | CI | `scan --ci` and optional [GitHub Action](#github-action) |
226
+ | Watch | Re-scan when config files change |
227
+ | Rule updates | `update-rules` (optional HTTPS fetch; static scan works without it) |
228
+
229
+ ## Rule Extensibility
230
+
231
+ ### Downloadable Rule Packs (JSON)
232
+
233
+ The canonical **registry** (manifest, pack files, validation CI, and schema notes) lives in **[mcp-shark/rule-packs](https://github.com/mcp-shark/rule-packs)**. The npm package embeds copies; `update-rules` pulls the same artifacts into `.mcp-shark/rule-packs/`.
234
+
235
+ mcp-shark ships with 30 declarative rules as JSON packs (OWASP MCP, Agentic Security Initiative, General Security, AAuth Visibility), plus a **`toxic-flow-heuristics`** pack (`toxic_flow_rules` for cross-server composition). New vulnerability catalogs can be added as `.json` files — no JavaScript, no code changes.
22
236
 
23
- **Or install globally:**
24
237
  ```bash
25
- npm install -g @mcp-shark/mcp-shark
26
- mcp-shark --open
238
+ # Fetch latest rule packs from the registry
239
+ npx @mcp-shark/mcp-shark update-rules
240
+
241
+ # Use a custom/enterprise registry
242
+ npx @mcp-shark/mcp-shark update-rules --source https://internal.corp/rules/manifest.json
243
+ ```
244
+
245
+ Downloaded packs are cached in `.mcp-shark/rule-packs/` and merged with built-in rules on every scan.
246
+
247
+ <details>
248
+ <summary>Rule pack JSON schema</summary>
249
+
250
+ ```json
251
+ {
252
+ "id": "owasp-mcp-2027",
253
+ "name": "OWASP MCP Top 10 (2027)",
254
+ "version": "1.0.0",
255
+ "rules": [
256
+ {
257
+ "id": "MCP01-token-mismanagement",
258
+ "name": "Token Mismanagement",
259
+ "severity": "critical",
260
+ "framework": "OWASP-MCP",
261
+ "description": "Detects hardcoded tokens in MCP configs",
262
+ "patterns": [
263
+ { "regex": "(api[_-]?key|token)\\s*[:=]", "flags": "i", "label": "API key pattern" }
264
+ ],
265
+ "scope": ["tool", "prompt", "resource", "packet"],
266
+ "exclude_patterns": [{ "regex": "\\$\\{|process\\.env" }],
267
+ "match_mode": "any"
268
+ }
269
+ ]
270
+ }
271
+ ```
272
+
273
+ </details>
274
+
275
+ ### Custom YAML Rules (per-project)
276
+
277
+ Create `.mcp-shark/rules/` in your project to add lightweight custom rules:
278
+
279
+ ```yaml
280
+ # .mcp-shark/rules/no-production-keys.yaml
281
+ id: custom-no-prod-keys
282
+ name: No Production Keys
283
+ severity: critical
284
+ description: Detects production API keys in MCP configs
285
+ match:
286
+ env_pattern: "^(PROD_|PRODUCTION_)"
287
+ value_pattern: "^sk-live|^pk-live"
288
+ message: "Production key detected in {key} — use staging keys for development"
289
+ ```
290
+
291
+ Both YAML rules and JSON packs are loaded automatically on scan. Share them with your team by committing the folder.
292
+
293
+ ### User-Overridable Data (`.mcp-shark/`)
294
+
295
+ Every built-in data source can be extended or overridden through YAML files in your project root:
296
+
297
+ | File | Overrides | Format |
298
+ |------|-----------|--------|
299
+ | `.mcp-shark/secrets.yaml` | Secret detection patterns | List of `{ name, regex }` |
300
+ | `.mcp-shark/classifications.yaml` | Server/tool capability tags | Nested map `server: { capability: true }` |
301
+ | `.mcp-shark/flows.yaml` | Toxic flow rules | List of `{ source_cap, target_cap, risk, ... }` |
302
+ | `.mcp-shark/rules/*.yaml` | Custom per-project rules | See YAML Rules above |
303
+ | `.mcp-shark/rule-packs/*.json` | Override or add declarative packs | See JSON Packs above |
304
+
305
+ User data is merged with built-in data at scan time. No rebuild required.
306
+
307
+ ## GitHub Action
308
+
309
+ ```yaml
310
+ # .github/workflows/mcp-security.yml
311
+ name: MCP Security Scan
312
+ on: [push, pull_request]
313
+ jobs:
314
+ scan:
315
+ runs-on: ubuntu-latest
316
+ steps:
317
+ - uses: actions/checkout@v4
318
+ - uses: mcp-shark/scan-action@v1
319
+ with:
320
+ format: sarif
321
+ fail-on: high
322
+ - uses: github/codeql-action/upload-sarif@v3
323
+ if: always()
324
+ with:
325
+ sarif_file: mcp-shark-results.sarif
27
326
  ```
28
327
 
29
- ## What is MCP Shark?
328
+ ## Supported IDEs
329
+
330
+ | IDE | Config Path | Status |
331
+ |-----|-------------|--------|
332
+ | Cursor | `~/.cursor/mcp.json` | ✅ |
333
+ | Claude Desktop | `~/Library/.../claude_desktop_config.json` | ✅ |
334
+ | Claude Code | `~/.claude.json` | ✅ |
335
+ | VS Code | `~/.vscode/mcp.json` | ✅ |
336
+ | Windsurf | `~/.codeium/windsurf/mcp_config.json` | ✅ |
337
+ | Codex | `~/.codex/config.toml` | ✅ |
338
+ | Gemini CLI | `~/.gemini/settings.json` | ✅ |
339
+ | Continue | `~/.continue/config.json` | ✅ |
340
+ | Cline | `~/.../saoudrizwan.claude-dev/.../cline_mcp_settings.json` | ✅ |
341
+ | Amp | `~/.amp/mcp.json` | ✅ |
342
+ | Kiro | `~/.kiro/mcp.json` | ✅ |
343
+ | Zed | `~/.config/zed/settings.json` | ✅ |
344
+ | Augment | `~/.augment/mcp.json` | ✅ |
345
+ | Roo Code | `~/.roo-code/mcp.json` | ✅ |
346
+ | Project (local) | `./mcp.json`, `./.mcp.json`, `./.mcp/config.json` | ✅ |
347
+
348
+ ## Security Rules (41)
349
+
350
+ <details>
351
+ <summary>Full rule list</summary>
352
+
353
+ ### OWASP MCP Top 10
354
+ | ID | Rule | Severity | Source |
355
+ |----|------|----------|--------|
356
+ | MCP01 | Token Mismanagement | Critical | declarative |
357
+ | MCP02 | Scope Creep | High | declarative |
358
+ | MCP03 | Tool Poisoning | Critical | declarative |
359
+ | MCP04 | Supply Chain | High | declarative |
360
+ | MCP05 | Command Injection | Critical | JS plugin |
361
+ | MCP06 | Prompt Injection | High | declarative |
362
+ | MCP07 | Insufficient Auth | High | declarative |
363
+ | MCP08 | Lack of Audit | Medium | declarative |
364
+ | MCP09 | Shadow Servers | High | declarative |
365
+ | MCP10 | Context Injection | High | declarative |
30
366
 
31
- MCP Shark is a monitoring and aggregation solution for Model Context Protocol (MCP) servers. It provides:
367
+ ### Agentic Security Initiative (ASI)
368
+ | ID | Rule | Severity | Source |
369
+ |----|------|----------|--------|
370
+ | ASI01 | Goal Hijack | Critical | declarative |
371
+ | ASI02 | Tool Misuse | High | declarative |
372
+ | ASI03 | Identity Abuse | High | declarative |
373
+ | ASI04 | Supply Chain | High | declarative |
374
+ | ASI05 | Remote Code Execution | Critical | JS plugin |
375
+ | ASI06 | Memory Poisoning | High | declarative |
376
+ | ASI07 | Insecure Communication | Medium | declarative |
377
+ | ASI08 | Cascading Failures | Medium | declarative |
378
+ | ASI09 | Trust Exploitation | High | declarative |
379
+ | ASI10 | Rogue Agent | Critical | declarative |
32
380
 
33
- - **Multi-server aggregation**: Connect to multiple MCP servers simultaneously
34
- - **Real-time monitoring**: Wireshark-like interface for inspecting all MCP communications
35
- - **Interactive playground**: Test tools, prompts, and resources directly in the UI
36
- - **Local analysis**: Rule-based static analysis with YARA detection for connected servers
37
- - **Smart Scan**: AI-powered scanning for security risks and vulnerabilities
38
- - **IDE integration**: Automatic configuration detection for Cursor, Windsurf, Codex, and other IDEs
39
- - **API documentation**: Comprehensive Swagger/OpenAPI documentation for all endpoints with interactive testing
40
- - **Action menu**: Expandable menu providing quick access to API docs, help tour, and server shutdown
381
+ ### AAuth Visibility (informational)
382
+ | ID | Description | Severity |
383
+ |----|-------------|----------|
384
+ | `aauth-agent-identity-observed` | `aauth:<local>@<domain>` agent identity in tool/prompt/resource/packet | Low |
385
+ | `aauth-jwks-discovery-url` | URLs containing `/.well-known/aauth` or `/jwks` | Low |
386
+ | `aauth-http-message-signature-observed` | RFC 9421 `Signature-Input` / `Signature` headers in captured traffic | Low |
387
+ | `aauth-mission-context-observed` | `AAuth-Mission` headers in captured traffic | Low |
388
+ | `aauth-requirement-challenge-observed` | `AAuth-Requirement` response headers (resource asking for AAuth) | Low |
389
+ | `aauth-bearer-token-coexists-with-aauth` | Same packet has both Bearer token and AAuth signature | Medium |
390
+
391
+ ### General Security
392
+ | Rule | Severity |
393
+ |------|----------|
394
+ | Hardcoded Secrets | Critical |
395
+ | Command Injection | Critical |
396
+ | Cross-Server Shadowing | High |
397
+ | Tool Name Ambiguity | Medium |
398
+ | DNS Rebinding | High |
399
+ | ANSI Escape Sequences | Medium |
400
+ | Config File Permissions | Medium |
401
+ | Missing Containment | High |
402
+ | Duplicate Tool Names | Medium |
403
+ | Shell/Env Injection | High |
404
+ | Excessive Permissions | High |
405
+ | Unsafe Default Config | Medium |
406
+ | Path Traversal | High |
407
+ | Sensitive Data Exposure | High |
408
+ | Insecure Transport | Medium |
409
+
410
+ </details>
411
+
412
+ ## Browser dashboard
413
+
414
+ MCP Shark ships an **in-browser dashboard** on the local proxy for real-time MCP traffic, analysis, and exploration:
415
+
416
+ ```bash
417
+ npx @mcp-shark/mcp-shark serve --open
418
+ ```
419
+
420
+ Same as the older shortcut (no `serve` subcommand):
421
+
422
+ ```bash
423
+ npx @mcp-shark/mcp-shark --open
424
+ ```
425
+
426
+ The dashboard provides:
427
+ - Multi-server aggregation and real-time traffic capture (filters, export, AAuth posture chips)
428
+ - **MCP Playground** — call tools, prompts, and resources through the proxy against a selected upstream
429
+ - **Local Analysis** — OWASP-style static scan over captured traffic; **YARA Detection** for traffic pattern rules (native engine when installed, regex fallback otherwise)
430
+ - **AAuth Explorer** — graph of Agent / Mission / Resource / signing / access signals observed in traffic
431
+ - **Smart Scan** — optional AI-backed scan (requires a configured API token)
432
+ - In-app API docs, server setup, logs, and graceful shutdown
433
+
434
+ ### Zero-touch first boot
435
+
436
+ The dashboard bootstraps itself the first time you launch it on a new machine — no Setup wizard click required:
437
+
438
+ 1. If `~/.mcp-shark/mcps.json` already declares upstreams (e.g. from a previous run, hand-edit, or `testbed:up`), the proxy starts directly with that config.
439
+ 2. Otherwise, on a brand-new install (no `~/.mcp-shark` at all), MCP Shark scans for a real editor MCP config (`~/.cursor/mcp.json`, `~/.codeium/windsurf/mcp_config.json`, `~/.codex/config.toml`). If one is found with actual upstreams, it auto-imports them, writes `~/.mcp-shark/mcps.json`, starts the proxy, and patches the editor config so the editor routes through the proxy.
440
+ 3. If neither path applies, the UI starts in monitoring-only mode and the Setup panel is still available for manual configuration.
441
+
442
+ To re-trigger first-boot behavior on a machine, remove `~/.mcp-shark/` and restart the UI.
443
+
444
+ ## Architecture
445
+
446
+ ```
447
+ ┌────────────────────────────────────────────────────┐
448
+ │ CLI (Commander.js) │
449
+ │ scan · lock · diff · doctor · list · watch · tui │
450
+ │ update-rules · serve │
451
+ ├──────────────┬──────────────┬──────────────────────┤
452
+ │ ConfigScanner│ ScanService │ StaticRulesService │
453
+ │ 15 IDEs │ orchestrator │ 41 rules │
454
+ ├──────────────┴──────────────┴──────────────────────┤
455
+ │ Data layer (JSON + user YAML/JSON overrides) │
456
+ │ ┌────────────┬──────────────┬───────────────────┐ │
457
+ │ │ rule-packs │ secret- │ tool- │ │
458
+ │ │ (30 rules) │ patterns.json│ classifications │ │
459
+ │ ├────────────┼──────────────┼───────────────────┤ │
460
+ │ │ toxic-flow │ rule- │ .mcp-shark/*.yaml │ │
461
+ │ │ rules.json │ sources.json │ (user overrides) │ │
462
+ │ └────────────┴──────────────┴───────────────────┘ │
463
+ ├────────────────────────────────────────────────────┤
464
+ │ JS plugins (11 rules needing algorithmic logic) │
465
+ │ + DeclarativeRuleEngine (30 pattern-based rules) │
466
+ └────────────────────────────────────────────────────┘
467
+ ```
468
+
469
+ **Design principles:**
470
+ - **Data-first** — Declarative rules, secret patterns, tool classifications, and toxic-flow defaults ship as JSON; **30** of **41** rules are pattern packs you can extend or override without forking those definitions.
471
+ - **User-overridable** — Built-in data can be extended via `.mcp-shark/*.yaml` (and JSON pack drops) as documented above.
472
+ - **Hybrid rule engine** — The other **11** rules are JS plugins where heuristics need code. Both sources are merged at scan time.
473
+ - **Zero-config scanning** — `npx` and go. Auto-detects the IDE paths below plus project-local `mcp.json` variants.
41
474
 
42
475
  ## Documentation
43
476
 
44
- ### Getting Started
45
- - **[Installation & Setup](docs/getting-started.md)** - Complete installation guide
46
- - **[Quick Start Guide](docs/getting-started.md#quick-start)** - Get up and running in minutes
47
-
48
- ### User Guides
49
- - **[Features](docs/features.md)** - Detailed feature documentation
50
- - **[User Guide](docs/user-guide.md)** - Complete guide to using MCP Shark
51
- - **[Local Analysis](docs/local-analysis.md)** - Static security analysis with YARA detection
52
- - **[Configuration](docs/configuration.md)** - Configuration options and file formats
53
- - **[Troubleshooting](docs/troubleshooting.md)** - Common issues and solutions
54
-
55
- ### Developer Guides
56
- - **[Development Guide](docs/development.md)** - Developer guide and contribution guidelines
57
- - **[Architecture](docs/architecture.md)** - System architecture and design
58
- - **[Database Architecture](docs/database-architecture.md)** - Database architecture and repository pattern
59
- - **[API Reference](docs/api-reference.md)** - API endpoints and WebSocket protocol
60
- - **API Documentation** - Interactive Swagger/OpenAPI documentation available at `/api-docs` when server is running (or click the menu button ☰ in the bottom-right corner, then select the API docs button 📡)
61
-
62
- ### Architecture & Coding Rules
63
- - **[Architecture Rules](rules/ARCHITECTURE_RULES.md)** - Architecture principles and guidelines
64
- - **[Database Architecture Rules](rules/DB_ARCHITECTURE.md)** - Database architecture rules
65
- - **[Coding Rules](rules/CODING_RULES.md)** - Coding standards and best practices
66
- - **[Linting Rules](rules/LINTING_RULES.md)** - Linting configuration and rules
477
+ - **[Rule pack registry](https://github.com/mcp-shark/rule-packs)** — Official `manifest.json` and JSON packs consumed by `update-rules`
478
+ - **[Getting Started](docs/getting-started.md)** Installation & setup
479
+ - **[Features](docs/features.md)** Detailed feature documentation
480
+ - **[User Guide](docs/user-guide.md)** — Complete usage guide
481
+ - **[Configuration](docs/configuration.md)** — Configuration files & environment variables
482
+ - **[Local Analysis](docs/local-analysis.md)** Static security analysis & YARA traffic rules
483
+ - **[AAuth Visibility](docs/aauth-visibility.md)** RFC 9421 / AAuth observability
484
+ - **[Architecture](docs/architecture.md)** System design
485
+ - **[Database Architecture](docs/database-architecture.md)** SQLite schema reference
486
+ - **[API Reference](docs/api-reference.md)** API endpoints
487
+ - **[Troubleshooting](docs/troubleshooting.md)** — Common issues & fixes
488
+ - **[Development](docs/development.md)** — Contributing & project conventions
489
+ - **[Package inspection](docs/package-inspection.md)** npm package layout
67
490
 
68
491
  ## Requirements
69
492
 
70
- - **Node.js**: 20.0.0 or higher (for npm package)
71
- - **Operating System**: macOS, Windows, or Linux
493
+ - **Node.js**: 20.0.0 or higher
494
+ - **OS**: macOS, Windows, or Linux
72
495
 
73
496
  ## License
74
497
 
75
498
  Source-Available Non-Commercial License
76
499
 
77
- This is not an OSI-approved open source license. The source code is available, but commercial use is prohibited without a separate commercial agreement.
500
+ - View, fork, modify, run for personal, educational, or internal company use
501
+ - ❌ Sell, resell, or integrate into paid products/services without written permission
502
+
503
+ See [LICENSE](LICENSE) for full terms.
78
504
 
79
- **Summary:**
80
- - ✅ **Allowed**: View, fork, modify, and run for personal, educational, or internal company use
81
- - ❌ **Not Allowed**: Sell, resell, or integrate into paid products/services without written permission
505
+ ## CLI demo
82
506
 
83
- See the [LICENSE](LICENSE) file for full terms and conditions.
507
+ Same one-liner as **[Quick Start](#quick-start)** (default `scan`). Terminal output depends on your config:
84
508
 
85
- ## Related Projects
509
+ ```bash
510
+ npx @mcp-shark/mcp-shark
511
+ ```
86
512
 
87
- - **[mcp-shark-site](https://github.com/mcp-shark/mcp-shark-site)**: Official website and documentation
88
- - **[smart-scan-web-app](https://github.com/mcp-shark/smart-scan-web-app)**: Smart Scan web interface
513
+ ![mcp-shark demo](docs/assets/demo.gif)
89
514
 
90
515
  ## Support
91
516
 
92
- - **Documentation**: [docs/](docs/)
93
517
  - **Issues**: [GitHub Issues](https://github.com/mcp-shark/mcp-shark/issues)
94
- - **Website**: [https://mcpshark.sh](https://mcpshark.sh)
518
+ - **Website**: [mcpshark.sh](https://mcpshark.sh)
95
519
 
96
520
  ---
97
521
 
98
- **Version**: 1.5.9 | **Homepage**: [https://mcpshark.sh](https://mcpshark.sh)
522
+ <div align="center">
523
+ <strong>MCP servers can chain through the agent — mcp-shark surfaces risky combinations in config and traffic.</strong>
524
+ </div>