@mcp-shark/mcp-shark 1.5.13 → 1.6.0
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.
- package/README.md +396 -59
- package/bin/mcp-shark.js +146 -52
- package/core/cli/AutoFixEngine.js +93 -0
- package/core/cli/ConfigScanner.js +193 -0
- package/core/cli/DataLoader.js +200 -0
- package/core/cli/DeclarativeRuleEngine.js +363 -0
- package/core/cli/DoctorCommand.js +218 -0
- package/core/cli/FixHandlers.js +222 -0
- package/core/cli/HtmlReportGenerator.js +203 -0
- package/core/cli/IdeConfigPaths.js +175 -0
- package/core/cli/ListCommand.js +224 -0
- package/core/cli/LockCommand.js +164 -0
- package/core/cli/LockDiffEngine.js +152 -0
- package/core/cli/RuleRegistryConfig.js +131 -0
- package/core/cli/ScanCommand.js +244 -0
- package/core/cli/ScanService.js +200 -0
- package/core/cli/SecretDetector.js +92 -0
- package/core/cli/SharkScoreCalculator.js +109 -0
- package/core/cli/ToolClassifications.js +51 -0
- package/core/cli/ToxicFlowAnalyzer.js +212 -0
- package/core/cli/UpdateCommand.js +188 -0
- package/core/cli/WalkthroughGenerator.js +195 -0
- package/core/cli/WatchCommand.js +129 -0
- package/core/cli/YamlRuleEngine.js +197 -0
- package/core/cli/data/rule-packs/agentic-security-2026.json +180 -0
- package/core/cli/data/rule-packs/general-security.json +173 -0
- package/core/cli/data/rule-packs/owasp-mcp-2026.json +244 -0
- package/core/cli/data/rule-packs/toxic-flow-heuristics.json +21 -0
- package/core/cli/data/rule-sources.json +5 -0
- package/core/cli/data/secret-patterns.json +18 -0
- package/core/cli/data/tool-classifications.json +111 -0
- package/core/cli/data/toxic-flow-rules.json +47 -0
- package/core/cli/index.js +23 -0
- package/core/cli/output/Banner.js +52 -0
- package/core/cli/output/Formatter.js +183 -0
- package/core/cli/output/JsonFormatter.js +106 -0
- package/core/cli/output/index.js +16 -0
- package/core/cli/secureRegistryFetch.js +157 -0
- package/core/cli/symbols.js +16 -0
- package/core/container/DependencyContainer.js +4 -1
- package/core/repositories/PacketRepository.js +16 -0
- package/core/services/AuditService.js +2 -0
- package/core/services/security/StaticRulesService.js +69 -13
- package/core/services/security/TrafficAnalysisService.js +19 -1
- package/core/services/security/TrafficToxicFlowService.js +154 -0
- package/core/services/security/index.js +2 -1
- package/core/services/security/rules/index.js +25 -59
- package/core/services/security/rules/scans/configPermissions.js +91 -0
- package/core/services/security/rules/scans/duplicateToolNames.js +85 -0
- package/core/services/security/rules/scans/insecureTransport.js +148 -0
- package/core/services/security/rules/scans/missingContainment.js +123 -0
- package/core/services/security/rules/scans/shellEnvInjection.js +101 -0
- package/core/services/security/rules/scans/unsafeDefaults.js +99 -0
- package/core/services/security/toolsListFromTrafficParser.js +70 -0
- package/core/tui/App.js +144 -0
- package/core/tui/FindingsPanel.js +115 -0
- package/core/tui/FixPanel.js +132 -0
- package/core/tui/Header.js +51 -0
- package/core/tui/HelpBar.js +42 -0
- package/core/tui/ServersPanel.js +109 -0
- package/core/tui/ToxicFlowsPanel.js +100 -0
- package/core/tui/h.js +8 -0
- package/core/tui/index.js +11 -0
- package/core/tui/render.js +22 -0
- package/package.json +24 -16
- package/ui/dist/assets/{index-CiCSDYf-.js → index-Buah4fNS.js} +32 -32
- package/ui/dist/index.html +1 -1
- package/ui/server/controllers/RequestController.js +9 -1
- package/ui/server/controllers/SecurityFindingsController.js +46 -1
- package/ui/server/routes/requests.js +8 -1
- package/ui/server/routes/security.js +5 -1
- package/ui/server/setup.js +2 -0
- package/ui/server/swagger/paths/components.js +55 -0
- package/ui/server/swagger/paths/securityTrafficFlows.js +59 -0
- package/ui/server/swagger/paths.js +2 -0
- package/ui/server/swagger/swagger.js +5 -1
- package/ui/src/Security.jsx +10 -0
- package/ui/src/components/Security/ScannerContent.jsx +30 -1
- package/ui/src/components/Security/TrafficToxicFlowsPanel.jsx +253 -0
- package/ui/src/components/Security/securityApi.js +15 -0
- package/ui/src/components/Security/useSecurity.js +60 -3
- package/core/services/security/rules/scans/agentic01GoalHijack.js +0 -130
- package/core/services/security/rules/scans/agentic02ToolMisuse.js +0 -129
- package/core/services/security/rules/scans/agentic03IdentityAbuse.js +0 -130
- package/core/services/security/rules/scans/agentic04SupplyChain.js +0 -130
- package/core/services/security/rules/scans/agentic06MemoryPoisoning.js +0 -130
- package/core/services/security/rules/scans/agentic07InsecureCommunication.js +0 -135
- package/core/services/security/rules/scans/agentic08CascadingFailures.js +0 -135
- package/core/services/security/rules/scans/agentic09TrustExploitation.js +0 -135
- package/core/services/security/rules/scans/agentic10RogueAgent.js +0 -130
- package/core/services/security/rules/scans/hardcodedSecrets.js +0 -130
- package/core/services/security/rules/scans/mcp01TokenMismanagement.js +0 -127
- package/core/services/security/rules/scans/mcp02ScopeCreep.js +0 -130
- package/core/services/security/rules/scans/mcp03ToolPoisoning.js +0 -132
- package/core/services/security/rules/scans/mcp04SupplyChain.js +0 -131
- package/core/services/security/rules/scans/mcp06PromptInjection.js +0 -200
- package/core/services/security/rules/scans/mcp07InsufficientAuth.js +0 -130
- package/core/services/security/rules/scans/mcp08LackAudit.js +0 -129
- package/core/services/security/rules/scans/mcp09ShadowServers.js +0 -129
- package/core/services/security/rules/scans/mcp10ContextInjection.js +0 -130
package/README.md
CHANGED
|
@@ -2,97 +2,434 @@
|
|
|
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
|
|
5
|
+
<h1>mcp-shark</h1>
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
<p><strong>Security scanner for AI agent tools</strong> — static analysis on MCP configs and tool metadata on your machine (findings, toxic-flow heuristics, CI-friendly outputs). Use the <strong>local HTTP proxy</strong> and <strong>monitoring UI</strong> to aggregate IDE traffic to multiple MCP servers and inspect requests and responses in one place.</p>
|
|
8
|
+
<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>
|
|
9
|
+
|
|
10
|
+
[](https://www.npmjs.com/package/@mcp-shark/mcp-shark)
|
|
11
|
+
[](LICENSE)
|
|
8
12
|
|
|
9
13
|
</div>
|
|
10
14
|
|
|
11
|
-
|
|
12
|
-
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npx @mcp-shark/mcp-shark
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+

|
|
22
|
+
|
|
23
|
+
## Why mcp-shark?
|
|
24
|
+
|
|
25
|
+
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.
|
|
26
|
+
|
|
27
|
+
mcp-shark runs on your machine — no API keys or hosted scan backend. Install with `npx` and review findings locally.
|
|
28
|
+
|
|
29
|
+
### Toxic flow analysis
|
|
30
|
+
|
|
31
|
+
The scanner models how MCP servers **compose in the agent context** and flags risky capability pairings (for example, secret access combined with external egress):
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
▲ HIGH notify-server → repo-server
|
|
35
|
+
Untrusted content in one tool’s channel could lead the agent to
|
|
36
|
+
take a destructive action in another (e.g. push code).
|
|
37
|
+
|
|
38
|
+
▲ MEDIUM browser-server → filesystem-server
|
|
39
|
+
Web-sourced context could be chained into local file operations.
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Use mcp-shark findings as input to your own threat model, not as a complete audit.
|
|
43
|
+
|
|
44
|
+
## Features
|
|
45
|
+
|
|
46
|
+
| Feature | Description |
|
|
47
|
+
|---------|-------------|
|
|
48
|
+
| **35 security rules** | OWASP MCP Top 10 + Agentic Security Initiative + general checks |
|
|
49
|
+
| **Toxic flow analysis** | Cross-server attack path detection from tool capability heuristics |
|
|
50
|
+
| **Attack walkthroughs** | Step-by-step exploit narratives from findings |
|
|
51
|
+
| **Shark Score** | Transparent security posture score (0-100, A-F) |
|
|
52
|
+
| **Auto-fix** | `--fix` replaces hardcoded secrets, fixes permissions, with backup/undo |
|
|
53
|
+
| **Tool pinning** | Git-committable `.mcp-shark.lock` with SHA-256 hashes |
|
|
54
|
+
| **15 IDE detection** | Cursor, Claude Desktop, VS Code, Windsurf, Codex, Amp, Kiro, and more |
|
|
55
|
+
| **4 output formats** | Terminal, JSON, SARIF v2.1.0, HTML |
|
|
56
|
+
| **Health checks** | `doctor` command for environment validation |
|
|
57
|
+
| **Server inventory** | `list` command shows all servers in a table |
|
|
58
|
+
| **Watch mode** | Live re-scan on config changes |
|
|
59
|
+
| **HTML reports** | Self-contained offline security reports |
|
|
60
|
+
| **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 |
|
|
61
|
+
| **YAML rules** | Per-project custom rules via `.mcp-shark/rules/` |
|
|
62
|
+
| **GitHub Action** | CI/CD integration with SARIF upload |
|
|
63
|
+
| **Interactive TUI** | lazygit-style terminal UI for scan, fix, and server browsing |
|
|
64
|
+
| **Web UI** | Wireshark-like monitoring interface |
|
|
65
|
+
| **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)) |
|
|
66
|
+
| **Local static scans** | No hosted scan backend; `update-rules` is opt-in HTTPS to the registry |
|
|
13
67
|
|
|
14
68
|
## Quick Start
|
|
15
69
|
|
|
16
|
-
**Run instantly with npx (no installation required):**
|
|
17
70
|
```bash
|
|
18
|
-
|
|
71
|
+
# Scan your MCP setup (default command)
|
|
72
|
+
npx @mcp-shark/mcp-shark
|
|
73
|
+
|
|
74
|
+
# Auto-fix issues (with interactive confirmation)
|
|
75
|
+
npx @mcp-shark/mcp-shark scan --fix
|
|
76
|
+
|
|
77
|
+
# See full attack chain narratives
|
|
78
|
+
npx @mcp-shark/mcp-shark scan --walkthrough
|
|
79
|
+
|
|
80
|
+
# Pin tool definitions (lockfile) to spot unexpected changes
|
|
81
|
+
npx @mcp-shark/mcp-shark lock
|
|
82
|
+
|
|
83
|
+
# Check environment health
|
|
84
|
+
npx @mcp-shark/mcp-shark doctor
|
|
85
|
+
|
|
86
|
+
# Show all detected servers
|
|
87
|
+
npx @mcp-shark/mcp-shark list
|
|
88
|
+
|
|
89
|
+
# Download latest rule packs (OWASP, Agentic Security)
|
|
90
|
+
npx @mcp-shark/mcp-shark update-rules
|
|
91
|
+
|
|
92
|
+
# Watch for config changes
|
|
93
|
+
npx @mcp-shark/mcp-shark watch
|
|
94
|
+
|
|
95
|
+
# Interactive terminal UI
|
|
96
|
+
npx @mcp-shark/mcp-shark tui
|
|
97
|
+
|
|
98
|
+
# Generate HTML report
|
|
99
|
+
npx @mcp-shark/mcp-shark scan --format html --output report.html
|
|
100
|
+
|
|
101
|
+
# CI mode (exits 1 on critical/high)
|
|
102
|
+
npx @mcp-shark/mcp-shark scan --ci --format sarif
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Commands
|
|
106
|
+
|
|
107
|
+
| Command | Description |
|
|
108
|
+
|---------|-------------|
|
|
109
|
+
| `scan` (default) | Run security scan with 35 rules |
|
|
110
|
+
| `lock` | Create `.mcp-shark.lock` file |
|
|
111
|
+
| `lock --verify` | Verify current state matches lockfile |
|
|
112
|
+
| `diff` | Show tool definition changes since last lock |
|
|
113
|
+
| `doctor` | Run environment health checks |
|
|
114
|
+
| `list` | Show inventory of all detected servers (`--format json` supported) |
|
|
115
|
+
| `update-rules` | Download latest rule packs from remote registry |
|
|
116
|
+
| `watch` | Watch config files and re-scan on changes |
|
|
117
|
+
| `tui` | Interactive terminal UI (lazygit-style) |
|
|
118
|
+
| `serve` | Start the web monitoring UI |
|
|
119
|
+
|
|
120
|
+
## CLI flags
|
|
121
|
+
|
|
122
|
+
### `scan` (default command)
|
|
123
|
+
|
|
124
|
+
| Flag | Description |
|
|
125
|
+
|------|-------------|
|
|
126
|
+
| `--fix` | Auto-fix issues (interactive confirmation) |
|
|
127
|
+
| `--fix --yes` | Auto-fix without prompting |
|
|
128
|
+
| `--fix --undo` | Restore backups from previous fix |
|
|
129
|
+
| `--walkthrough` | Show full attack chain narratives |
|
|
130
|
+
| `--ci` | CI mode: exit code 1 on critical/high |
|
|
131
|
+
| `--format <fmt>` | Output: `terminal`, `json`, `sarif`, `html` |
|
|
132
|
+
| `--output <path>` | Write report to file (for `html` format) |
|
|
133
|
+
| `--strict` | Count advisory findings in score |
|
|
134
|
+
| `--ide <name>` | Scan specific IDE only |
|
|
135
|
+
| `--rules <path>` | Load custom YAML rules from directory |
|
|
136
|
+
| `--refresh-rules` | Fetch rule packs from registry before scan (HTTPS; see rule registry config) |
|
|
137
|
+
|
|
138
|
+
### Other commands
|
|
139
|
+
|
|
140
|
+
| Command | Flags / notes |
|
|
141
|
+
|---------|----------------|
|
|
142
|
+
| `list` | `--format terminal` or `--format json` |
|
|
143
|
+
| `update-rules` | `--source <url>` for a custom pack manifest |
|
|
144
|
+
| `serve` | `--open` / `-o` to open the browser |
|
|
145
|
+
| `lock` | `--verify` to check lockfile match |
|
|
146
|
+
|
|
147
|
+
## How `scan` works
|
|
148
|
+
|
|
149
|
+
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`.
|
|
150
|
+
|
|
151
|
+
- **Always scanned:** each server block’s `command`, `args`, `env`, `url`, and related fields (secrets in `env`, unsafe spawn patterns, HTTP URLs, etc.).
|
|
152
|
+
- **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.
|
|
153
|
+
|
|
154
|
+
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`).
|
|
155
|
+
|
|
156
|
+
## What it covers
|
|
157
|
+
|
|
158
|
+
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.
|
|
159
|
+
|
|
160
|
+
| Area | Notes |
|
|
161
|
+
|------|--------|
|
|
162
|
+
| Install / run | Node.js 20+; `npx @mcp-shark/mcp-shark` |
|
|
163
|
+
| Security rules | 35 checks — 24 declarative JSON packs, 11 JS where heuristics need code |
|
|
164
|
+
| Toxic flow analysis | Heuristic cross-server paths; quality depends on embedded `tools` / classifications |
|
|
165
|
+
| Attack walkthroughs | Narratives derived from findings |
|
|
166
|
+
| Auto-fix | Supported for a subset of issues; confirm changes in your repo |
|
|
167
|
+
| Tool pinning | `.mcp-shark.lock` with SHA-256 hashes |
|
|
168
|
+
| Live traffic | Web UI (`serve`) for monitoring; separate from static `scan` |
|
|
169
|
+
| Custom rules | YAML under `.mcp-shark/rules/` and JSON rule packs |
|
|
170
|
+
| Findings & score | confirmed / advisory tiers plus Shark Score (0–100, A–F) |
|
|
171
|
+
| IDE configs | 15 built-in paths + project-local `mcp.json` variants — see [Supported IDEs](#supported-ides) |
|
|
172
|
+
| Output | Terminal, JSON, SARIF v2.1.0, HTML |
|
|
173
|
+
| Health | `doctor` for environment checks |
|
|
174
|
+
| CI | `scan --ci` and optional [GitHub Action](#github-action) |
|
|
175
|
+
| Watch | Re-scan when config files change |
|
|
176
|
+
| Rule updates | `update-rules` (optional HTTPS fetch; static scan works without it) |
|
|
177
|
+
|
|
178
|
+
## Rule Extensibility
|
|
179
|
+
|
|
180
|
+
### Downloadable Rule Packs (JSON)
|
|
181
|
+
|
|
182
|
+
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/`.
|
|
183
|
+
|
|
184
|
+
mcp-shark ships with 24 declarative rules as JSON packs (OWASP MCP, Agentic Security Initiative, General Security), 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.
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
# Fetch latest rule packs from the registry
|
|
188
|
+
npx @mcp-shark/mcp-shark update-rules
|
|
189
|
+
|
|
190
|
+
# Use a custom/enterprise registry
|
|
191
|
+
npx @mcp-shark/mcp-shark update-rules --source https://internal.corp/rules/manifest.json
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Downloaded packs are cached in `.mcp-shark/rule-packs/` and merged with built-in rules on every scan.
|
|
195
|
+
|
|
196
|
+
<details>
|
|
197
|
+
<summary>Rule pack JSON schema</summary>
|
|
198
|
+
|
|
199
|
+
```json
|
|
200
|
+
{
|
|
201
|
+
"id": "owasp-mcp-2027",
|
|
202
|
+
"name": "OWASP MCP Top 10 (2027)",
|
|
203
|
+
"version": "1.0.0",
|
|
204
|
+
"rules": [
|
|
205
|
+
{
|
|
206
|
+
"id": "MCP01-token-mismanagement",
|
|
207
|
+
"name": "Token Mismanagement",
|
|
208
|
+
"severity": "critical",
|
|
209
|
+
"framework": "OWASP-MCP",
|
|
210
|
+
"description": "Detects hardcoded tokens in MCP configs",
|
|
211
|
+
"patterns": [
|
|
212
|
+
{ "regex": "(api[_-]?key|token)\\s*[:=]", "flags": "i", "label": "API key pattern" }
|
|
213
|
+
],
|
|
214
|
+
"scope": ["tool", "prompt", "resource", "packet"],
|
|
215
|
+
"exclude_patterns": [{ "regex": "\\$\\{|process\\.env" }],
|
|
216
|
+
"match_mode": "any"
|
|
217
|
+
}
|
|
218
|
+
]
|
|
219
|
+
}
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
</details>
|
|
223
|
+
|
|
224
|
+
### Custom YAML Rules (per-project)
|
|
225
|
+
|
|
226
|
+
Create `.mcp-shark/rules/` in your project to add lightweight custom rules:
|
|
227
|
+
|
|
228
|
+
```yaml
|
|
229
|
+
# .mcp-shark/rules/no-production-keys.yaml
|
|
230
|
+
id: custom-no-prod-keys
|
|
231
|
+
name: No Production Keys
|
|
232
|
+
severity: critical
|
|
233
|
+
description: Detects production API keys in MCP configs
|
|
234
|
+
match:
|
|
235
|
+
env_pattern: "^(PROD_|PRODUCTION_)"
|
|
236
|
+
value_pattern: "^sk-live|^pk-live"
|
|
237
|
+
message: "Production key detected in {key} — use staging keys for development"
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
Both YAML rules and JSON packs are loaded automatically on scan. Share them with your team by committing the folder.
|
|
241
|
+
|
|
242
|
+
### User-Overridable Data (`.mcp-shark/`)
|
|
243
|
+
|
|
244
|
+
Every built-in data source can be extended or overridden through YAML files in your project root:
|
|
245
|
+
|
|
246
|
+
| File | Overrides | Format |
|
|
247
|
+
|------|-----------|--------|
|
|
248
|
+
| `.mcp-shark/secrets.yaml` | Secret detection patterns | List of `{ name, regex }` |
|
|
249
|
+
| `.mcp-shark/classifications.yaml` | Server/tool capability tags | Nested map `server: { capability: true }` |
|
|
250
|
+
| `.mcp-shark/flows.yaml` | Toxic flow rules | List of `{ source_cap, target_cap, risk, ... }` |
|
|
251
|
+
| `.mcp-shark/rules/*.yaml` | Custom per-project rules | See YAML Rules above |
|
|
252
|
+
| `.mcp-shark/rule-packs/*.json` | Override or add declarative packs | See JSON Packs above |
|
|
253
|
+
|
|
254
|
+
User data is merged with built-in data at scan time. No rebuild required.
|
|
255
|
+
|
|
256
|
+
## GitHub Action
|
|
257
|
+
|
|
258
|
+
```yaml
|
|
259
|
+
# .github/workflows/mcp-security.yml
|
|
260
|
+
name: MCP Security Scan
|
|
261
|
+
on: [push, pull_request]
|
|
262
|
+
jobs:
|
|
263
|
+
scan:
|
|
264
|
+
runs-on: ubuntu-latest
|
|
265
|
+
steps:
|
|
266
|
+
- uses: actions/checkout@v4
|
|
267
|
+
- uses: mcp-shark/scan-action@v1
|
|
268
|
+
with:
|
|
269
|
+
format: sarif
|
|
270
|
+
fail-on: high
|
|
271
|
+
- uses: github/codeql-action/upload-sarif@v3
|
|
272
|
+
if: always()
|
|
273
|
+
with:
|
|
274
|
+
sarif_file: mcp-shark-results.sarif
|
|
19
275
|
```
|
|
20
276
|
|
|
21
|
-
|
|
277
|
+
## Supported IDEs
|
|
278
|
+
|
|
279
|
+
| IDE | Config Path | Status |
|
|
280
|
+
|-----|-------------|--------|
|
|
281
|
+
| Cursor | `~/.cursor/mcp.json` | ✅ |
|
|
282
|
+
| Claude Desktop | `~/Library/.../claude_desktop_config.json` | ✅ |
|
|
283
|
+
| Claude Code | `~/.claude.json` | ✅ |
|
|
284
|
+
| VS Code | `~/.vscode/mcp.json` | ✅ |
|
|
285
|
+
| Windsurf | `~/.codeium/windsurf/mcp_config.json` | ✅ |
|
|
286
|
+
| Codex | `~/.codex/config.toml` | ✅ |
|
|
287
|
+
| Gemini CLI | `~/.gemini/settings.json` | ✅ |
|
|
288
|
+
| Continue | `~/.continue/config.json` | ✅ |
|
|
289
|
+
| Cline | `~/.../saoudrizwan.claude-dev/.../cline_mcp_settings.json` | ✅ |
|
|
290
|
+
| Amp | `~/.amp/mcp.json` | ✅ |
|
|
291
|
+
| Kiro | `~/.kiro/mcp.json` | ✅ |
|
|
292
|
+
| Zed | `~/.config/zed/settings.json` | ✅ |
|
|
293
|
+
| Augment | `~/.augment/mcp.json` | ✅ |
|
|
294
|
+
| Roo Code | `~/.roo-code/mcp.json` | ✅ |
|
|
295
|
+
| Project (local) | `./mcp.json`, `./.mcp.json`, `./.mcp/config.json` | ✅ |
|
|
296
|
+
|
|
297
|
+
## Security Rules (35)
|
|
298
|
+
|
|
299
|
+
<details>
|
|
300
|
+
<summary>Full rule list</summary>
|
|
301
|
+
|
|
302
|
+
### OWASP MCP Top 10
|
|
303
|
+
| ID | Rule | Severity |
|
|
304
|
+
|----|------|----------|
|
|
305
|
+
| MCP01 | Token Mismanagement | Critical |
|
|
306
|
+
| MCP02 | Scope Creep | High |
|
|
307
|
+
| MCP03 | Tool Poisoning | Critical |
|
|
308
|
+
| MCP04 | Supply Chain | High |
|
|
309
|
+
| MCP05 | Command Injection | Critical |
|
|
310
|
+
| MCP06 | Prompt Injection | High |
|
|
311
|
+
| MCP07 | Insufficient Auth | High |
|
|
312
|
+
| MCP08 | Lack of Audit | Medium |
|
|
313
|
+
| MCP09 | Shadow Servers | High |
|
|
314
|
+
| MCP10 | Context Injection | High |
|
|
315
|
+
|
|
316
|
+
### Agentic Security Initiative (ASI)
|
|
317
|
+
| ID | Rule | Severity |
|
|
318
|
+
|----|------|----------|
|
|
319
|
+
| ASI01 | Goal Hijack | Critical |
|
|
320
|
+
| ASI02 | Tool Misuse | High |
|
|
321
|
+
| ASI03 | Identity Abuse | High |
|
|
322
|
+
| ASI04 | Supply Chain | High |
|
|
323
|
+
| ASI05 | Remote Code Execution | Critical |
|
|
324
|
+
| ASI06 | Memory Poisoning | High |
|
|
325
|
+
| ASI07 | Insecure Communication | Medium |
|
|
326
|
+
| ASI08 | Cascading Failures | Medium |
|
|
327
|
+
| ASI09 | Trust Exploitation | High |
|
|
328
|
+
| ASI10 | Rogue Agent | Critical |
|
|
329
|
+
|
|
330
|
+
### General Security
|
|
331
|
+
| Rule | Severity |
|
|
332
|
+
|------|----------|
|
|
333
|
+
| Hardcoded Secrets | Critical |
|
|
334
|
+
| Command Injection | Critical |
|
|
335
|
+
| Cross-Server Shadowing | High |
|
|
336
|
+
| Tool Name Ambiguity | Medium |
|
|
337
|
+
| DNS Rebinding | High |
|
|
338
|
+
| ANSI Escape Sequences | Medium |
|
|
339
|
+
| Config File Permissions | Medium |
|
|
340
|
+
| Missing Containment | High |
|
|
341
|
+
| Duplicate Tool Names | Medium |
|
|
342
|
+
| Shell/Env Injection | High |
|
|
343
|
+
| Excessive Permissions | High |
|
|
344
|
+
| Unsafe Default Config | Medium |
|
|
345
|
+
| Path Traversal | High |
|
|
346
|
+
| Sensitive Data Exposure | High |
|
|
347
|
+
| Insecure Transport | Medium |
|
|
348
|
+
|
|
349
|
+
</details>
|
|
350
|
+
|
|
351
|
+
## Web UI
|
|
352
|
+
|
|
353
|
+
MCP Shark also includes a Wireshark-like web interface for real-time MCP traffic monitoring:
|
|
354
|
+
|
|
355
|
+
```bash
|
|
356
|
+
npx @mcp-shark/mcp-shark serve --open
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
Same as the older shortcut (no `serve` subcommand):
|
|
22
360
|
|
|
23
|
-
**Or install globally:**
|
|
24
361
|
```bash
|
|
25
|
-
|
|
26
|
-
mcp-shark --open
|
|
362
|
+
npx @mcp-shark/mcp-shark --open
|
|
27
363
|
```
|
|
28
364
|
|
|
29
|
-
|
|
365
|
+
The web UI provides:
|
|
366
|
+
- Multi-server aggregation and real-time monitoring
|
|
367
|
+
- Interactive playground for testing tools, prompts, and resources
|
|
368
|
+
- Local security analysis with pattern-based detection
|
|
369
|
+
- API documentation with interactive testing
|
|
30
370
|
|
|
31
|
-
|
|
371
|
+
## Architecture
|
|
372
|
+
|
|
373
|
+
```
|
|
374
|
+
┌────────────────────────────────────────────────────┐
|
|
375
|
+
│ CLI (Commander.js) │
|
|
376
|
+
│ scan · lock · diff · doctor · list · watch · tui │
|
|
377
|
+
│ update-rules · serve │
|
|
378
|
+
├──────────────┬──────────────┬──────────────────────┤
|
|
379
|
+
│ ConfigScanner│ ScanService │ StaticRulesService │
|
|
380
|
+
│ 15 IDEs │ orchestrator │ 35 rules │
|
|
381
|
+
├──────────────┴──────────────┴──────────────────────┤
|
|
382
|
+
│ Data layer (JSON + user YAML/JSON overrides) │
|
|
383
|
+
│ ┌────────────┬──────────────┬───────────────────┐ │
|
|
384
|
+
│ │ rule-packs │ secret- │ tool- │ │
|
|
385
|
+
│ │ (24 rules) │ patterns.json│ classifications │ │
|
|
386
|
+
│ ├────────────┼──────────────┼───────────────────┤ │
|
|
387
|
+
│ │ toxic-flow │ rule- │ .mcp-shark/*.yaml │ │
|
|
388
|
+
│ │ rules.json │ sources.json │ (user overrides) │ │
|
|
389
|
+
│ └────────────┴──────────────┴───────────────────┘ │
|
|
390
|
+
├────────────────────────────────────────────────────┤
|
|
391
|
+
│ JS plugins (11 rules needing algorithmic logic) │
|
|
392
|
+
│ + DeclarativeRuleEngine (24 pattern-based rules) │
|
|
393
|
+
└────────────────────────────────────────────────────┘
|
|
394
|
+
```
|
|
32
395
|
|
|
33
|
-
|
|
34
|
-
- **
|
|
35
|
-
- **
|
|
36
|
-
- **
|
|
37
|
-
- **
|
|
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
|
|
396
|
+
**Design principles:**
|
|
397
|
+
- **Data-first** — Declarative rules, secret patterns, tool classifications, and toxic-flow defaults ship as JSON; **24** of **35** rules are pattern packs you can extend or override without forking those definitions.
|
|
398
|
+
- **User-overridable** — Built-in data can be extended via `.mcp-shark/*.yaml` (and JSON pack drops) as documented above.
|
|
399
|
+
- **Hybrid rule engine** — The other **11** rules are JS plugins where heuristics need code. Both sources are merged at scan time.
|
|
400
|
+
- **Zero-config scanning** — `npx` and go. Auto-detects the IDE paths below plus project-local `mcp.json` variants.
|
|
41
401
|
|
|
42
402
|
## Documentation
|
|
43
403
|
|
|
44
|
-
|
|
45
|
-
- **[
|
|
46
|
-
- **[
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
- **[
|
|
50
|
-
- **[
|
|
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
|
|
404
|
+
- **[Rule pack registry](https://github.com/mcp-shark/rule-packs)** — Official `manifest.json` and JSON packs consumed by `update-rules`
|
|
405
|
+
- **[Getting Started](docs/getting-started.md)** — Installation & setup
|
|
406
|
+
- **[Features](docs/features.md)** — Detailed feature documentation
|
|
407
|
+
- **[User Guide](docs/user-guide.md)** — Complete usage guide
|
|
408
|
+
- **[Local Analysis](docs/local-analysis.md)** — Static security analysis
|
|
409
|
+
- **[Architecture](docs/architecture.md)** — System design
|
|
410
|
+
- **[API Reference](docs/api-reference.md)** — API endpoints
|
|
67
411
|
|
|
68
412
|
## Requirements
|
|
69
413
|
|
|
70
|
-
- **Node.js**: 20.0.0 or higher
|
|
71
|
-
- **
|
|
414
|
+
- **Node.js**: 20.0.0 or higher
|
|
415
|
+
- **OS**: macOS, Windows, or Linux
|
|
72
416
|
|
|
73
417
|
## License
|
|
74
418
|
|
|
75
419
|
Source-Available Non-Commercial License
|
|
76
420
|
|
|
77
|
-
|
|
421
|
+
- ✅ View, fork, modify, run for personal, educational, or internal company use
|
|
422
|
+
- ❌ Sell, resell, or integrate into paid products/services without written permission
|
|
78
423
|
|
|
79
|
-
|
|
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
|
|
82
|
-
|
|
83
|
-
See the [LICENSE](LICENSE) file for full terms and conditions.
|
|
84
|
-
|
|
85
|
-
## Related Projects
|
|
86
|
-
|
|
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
|
|
424
|
+
See [LICENSE](LICENSE) for full terms.
|
|
89
425
|
|
|
90
426
|
## Support
|
|
91
427
|
|
|
92
|
-
- **Documentation**: [docs/](docs/)
|
|
93
428
|
- **Issues**: [GitHub Issues](https://github.com/mcp-shark/mcp-shark/issues)
|
|
94
|
-
- **Website**: [
|
|
429
|
+
- **Website**: [mcpshark.sh](https://mcpshark.sh)
|
|
95
430
|
|
|
96
431
|
---
|
|
97
432
|
|
|
98
|
-
|
|
433
|
+
<div align="center">
|
|
434
|
+
<strong>MCP servers can chain through the agent — mcp-shark surfaces risky combinations in config and traffic.</strong>
|
|
435
|
+
</div>
|