mcp-security-check 0.1.0__tar.gz
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.
- mcp_security_check-0.1.0/LICENSE +21 -0
- mcp_security_check-0.1.0/PKG-INFO +398 -0
- mcp_security_check-0.1.0/README.md +384 -0
- mcp_security_check-0.1.0/pyproject.toml +37 -0
- mcp_security_check-0.1.0/setup.cfg +4 -0
- mcp_security_check-0.1.0/src/mcp_security/__init__.py +10 -0
- mcp_security_check-0.1.0/src/mcp_security/analyzers/__init__.py +4 -0
- mcp_security_check-0.1.0/src/mcp_security/analyzers/attack_paths.py +106 -0
- mcp_security_check-0.1.0/src/mcp_security/analyzers/capabilities.py +219 -0
- mcp_security_check-0.1.0/src/mcp_security/analyzers/permissions.py +57 -0
- mcp_security_check-0.1.0/src/mcp_security/analyzers/provenance.py +57 -0
- mcp_security_check-0.1.0/src/mcp_security/analyzers/secrets.py +159 -0
- mcp_security_check-0.1.0/src/mcp_security/cli.py +160 -0
- mcp_security_check-0.1.0/src/mcp_security/diff/__init__.py +3 -0
- mcp_security_check-0.1.0/src/mcp_security/diff/capability_diff.py +146 -0
- mcp_security_check-0.1.0/src/mcp_security/discovery/files.py +93 -0
- mcp_security_check-0.1.0/src/mcp_security/discovery/mcp.py +166 -0
- mcp_security_check-0.1.0/src/mcp_security/engine.py +153 -0
- mcp_security_check-0.1.0/src/mcp_security/github/__init__.py +3 -0
- mcp_security_check-0.1.0/src/mcp_security/github/annotations.py +42 -0
- mcp_security_check-0.1.0/src/mcp_security/model/__init__.py +13 -0
- mcp_security_check-0.1.0/src/mcp_security/model/capability.py +91 -0
- mcp_security_check-0.1.0/src/mcp_security/model/component.py +47 -0
- mcp_security_check-0.1.0/src/mcp_security/model/finding.py +99 -0
- mcp_security_check-0.1.0/src/mcp_security/model/report.py +119 -0
- mcp_security_check-0.1.0/src/mcp_security/output/__init__.py +5 -0
- mcp_security_check-0.1.0/src/mcp_security/output/markdown.py +105 -0
- mcp_security_check-0.1.0/src/mcp_security/output/sarif.py +82 -0
- mcp_security_check-0.1.0/src/mcp_security/output/terminal.py +59 -0
- mcp_security_check-0.1.0/src/mcp_security/parsers/__init__.py +4 -0
- mcp_security_check-0.1.0/src/mcp_security/parsers/json_parser.py +219 -0
- mcp_security_check-0.1.0/src/mcp_security/parsers/skill_parser.py +18 -0
- mcp_security_check-0.1.0/src/mcp_security/parsers/yaml_parser.py +80 -0
- mcp_security_check-0.1.0/src/mcp_security/policy.py +134 -0
- mcp_security_check-0.1.0/src/mcp_security/redaction.py +133 -0
- mcp_security_check-0.1.0/src/mcp_security/rules/__init__.py +66 -0
- mcp_security_check-0.1.0/src/mcp_security/rules/base.py +66 -0
- mcp_security_check-0.1.0/src/mcp_security/rules/combinations.py +111 -0
- mcp_security_check-0.1.0/src/mcp_security/rules/credentials.py +159 -0
- mcp_security_check-0.1.0/src/mcp_security/rules/dangerous_tools.py +270 -0
- mcp_security_check-0.1.0/src/mcp_security/rules/filesystem.py +43 -0
- mcp_security_check-0.1.0/src/mcp_security/rules/network.py +43 -0
- mcp_security_check-0.1.0/src/mcp_security/rules/shell.py +47 -0
- mcp_security_check-0.1.0/src/mcp_security/scoring/__init__.py +4 -0
- mcp_security_check-0.1.0/src/mcp_security/scoring/risk.py +75 -0
- mcp_security_check-0.1.0/src/mcp_security/scoring/trust.py +23 -0
- mcp_security_check-0.1.0/src/mcp_security_check.egg-info/PKG-INFO +398 -0
- mcp_security_check-0.1.0/src/mcp_security_check.egg-info/SOURCES.txt +65 -0
- mcp_security_check-0.1.0/src/mcp_security_check.egg-info/dependency_links.txt +1 -0
- mcp_security_check-0.1.0/src/mcp_security_check.egg-info/entry_points.txt +2 -0
- mcp_security_check-0.1.0/src/mcp_security_check.egg-info/requires.txt +4 -0
- mcp_security_check-0.1.0/src/mcp_security_check.egg-info/top_level.txt +1 -0
- mcp_security_check-0.1.0/tests/test_attack_paths.py +59 -0
- mcp_security_check-0.1.0/tests/test_audit_regressions.py +450 -0
- mcp_security_check-0.1.0/tests/test_capabilities.py +121 -0
- mcp_security_check-0.1.0/tests/test_cli.py +137 -0
- mcp_security_check-0.1.0/tests/test_diff.py +85 -0
- mcp_security_check-0.1.0/tests/test_discovery.py +155 -0
- mcp_security_check-0.1.0/tests/test_outputs.py +170 -0
- mcp_security_check-0.1.0/tests/test_parsers.py +344 -0
- mcp_security_check-0.1.0/tests/test_permissions.py +78 -0
- mcp_security_check-0.1.0/tests/test_realistic_configs.py +37 -0
- mcp_security_check-0.1.0/tests/test_redaction.py +119 -0
- mcp_security_check-0.1.0/tests/test_regressions.py +279 -0
- mcp_security_check-0.1.0/tests/test_scoring.py +95 -0
- mcp_security_check-0.1.0/tests/test_secret_url_analysis.py +80 -0
- mcp_security_check-0.1.0/tests/test_secret_value_analysis.py +61 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 MCP Security Check Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mcp-security-check
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Scan MCP servers, AI-agent permissions and attack paths before merging a GitHub pull request.
|
|
5
|
+
Author: MCP Security Check Contributors
|
|
6
|
+
License: MIT
|
|
7
|
+
Requires-Python: >=3.11
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Dist: PyYAML>=6.0
|
|
11
|
+
Provides-Extra: dev
|
|
12
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
13
|
+
Dynamic: license-file
|
|
14
|
+
|
|
15
|
+
# MCP Security Check for GitHub
|
|
16
|
+
|
|
17
|
+
Scan MCP servers, AI-agent permissions and attack paths before merging a GitHub pull request.
|
|
18
|
+
|
|
19
|
+
## 1. What it is
|
|
20
|
+
|
|
21
|
+
MCP Security Check is an offline, GitHub-native security analysis engine for
|
|
22
|
+
[Model Context Protocol](https://modelcontextprotocol.io) (MCP) configuration.
|
|
23
|
+
It inspects MCP server definitions found in a repository, extracts a normalized
|
|
24
|
+
set of **capabilities** (what a server can actually *do* — read files, execute
|
|
25
|
+
shell commands, reach the network, read secrets, ...), and evaluates them
|
|
26
|
+
against a rule engine, an attack-path engine, and a capability-diff engine.
|
|
27
|
+
|
|
28
|
+
It runs as a CLI, a GitHub Action, and produces JSON, SARIF, and PR-friendly
|
|
29
|
+
Markdown output.
|
|
30
|
+
|
|
31
|
+
## 2. Why it exists
|
|
32
|
+
|
|
33
|
+
MCP servers and AI-agent tool configurations can grant an agent powerful,
|
|
34
|
+
composable capabilities — shell execution, filesystem write, secret access,
|
|
35
|
+
unrestricted network egress. Individually these can be legitimate. Combined,
|
|
36
|
+
they frequently form a realistic attack path (e.g. "read secrets, then reach
|
|
37
|
+
an external network" = exfiltration). Most existing scanners only pattern-match
|
|
38
|
+
individual strings. This project's core differentiator is comparing **BASE vs
|
|
39
|
+
HEAD** capability sets on a pull request and flagging *newly introduced*
|
|
40
|
+
dangerous capabilities and combinations before merge — not just scanning a
|
|
41
|
+
snapshot.
|
|
42
|
+
|
|
43
|
+
## 3. What it detects
|
|
44
|
+
|
|
45
|
+
- Individual dangerous capabilities (shell execution, unrestricted filesystem
|
|
46
|
+
write, unrestricted network, secret/credential access, dynamic code
|
|
47
|
+
execution, remote script execution, ...)
|
|
48
|
+
- Dangerous **combinations** of capabilities on the same component
|
|
49
|
+
- **Newly introduced** capabilities in a pull request (capability diff)
|
|
50
|
+
- Multi-step **attack paths** (e.g. `filesystem.write → shell.execute →
|
|
51
|
+
network.external`)
|
|
52
|
+
- Suspicious configuration signals (obfuscated content, external instruction
|
|
53
|
+
fetching, unpinned dependencies, unverified/unknown-publisher remote
|
|
54
|
+
sources, possible hardcoded secrets)
|
|
55
|
+
|
|
56
|
+
See [Rules](#8-rules) and [Attack paths](#9-attack-path-engine) below for the
|
|
57
|
+
full list.
|
|
58
|
+
|
|
59
|
+
## 4. Example security report
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
MCP SECURITY CHECK
|
|
63
|
+
|
|
64
|
+
Decision: BLOCK
|
|
65
|
+
Risk Score: 87/100
|
|
66
|
+
|
|
67
|
+
Critical: 1
|
|
68
|
+
High: 2
|
|
69
|
+
Medium: 3
|
|
70
|
+
Low: 1
|
|
71
|
+
|
|
72
|
+
Permission Changes:
|
|
73
|
+
|
|
74
|
+
+ filesystem.write
|
|
75
|
+
+ shell.execute
|
|
76
|
+
+ network.external
|
|
77
|
+
|
|
78
|
+
Attack Paths:
|
|
79
|
+
|
|
80
|
+
[CRITICAL] filesystem.write → shell.execute → network.external
|
|
81
|
+
Critical multi-step attack path: ...
|
|
82
|
+
|
|
83
|
+
Findings:
|
|
84
|
+
|
|
85
|
+
MSC001 [HIGH] Arbitrary Shell Execution (mcp.json)
|
|
86
|
+
MSC005 [CRITICAL] Shell Execution + External Network (mcp.json)
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
A GitHub PR comment (Markdown) rendering of the same report is shown further
|
|
90
|
+
down in this document, in [examples/github-action.yml](examples/github-action.yml)
|
|
91
|
+
usage and [examples/dangerous-mcp.json](examples/dangerous-mcp.json).
|
|
92
|
+
|
|
93
|
+
## 5. GitHub Action installation
|
|
94
|
+
|
|
95
|
+
```yaml
|
|
96
|
+
name: MCP Security
|
|
97
|
+
|
|
98
|
+
on:
|
|
99
|
+
pull_request:
|
|
100
|
+
|
|
101
|
+
permissions:
|
|
102
|
+
contents: read
|
|
103
|
+
security-events: write
|
|
104
|
+
|
|
105
|
+
jobs:
|
|
106
|
+
security:
|
|
107
|
+
runs-on: ubuntu-latest
|
|
108
|
+
steps:
|
|
109
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
|
|
110
|
+
with:
|
|
111
|
+
path: head
|
|
112
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
|
|
113
|
+
with:
|
|
114
|
+
ref: ${{ github.event.pull_request.base.sha }}
|
|
115
|
+
path: base
|
|
116
|
+
|
|
117
|
+
- name: MCP Security Check
|
|
118
|
+
id: mcp_check
|
|
119
|
+
uses: rudimentall1/MCP-Security-Check-for-GitHub@54a16d2968ef7ac30be6260e70157ada75819759
|
|
120
|
+
with:
|
|
121
|
+
path: head
|
|
122
|
+
base-path: base
|
|
123
|
+
fail-on: critical
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
This quick start pins a reviewed commit SHA rather than an unpublished version tag.
|
|
127
|
+
Update that SHA deliberately after reviewing a newer commit.
|
|
128
|
+
|
|
129
|
+
See [action.yml](action.yml) for all inputs/outputs and
|
|
130
|
+
[examples/github-action.yml](examples/github-action.yml) for a complete
|
|
131
|
+
workflow including SARIF upload, a PR comment, and the `push`/manual-trigger
|
|
132
|
+
fallback (the minimal example above assumes a `pull_request` trigger with
|
|
133
|
+
both BASE and HEAD checked out). The full example skips SARIF upload and PR
|
|
134
|
+
comments for fork-originated PRs, whose token is read-only.
|
|
135
|
+
|
|
136
|
+
Inputs: `path`, `base-path` (optional — when set, runs a capability diff
|
|
137
|
+
instead of a single-tree scan; see the comment in
|
|
138
|
+
[action.yml](action.yml) on how BASE/HEAD are obtained and the documented
|
|
139
|
+
fallback behavior for non-PR triggers), `config`, `format`, `fail-on`.
|
|
140
|
+
|
|
141
|
+
Outputs: `decision`, `risk-score`, `report-path`, `sarif-path`. All four are
|
|
142
|
+
produced by a **single** internal `mcp-security-check` invocation (scan or
|
|
143
|
+
diff) so they can never disagree with each other — the Action never re-runs
|
|
144
|
+
the analysis to compute outputs separately from the report it writes.
|
|
145
|
+
|
|
146
|
+
## 6. CLI usage
|
|
147
|
+
|
|
148
|
+
Install the current code directly from GitHub (until a PyPI release is published):
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
python -m pip install "git+https://github.com/rudimentall1/MCP-Security-Check-for-GitHub.git@54a16d2968ef7ac30be6260e70157ada75819759"
|
|
152
|
+
|
|
153
|
+
mcp-security-check scan .
|
|
154
|
+
mcp-security-check scan . --format json
|
|
155
|
+
mcp-security-check scan . --format sarif --output results.sarif
|
|
156
|
+
mcp-security-check diff <base-dir> <head-dir>
|
|
157
|
+
mcp-security-check scan . --config .mcp-security.yaml --fail-on high
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Options: `--config`, `--format {terminal,json,sarif,markdown}`, `--output`,
|
|
161
|
+
`--sarif-output` / `--markdown-output` (write those formats to additional
|
|
162
|
+
files from the *same* analysis run, alongside `--output`/`--format` —
|
|
163
|
+
useful for producing JSON+SARIF+Markdown from one invocation, as the
|
|
164
|
+
GitHub Action does), `--fail-on {critical,high,medium,low,info}`,
|
|
165
|
+
`--file` (repeatable, explicit config path), `--verbose`.
|
|
166
|
+
|
|
167
|
+
### Exit codes
|
|
168
|
+
|
|
169
|
+
| Code | Meaning |
|
|
170
|
+
|---|---|
|
|
171
|
+
| 0 | ALLOW |
|
|
172
|
+
| 1 | WARN |
|
|
173
|
+
| 2 | BLOCK |
|
|
174
|
+
| 3 | incomplete scan, input, or execution/configuration error |
|
|
175
|
+
|
|
176
|
+
## 7. Configuration
|
|
177
|
+
|
|
178
|
+
Policy is a small YAML file (see [rules/default.yaml](rules/default.yaml)):
|
|
179
|
+
|
|
180
|
+
```yaml
|
|
181
|
+
policy:
|
|
182
|
+
block_on: [critical]
|
|
183
|
+
warn_on: [high, medium]
|
|
184
|
+
block_on_critical_attack_path: true
|
|
185
|
+
rules:
|
|
186
|
+
MSC009:
|
|
187
|
+
action: warn
|
|
188
|
+
MSC001:
|
|
189
|
+
action: block
|
|
190
|
+
allowed_capabilities: []
|
|
191
|
+
allowed_endpoints: []
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
`rules.<RULE_ID>.action` can be `block`, `warn`, `allow`, or `ignore`.
|
|
195
|
+
`allowed_capabilities` / `allowed_endpoints` suppress findings for
|
|
196
|
+
capabilities/endpoints you have explicitly reviewed and approved.
|
|
197
|
+
|
|
198
|
+
## 8. Rules
|
|
199
|
+
|
|
200
|
+
| ID | Title |
|
|
201
|
+
|---|---|
|
|
202
|
+
| MSC001 | Arbitrary Shell Execution |
|
|
203
|
+
| MSC002 | Secret Access |
|
|
204
|
+
| MSC003 | Secret + External Network |
|
|
205
|
+
| MSC004 | Filesystem + External Network |
|
|
206
|
+
| MSC005 | Shell + External Network |
|
|
207
|
+
| MSC006 | Unrestricted Filesystem Write |
|
|
208
|
+
| MSC007 | Credential File Access |
|
|
209
|
+
| MSC008 | Remote Script Execution |
|
|
210
|
+
| MSC009 | Unrestricted Network |
|
|
211
|
+
| MSC010 | Package Install + Execute |
|
|
212
|
+
| MSC011 | Dynamic Code Execution |
|
|
213
|
+
| MSC012 | Dangerous MCP Tool |
|
|
214
|
+
| MSC013 | External Instruction Fetch |
|
|
215
|
+
| MSC014 | Obfuscated Instruction |
|
|
216
|
+
| MSC015 | New High-Risk Capability (capability diff) |
|
|
217
|
+
| MSC016 | Unpinned Dependency |
|
|
218
|
+
| MSC017 | Unverified Remote Source |
|
|
219
|
+
| MSC018 | New External Endpoint (capability diff) |
|
|
220
|
+
| MSC019 | Unknown Publisher |
|
|
221
|
+
| MSC020 | Configuration Drift (capability diff) |
|
|
222
|
+
|
|
223
|
+
**Severity rationale:** CRITICAL is reserved for combinations with a
|
|
224
|
+
realistic exploit chain (e.g. shell + network, secrets + network) and for
|
|
225
|
+
remote-script-execution patterns (`curl ... \| sh`). Single dangerous
|
|
226
|
+
capabilities (shell execution alone, filesystem write alone, unrestricted
|
|
227
|
+
network alone) are HIGH — dangerous, but common in legitimate tooling.
|
|
228
|
+
Access-adjacent signals (secret env var naming, credential declarations) are
|
|
229
|
+
MEDIUM. Provenance/metadata gaps (unknown publisher, unpinned version) are
|
|
230
|
+
LOW/MEDIUM informational hints, not proof of danger. A dangerous capability
|
|
231
|
+
is never treated as proof of malware — findings state the possible impact,
|
|
232
|
+
not a verdict.
|
|
233
|
+
|
|
234
|
+
Unknown/unrecognized configuration fields and permission strings are never
|
|
235
|
+
translated into a capability or a finding — unknown data does not mean
|
|
236
|
+
dangerous data.
|
|
237
|
+
|
|
238
|
+
## 9. Attack path engine
|
|
239
|
+
|
|
240
|
+
The attack-path engine evaluates **combinations** of capabilities present on
|
|
241
|
+
the same component (independent of single-capability rules):
|
|
242
|
+
|
|
243
|
+
| ID | Chain | Severity |
|
|
244
|
+
|---|---|---|
|
|
245
|
+
| AP001 | secrets.read → network.external | CRITICAL |
|
|
246
|
+
| AP002 | filesystem.read → network.external | HIGH |
|
|
247
|
+
| AP003 | filesystem.write → shell.execute | CRITICAL |
|
|
248
|
+
| AP004 | shell.execute → network.external | CRITICAL |
|
|
249
|
+
| AP005 | package.install → package.execute | HIGH |
|
|
250
|
+
| AP006 | credentials.read → network.external | CRITICAL |
|
|
251
|
+
| AP007 | filesystem.write → shell.execute → network.external | CRITICAL |
|
|
252
|
+
|
|
253
|
+
## 10. Capability diff
|
|
254
|
+
|
|
255
|
+
`mcp-security-check diff <base> <head>` (or the Action's `base-path` input)
|
|
256
|
+
parses both trees and computes:
|
|
257
|
+
|
|
258
|
+
- `added` — capabilities present in HEAD but not BASE
|
|
259
|
+
- `removed` — capabilities present in BASE but not HEAD
|
|
260
|
+
- `unchanged` — capabilities present in both with the same target/scope
|
|
261
|
+
- `changed` — capabilities present in both, but whose target/scope changed
|
|
262
|
+
(reported as MSC020 Configuration Drift)
|
|
263
|
+
|
|
264
|
+
Newly added high-risk capabilities trigger MSC015; a newly added
|
|
265
|
+
`network.external` capability additionally triggers MSC018 (New External
|
|
266
|
+
Endpoint). The diff engine is independent of GitHub — it operates purely on
|
|
267
|
+
two capability sets and is used by both the CLI and the Action.
|
|
268
|
+
|
|
269
|
+
## 11. Risk scoring
|
|
270
|
+
|
|
271
|
+
The score is a **documented, reproducible weighted sum**, capped at 100 — not
|
|
272
|
+
an opaque AI/ML score:
|
|
273
|
+
|
|
274
|
+
```
|
|
275
|
+
score = sum(severity_weight[f] for f in findings)
|
|
276
|
+
+ sum(attack_path_bonus[p] for p in attack_paths)
|
|
277
|
+
+ (15 if a new high-risk capability was added else 0)
|
|
278
|
+
score = min(score, 100)
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
| Severity | Finding weight | Attack-path bonus |
|
|
282
|
+
|---|---|---|
|
|
283
|
+
| critical | 40 | 25 |
|
|
284
|
+
| high | 20 | 12 |
|
|
285
|
+
| medium | 10 | 5 |
|
|
286
|
+
| low | 3 | 0 |
|
|
287
|
+
| info | 0 | 0 |
|
|
288
|
+
|
|
289
|
+
See [scoring/risk.py](src/mcp_security/scoring/risk.py) for the exact
|
|
290
|
+
implementation.
|
|
291
|
+
|
|
292
|
+
## 12. ALLOW / WARN / BLOCK
|
|
293
|
+
|
|
294
|
+
Default decision logic (configurable via policy, see [§7](#7-configuration)):
|
|
295
|
+
|
|
296
|
+
- Any **CRITICAL** finding, or any **CRITICAL attack path** → **BLOCK**
|
|
297
|
+
- Any **HIGH** or **MEDIUM** finding (and nothing above) → **WARN**
|
|
298
|
+
- Otherwise → **ALLOW**
|
|
299
|
+
|
|
300
|
+
`--fail-on <severity>` on the CLI/Action additionally forces BLOCK if any
|
|
301
|
+
finding at or above that severity is present, independent of the policy
|
|
302
|
+
file's own thresholds.
|
|
303
|
+
|
|
304
|
+
If a discovered MCP configuration cannot be read, parsed, or normalized to a
|
|
305
|
+
recognizable MCP server structure, the report fails closed with **BLOCK** and
|
|
306
|
+
the CLI returns exit code **3**. A missing scan root,
|
|
307
|
+
missing explicit `--file`, missing policy file, or invalid/empty policy YAML
|
|
308
|
+
also returns exit code **3** instead of silently falling back to a clean scan
|
|
309
|
+
or the default policy. These errors do not claim the configuration is
|
|
310
|
+
malicious; they mean the requested assessment could not be completed.
|
|
311
|
+
|
|
312
|
+
## 13. Limitations
|
|
313
|
+
|
|
314
|
+
- MCP configuration is not universally standardized; discovery covers common,
|
|
315
|
+
recognizable filenames/paths (`.mcp.json`, `mcp.json`,
|
|
316
|
+
`claude_desktop_config.json`, `.cursor/mcp.json`, ...) — not every possible
|
|
317
|
+
client's config layout. It parses the portable top-level `mcpServers` format
|
|
318
|
+
and the VS Code top-level `servers` format.
|
|
319
|
+
- Capability extraction is heuristic (command names, argument tokens,
|
|
320
|
+
environment variable naming, declared tool names/permissions). It can miss
|
|
321
|
+
capabilities that are not expressible in the inspected fields, and it does
|
|
322
|
+
not execute anything to verify behavior.
|
|
323
|
+
- Provenance/trust signals are informational only and based solely on local
|
|
324
|
+
metadata; they are **not** proof that a component is trustworthy.
|
|
325
|
+
- Entropy-based hardcoded-secret detection and description-based heuristics
|
|
326
|
+
(MSC013, MSC014, MSC002-LITERAL) can produce false positives; they are
|
|
327
|
+
marked with lower confidence rather than certainty. The literal-secret
|
|
328
|
+
check covers environment values and remote HTTP header credentials. It redacts
|
|
329
|
+
detected values in reports and ignores explicit input/environment references.
|
|
330
|
+
- This tool does not detect all attacks and does not guarantee protection —
|
|
331
|
+
it surfaces dangerous capabilities and plausible attack paths for human
|
|
332
|
+
review before merge.
|
|
333
|
+
|
|
334
|
+
## 14. Security model
|
|
335
|
+
|
|
336
|
+
Reports redact HTTP Basic/Bearer credentials, URL userinfo, and sensitive
|
|
337
|
+
query/fragment parameters (for example, token, password, or api_key values).
|
|
338
|
+
This applies to findings and BASE/HEAD target-diff summaries so report output
|
|
339
|
+
can be shared without reprinting common credential formats. Redaction is
|
|
340
|
+
pattern-based and is not a substitute for keeping secrets out of configuration.
|
|
341
|
+
|
|
342
|
+
The scanner only reads and analyzes text-based configuration files. It never:
|
|
343
|
+
|
|
344
|
+
- executes MCP commands, configuration commands, or skill instructions
|
|
345
|
+
- executes downloaded code or follows arbitrary URLs
|
|
346
|
+
- runs shell commands found in scanned content
|
|
347
|
+
- imports arbitrary modules from scanned repositories
|
|
348
|
+
- evaluates untrusted Python
|
|
349
|
+
- uses unsafe deserialization (`yaml.safe_load` only, standard `json.loads`
|
|
350
|
+
only)
|
|
351
|
+
- follows symlinks during discovery or reads their targets. A symlinked MCP
|
|
352
|
+
config, a non-ignored symlinked directory, or a recognizable MCP config over
|
|
353
|
+
the size limit causes an explicit scan error rather than a misleading ALLOW.
|
|
354
|
+
|
|
355
|
+
File discovery enforces a size limit (default 2 MiB), skips oversized files
|
|
356
|
+
that are not recognized as MCP configs, and excludes VCS/dependency directories
|
|
357
|
+
(`.git`, `node_modules`, `.venv`, ...) to avoid scanning huge or irrelevant
|
|
358
|
+
trees. Directory traversal errors are surfaced instead of silently returning
|
|
359
|
+
a partial result.
|
|
360
|
+
|
|
361
|
+
## 15. Roadmap
|
|
362
|
+
|
|
363
|
+
**v0.2:** SKILL.md analysis, plugin support, baseline/rug-pull detection,
|
|
364
|
+
stronger provenance signals.
|
|
365
|
+
|
|
366
|
+
**v0.3:** policy-as-code, organization-wide policies, custom rules.
|
|
367
|
+
|
|
368
|
+
**v0.4:** machine-readable security API, MCP security tool interface.
|
|
369
|
+
|
|
370
|
+
**v0.5:** historical reports, team dashboard.
|
|
371
|
+
|
|
372
|
+
**Future:** AI Agent Security Gate, Agent Supply Chain Security, Web3 agent
|
|
373
|
+
security (the capability model already reserves `wallet.*`, `transaction.*`,
|
|
374
|
+
`contract.*`, `token.*` for this, but they are not a primary v0.1 feature).
|
|
375
|
+
|
|
376
|
+
## Development
|
|
377
|
+
|
|
378
|
+
```bash
|
|
379
|
+
pip install -e ".[dev]"
|
|
380
|
+
pytest
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
`pytest` works right after cloning, even without the `pip install -e .`
|
|
384
|
+
step above (see `[tool.pytest.ini_options]` in `pyproject.toml`) — the
|
|
385
|
+
install is still recommended so the `mcp-security-check` console script
|
|
386
|
+
and normal `import mcp_security` work outside of tests.
|
|
387
|
+
|
|
388
|
+
## Project status and security
|
|
389
|
+
|
|
390
|
+
- [CHANGELOG](CHANGELOG.md) — current release scope and known limitations.
|
|
391
|
+
- [Security policy](SECURITY.md) — responsible vulnerability reporting.
|
|
392
|
+
|
|
393
|
+
The first version has not been published as a GitHub Release or PyPI package yet.
|
|
394
|
+
The source can be installed using the commit-pinned command above.
|
|
395
|
+
|
|
396
|
+
## License
|
|
397
|
+
|
|
398
|
+
MIT — see [LICENSE](LICENSE).
|