mcp-capdiff 0.1.1__py3-none-any.whl
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_audit/__init__.py +6 -0
- mcp_audit/__main__.py +6 -0
- mcp_audit/analysis/__init__.py +1 -0
- mcp_audit/analysis/diff.py +235 -0
- mcp_audit/analysis/scan.py +29 -0
- mcp_audit/cli/__init__.py +1 -0
- mcp_audit/cli/main.py +112 -0
- mcp_audit/models/__init__.py +12 -0
- mcp_audit/models/capability.py +73 -0
- mcp_audit/models/finding.py +87 -0
- mcp_audit/models/report.py +120 -0
- mcp_audit/policy/__init__.py +1 -0
- mcp_audit/policy/evaluator.py +29 -0
- mcp_audit/policy/loader.py +138 -0
- mcp_audit/reporters/__init__.py +1 -0
- mcp_audit/reporters/json.py +9 -0
- mcp_audit/reporters/manifest.py +30 -0
- mcp_audit/reporters/sarif.py +94 -0
- mcp_audit/reporters/terminal.py +97 -0
- mcp_audit/rules/__init__.py +1 -0
- mcp_audit/rules/engine.py +177 -0
- mcp_audit/scanners/__init__.py +1 -0
- mcp_audit/scanners/source/__init__.py +1 -0
- mcp_audit/scanners/source/python.py +441 -0
- mcp_capdiff-0.1.1.dist-info/METADATA +173 -0
- mcp_capdiff-0.1.1.dist-info/RECORD +30 -0
- mcp_capdiff-0.1.1.dist-info/WHEEL +5 -0
- mcp_capdiff-0.1.1.dist-info/entry_points.txt +2 -0
- mcp_capdiff-0.1.1.dist-info/licenses/LICENSE +21 -0
- mcp_capdiff-0.1.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mcp-capdiff
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Security regression scanner for Model Context Protocol servers.
|
|
5
|
+
Author: MCP Audit contributors
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/robbyfa/MCP-Audit
|
|
8
|
+
Project-URL: Repository, https://github.com/robbyfa/MCP-Audit
|
|
9
|
+
Project-URL: Issues, https://github.com/robbyfa/MCP-Audit/issues
|
|
10
|
+
Keywords: mcp,security,static-analysis,sarif,ci
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Topic :: Security
|
|
15
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Requires-Python: >=3.12
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
Requires-Dist: PyYAML<7,>=6.0
|
|
22
|
+
Dynamic: license-file
|
|
23
|
+
|
|
24
|
+
# MCP Audit
|
|
25
|
+
|
|
26
|
+
MCP Audit is an open-source security regression scanner for Model Context Protocol servers. It extracts tool capabilities and permissions, detects risky cross-tool data flows, compares security posture across Git revisions, and emits CI-friendly evidence.
|
|
27
|
+
|
|
28
|
+
The first version focuses on Python/FastMCP projects and the core product thesis from the spec: show what an MCP server can do, what changed, and whether the change creates a dangerous capability path.
|
|
29
|
+
|
|
30
|
+
MCP005 is the capability-graph rule: it identifies when one tool returns classified data and another tool in the same MCP registration context can send it to an external destination. Findings include the source, data classification, sink, destination, path, source evidence, impact, and remediation.
|
|
31
|
+
|
|
32
|
+
## Install locally
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
uv sync
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Run project commands through `uv run`, or activate the virtual environment with
|
|
39
|
+
`source .venv/bin/activate` before using bare commands.
|
|
40
|
+
|
|
41
|
+
The package also supports isolated CLI installation directly from a checkout:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
pipx install .
|
|
45
|
+
mcp-audit --version
|
|
46
|
+
mcp-audit scan .
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
The product and CLI are named MCP Audit, while the PyPI distribution is named `mcp-capdiff`:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
pipx install mcp-capdiff
|
|
53
|
+
mcp-audit --version
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Scan a server
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
uv run mcp-audit scan .
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Scans fail closed when source cannot be read or when no MCP tools are discovered. Use `--allow-empty` only when an empty result is intentional.
|
|
63
|
+
|
|
64
|
+
Useful output formats:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
uv run mcp-audit scan . --format json
|
|
68
|
+
uv run mcp-audit scan . --format sarif --output mcp-audit.sarif
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Generate a capability manifest
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
uv run mcp-audit manifest .
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Compare against a Git baseline
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
uv run mcp-audit diff --base origin/main
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
The diff report focuses on security changes: before/after risk, added and changed tools, expanded capabilities, new findings, resolved findings, and approval removal.
|
|
84
|
+
|
|
85
|
+
## Run tests
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
uv run pytest
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
The corpus contains positive, negative, and edge cases under `fixtures/`, including host allowlisting, path-root validation, approval gating, and cross-tool sensitive-data paths.
|
|
92
|
+
|
|
93
|
+
## GitHub Action
|
|
94
|
+
|
|
95
|
+
The repository includes a composite action that runs the security diff, uploads SARIF to GitHub Code Scanning, and fails the check when policy thresholds are crossed:
|
|
96
|
+
|
|
97
|
+
```yaml
|
|
98
|
+
permissions:
|
|
99
|
+
actions: read
|
|
100
|
+
contents: read
|
|
101
|
+
security-events: write
|
|
102
|
+
|
|
103
|
+
steps:
|
|
104
|
+
- uses: actions/checkout@v4
|
|
105
|
+
with:
|
|
106
|
+
fetch-depth: 0
|
|
107
|
+
- uses: actions/setup-python@v5
|
|
108
|
+
with:
|
|
109
|
+
python-version: "3.12"
|
|
110
|
+
- uses: your-org/mcp-audit@v0.1
|
|
111
|
+
with:
|
|
112
|
+
target: .
|
|
113
|
+
base: origin/main
|
|
114
|
+
policy: mcp-audit.yaml
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
JSON reports and manifests use the versioned schema documented in `docs/report-schema.md`.
|
|
118
|
+
|
|
119
|
+
The copyable [vulnerable FastMCP demo](examples/vulnerable-fastmcp/) includes four before/after pull-request scenarios and its own Action workflow.
|
|
120
|
+
|
|
121
|
+
## V0.1 rules
|
|
122
|
+
|
|
123
|
+
- `MCP001` arbitrary shell execution.
|
|
124
|
+
- `MCP002` unrestricted filesystem access.
|
|
125
|
+
- `MCP003` arbitrary URL or SSRF surface.
|
|
126
|
+
- `MCP004` high-impact side effect without approval.
|
|
127
|
+
- `MCP005` sensitive read to external write path.
|
|
128
|
+
- `MCP007` unbounded security-sensitive input.
|
|
129
|
+
- `MCP010` destructive tool exposed.
|
|
130
|
+
- `MCP016` capability escalation in a diff.
|
|
131
|
+
- `MCP017` approval removed in a diff.
|
|
132
|
+
|
|
133
|
+
Each rule's detection behavior, examples, remediation, and limitations are documented in [docs/rules](docs/rules/README.md).
|
|
134
|
+
|
|
135
|
+
## Demo fixtures
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
uv run mcp-audit scan fixtures/safe_server
|
|
139
|
+
uv run mcp-audit scan fixtures/vulnerable_server
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
The vulnerable fixture includes a sensitive file read tool, an unrestricted URL fetcher, shell execution, and a destructive operation. MCP Audit should flag the individual findings and the cross-tool path:
|
|
143
|
+
|
|
144
|
+
```text
|
|
145
|
+
read_customer_file -> agent_context -> fetch_url
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Policy
|
|
149
|
+
|
|
150
|
+
The default policy fails on high and critical findings. A minimal policy file can set a risk threshold and suppress reviewed findings:
|
|
151
|
+
|
|
152
|
+
```yaml
|
|
153
|
+
policy:
|
|
154
|
+
ci:
|
|
155
|
+
fail_on:
|
|
156
|
+
- critical
|
|
157
|
+
- high
|
|
158
|
+
max_risk_score: 60
|
|
159
|
+
|
|
160
|
+
suppress:
|
|
161
|
+
- rule: MCP003
|
|
162
|
+
tool: internal_fetch
|
|
163
|
+
reason: "Network egress is enforced by service mesh"
|
|
164
|
+
expires: 2027-01-31
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Suppression reasons are required. Expired suppressions no longer hide findings, and `mcp-audit policy check` reports them. See [policy documentation](docs/policy.md).
|
|
168
|
+
|
|
169
|
+
## Version contracts
|
|
170
|
+
|
|
171
|
+
CLI, ruleset, report schema, and manifest schema versions evolve independently. See [versioning](docs/versioning.md) and [report schema](docs/report-schema.md).
|
|
172
|
+
|
|
173
|
+
Passing MCP Audit is technical security evidence, not a legal compliance determination.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
mcp_audit/__init__.py,sha256=0yAP6G5TzdAmauO3FvPb3fgJsdpH4ahMc3oqY7Rmg0g,186
|
|
2
|
+
mcp_audit/__main__.py,sha256=K_GoXoMc21FRRl6J8xKtGp_pmsDIeqGUd5ogv9u4MIU,97
|
|
3
|
+
mcp_audit/analysis/__init__.py,sha256=axuNr8OZZZrzaqJ9O8xJp8fXrEq9ROZfhpfUtb8vWqo,29
|
|
4
|
+
mcp_audit/analysis/diff.py,sha256=Bu2OswJskTZrLb-lAIAHbPi_8GwpnEfAhamBUFRPSAw,9308
|
|
5
|
+
mcp_audit/analysis/scan.py,sha256=TJVzLB3YA4JBX0gUAF4ExE6H3c-g5tQaw7iqLrB154I,870
|
|
6
|
+
mcp_audit/cli/__init__.py,sha256=C63yWifzpA0IV7YWDatpAdrhoV8zjqxAKv0xMf09VdM,19
|
|
7
|
+
mcp_audit/cli/main.py,sha256=94zGGOyPkdOm6bo1f0xK1TM8OFwxcrLMXOHXbTAJ_5A,4490
|
|
8
|
+
mcp_audit/models/__init__.py,sha256=fOgXYCfXZYGU_FmdogMm4FIyyQrARQWpr3S6N-3UNu0,279
|
|
9
|
+
mcp_audit/models/capability.py,sha256=12Pcre2QkEGEXYyFR7LStKTpTptD-0yR0HHXn50Uey4,2219
|
|
10
|
+
mcp_audit/models/finding.py,sha256=1_uoFi_GvMyXkeaH1CtyPAylAcDG7KRC2ixPNMLj_8o,2521
|
|
11
|
+
mcp_audit/models/report.py,sha256=mEmgVWGEFbxZjxQeaB87b17i0DpGCkqkWxiDmWv22bc,4270
|
|
12
|
+
mcp_audit/policy/__init__.py,sha256=yyOeCqhHPWymlKhRlwCSQlRCrAS8R9_SZx62dLJOKGc,37
|
|
13
|
+
mcp_audit/policy/evaluator.py,sha256=u9mPFNGAhEWyoZ4Hdg-VUH5sdKrKbjx9Z4DD5gPDznI,993
|
|
14
|
+
mcp_audit/policy/loader.py,sha256=adrb6YqRFCBoiX9xvBYbETbIXvauntjOkDGxNZP8sBw,4941
|
|
15
|
+
mcp_audit/reporters/__init__.py,sha256=bmQ3dGBiHqSPwumamEebbTyZSdWgUDms_jPjo1MBB0Y,24
|
|
16
|
+
mcp_audit/reporters/json.py,sha256=86ki9DG4NYPk6TNKXNP3itu_tFqneEOCNSw1Nky-iXY,237
|
|
17
|
+
mcp_audit/reporters/manifest.py,sha256=D7t4Pl7pMk6daLHBe3ahTOb1lO5Pxmo1ly6hdiEnbVA,1132
|
|
18
|
+
mcp_audit/reporters/sarif.py,sha256=OpB8B-FpamZzoCd6LTVz4yuaUn4R9to5lveHePpZtvk,3167
|
|
19
|
+
mcp_audit/reporters/terminal.py,sha256=fxDN7PmRAcebVXrTlAd4nbfv462FkGwGuTOfpGGjUJY,3216
|
|
20
|
+
mcp_audit/rules/__init__.py,sha256=D0zBK-ojsCfJhqDtPV5yASxq9tnZh-ewz6pXqpGWvVg,22
|
|
21
|
+
mcp_audit/rules/engine.py,sha256=C4fPdDITOZlTCXcklz9_ytJdBXEoCRMt5Xq1MBlQdsg,8877
|
|
22
|
+
mcp_audit/scanners/__init__.py,sha256=MMjF2VtHU7IulhbzPMcQGN3442bQx_SQlFPgXXbZ8LI,35
|
|
23
|
+
mcp_audit/scanners/source/__init__.py,sha256=JIg80amN3QYYuuHF9aUvaR8APE8Vm-_jM5yc0H6RZow,23
|
|
24
|
+
mcp_audit/scanners/source/python.py,sha256=7JKOM-TukLM5ej1eFKjBj3MR36mZSXCt17xpNBdjVp4,19588
|
|
25
|
+
mcp_capdiff-0.1.1.dist-info/licenses/LICENSE,sha256=Q4GJ9OGrYcDpGmXPusuLT49p33NbsP4KYGiN9qqreeY,1079
|
|
26
|
+
mcp_capdiff-0.1.1.dist-info/METADATA,sha256=EOX6Fp-O1YeeiDpq-iVLzR-r0nG-sONdQzdRK2MTklM,5520
|
|
27
|
+
mcp_capdiff-0.1.1.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
28
|
+
mcp_capdiff-0.1.1.dist-info/entry_points.txt,sha256=rfG7Q7QC08t3hxDUU-EQUidHJW_x1URDZKG8uSBJYoQ,54
|
|
29
|
+
mcp_capdiff-0.1.1.dist-info/top_level.txt,sha256=YZ4Gy-ehEA074nfIt4cMSAS6gAJDYcWfX0gu468CZVE,10
|
|
30
|
+
mcp_capdiff-0.1.1.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 MCP Audit 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 @@
|
|
|
1
|
+
mcp_audit
|