mcp-sdk-audit 0.1.2__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_sdk_audit-0.1.2/.gitattributes +2 -0
- mcp_sdk_audit-0.1.2/.github/dependabot.yml +10 -0
- mcp_sdk_audit-0.1.2/.github/workflows/ci.yml +54 -0
- mcp_sdk_audit-0.1.2/.github/workflows/refresh-advisories.yml +45 -0
- mcp_sdk_audit-0.1.2/.github/workflows/release.yml +63 -0
- mcp_sdk_audit-0.1.2/.gitignore +10 -0
- mcp_sdk_audit-0.1.2/CHANGELOG.md +28 -0
- mcp_sdk_audit-0.1.2/LICENSE +21 -0
- mcp_sdk_audit-0.1.2/PKG-INFO +152 -0
- mcp_sdk_audit-0.1.2/README.md +128 -0
- mcp_sdk_audit-0.1.2/SECURITY.md +10 -0
- mcp_sdk_audit-0.1.2/action.yml +83 -0
- mcp_sdk_audit-0.1.2/docs/demo.svg +281 -0
- mcp_sdk_audit-0.1.2/pyproject.toml +50 -0
- mcp_sdk_audit-0.1.2/scripts/render_demo.py +20 -0
- mcp_sdk_audit-0.1.2/src/mcp_sdk_audit/__init__.py +3 -0
- mcp_sdk_audit-0.1.2/src/mcp_sdk_audit/__main__.py +3 -0
- mcp_sdk_audit-0.1.2/src/mcp_sdk_audit/advisories.py +109 -0
- mcp_sdk_audit-0.1.2/src/mcp_sdk_audit/cli.py +86 -0
- mcp_sdk_audit-0.1.2/src/mcp_sdk_audit/data/__init__.py +0 -0
- mcp_sdk_audit-0.1.2/src/mcp_sdk_audit/data/advisories.json +489 -0
- mcp_sdk_audit-0.1.2/src/mcp_sdk_audit/deps.py +173 -0
- mcp_sdk_audit-0.1.2/src/mcp_sdk_audit/output.py +183 -0
- mcp_sdk_audit-0.1.2/src/mcp_sdk_audit/rules.py +379 -0
- mcp_sdk_audit-0.1.2/src/mcp_sdk_audit/scanner.py +117 -0
- mcp_sdk_audit-0.1.2/src/mcp_sdk_audit/versions.py +83 -0
- mcp_sdk_audit-0.1.2/tests/fixtures/fixed/py-client/agent.py +21 -0
- mcp_sdk_audit-0.1.2/tests/fixtures/fixed/py-client/requirements.txt +2 -0
- mcp_sdk_audit-0.1.2/tests/fixtures/fixed/ts-server/package-lock.json +7 -0
- mcp_sdk_audit-0.1.2/tests/fixtures/fixed/ts-server/server.ts +23 -0
- mcp_sdk_audit-0.1.2/tests/fixtures/locks/Pipfile.lock +1 -0
- mcp_sdk_audit-0.1.2/tests/fixtures/locks/pnpm-lock.yaml +16 -0
- mcp_sdk_audit-0.1.2/tests/fixtures/locks/yarn.lock +10 -0
- mcp_sdk_audit-0.1.2/tests/fixtures/vulnerable/go-svc/go.mod +8 -0
- mcp_sdk_audit-0.1.2/tests/fixtures/vulnerable/py-client/agent.py +21 -0
- mcp_sdk_audit-0.1.2/tests/fixtures/vulnerable/py-client/uv.lock +12 -0
- mcp_sdk_audit-0.1.2/tests/fixtures/vulnerable/ts-server/package-lock.json +10 -0
- mcp_sdk_audit-0.1.2/tests/fixtures/vulnerable/ts-server/server.ts +27 -0
- mcp_sdk_audit-0.1.2/tests/test_audit.py +269 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
test:
|
|
13
|
+
name: test (${{ matrix.os }}, py${{ matrix.python }})
|
|
14
|
+
runs-on: ${{ matrix.os }}
|
|
15
|
+
strategy:
|
|
16
|
+
fail-fast: false
|
|
17
|
+
matrix:
|
|
18
|
+
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
19
|
+
python: ["3.11", "3.12", "3.13", "3.14"]
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
22
|
+
with:
|
|
23
|
+
persist-credentials: false
|
|
24
|
+
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
|
|
25
|
+
with:
|
|
26
|
+
python-version: ${{ matrix.python }}
|
|
27
|
+
- run: python -m pip install -e ".[dev]"
|
|
28
|
+
- run: ruff check .
|
|
29
|
+
- run: ruff format --check .
|
|
30
|
+
- run: pytest -q
|
|
31
|
+
|
|
32
|
+
action:
|
|
33
|
+
name: action smoke test
|
|
34
|
+
runs-on: ubuntu-latest
|
|
35
|
+
steps:
|
|
36
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
37
|
+
with:
|
|
38
|
+
persist-credentials: false
|
|
39
|
+
- name: Scan the vulnerable fixture (must fail)
|
|
40
|
+
id: bad
|
|
41
|
+
continue-on-error: true
|
|
42
|
+
uses: ./
|
|
43
|
+
with:
|
|
44
|
+
path: tests/fixtures/vulnerable
|
|
45
|
+
upload-sarif: "false"
|
|
46
|
+
- name: Scan the fixed fixture (must pass)
|
|
47
|
+
uses: ./
|
|
48
|
+
with:
|
|
49
|
+
path: tests/fixtures/fixed
|
|
50
|
+
upload-sarif: "false"
|
|
51
|
+
- name: Check outcomes
|
|
52
|
+
env:
|
|
53
|
+
BAD: ${{ steps.bad.outcome }}
|
|
54
|
+
run: test "$BAD" = "failure"
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
name: Refresh advisory snapshot
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
schedule:
|
|
5
|
+
- cron: "17 6 * * *"
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: write
|
|
10
|
+
pull-requests: write
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
refresh:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
17
|
+
with:
|
|
18
|
+
persist-credentials: false
|
|
19
|
+
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
|
|
20
|
+
with:
|
|
21
|
+
python-version: "3.13"
|
|
22
|
+
- run: python -m pip install -e .
|
|
23
|
+
- name: Fetch advisories
|
|
24
|
+
env:
|
|
25
|
+
GITHUB_TOKEN: ${{ github.token }}
|
|
26
|
+
run: python -m mcp_sdk_audit --update-snapshot src/mcp_sdk_audit/data/advisories.json
|
|
27
|
+
- name: Summarize new advisories
|
|
28
|
+
id: diff
|
|
29
|
+
run: |
|
|
30
|
+
{
|
|
31
|
+
echo 'body<<EOF'
|
|
32
|
+
echo 'Automated refresh of the bundled advisory snapshot from the GitHub Advisory Database.'
|
|
33
|
+
echo
|
|
34
|
+
git diff -U0 src/mcp_sdk_audit/data/advisories.json | grep -E '^\+\s+"(ghsa|summary)"' | sed 's/^+\s*/- /' || true
|
|
35
|
+
echo
|
|
36
|
+
echo 'Check whether any new advisory needs a source rule (upgrade alone not enough).'
|
|
37
|
+
echo EOF
|
|
38
|
+
} >> "$GITHUB_OUTPUT"
|
|
39
|
+
- uses: peter-evans/create-pull-request@3ffccacd46053766916f087ce41d627c0b8cf2d1 # v8.1.3
|
|
40
|
+
with:
|
|
41
|
+
branch: chore/refresh-advisories
|
|
42
|
+
commit-message: "chore: refresh advisory snapshot"
|
|
43
|
+
title: "chore: refresh advisory snapshot"
|
|
44
|
+
body: ${{ steps.diff.outputs.body }}
|
|
45
|
+
labels: advisories
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags: ["v*"]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
build:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
15
|
+
with:
|
|
16
|
+
persist-credentials: false
|
|
17
|
+
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
|
|
18
|
+
with:
|
|
19
|
+
python-version: "3.13"
|
|
20
|
+
- run: python -m pip install build && python -m build
|
|
21
|
+
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
22
|
+
with:
|
|
23
|
+
name: dist
|
|
24
|
+
path: dist/
|
|
25
|
+
|
|
26
|
+
github-release:
|
|
27
|
+
needs: build
|
|
28
|
+
runs-on: ubuntu-latest
|
|
29
|
+
permissions:
|
|
30
|
+
contents: write
|
|
31
|
+
steps:
|
|
32
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
33
|
+
with:
|
|
34
|
+
persist-credentials: false
|
|
35
|
+
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
|
36
|
+
with:
|
|
37
|
+
name: dist
|
|
38
|
+
path: dist/
|
|
39
|
+
- name: Extract changelog section
|
|
40
|
+
env:
|
|
41
|
+
TAG: ${{ github.ref_name }}
|
|
42
|
+
run: |
|
|
43
|
+
awk -v h="## [${TAG#v}]" 'index($0, h) == 1 {f=1; next} /^## / && f {exit} f' CHANGELOG.md > notes.md
|
|
44
|
+
cat notes.md
|
|
45
|
+
- uses: softprops/action-gh-release@8a0cd651e5b2365bd640854a3fa5dfc70e4875f3 # v3.0.4
|
|
46
|
+
with:
|
|
47
|
+
body_path: notes.md
|
|
48
|
+
files: dist/*
|
|
49
|
+
|
|
50
|
+
pypi:
|
|
51
|
+
# Enable by creating a PyPI trusted publisher for this repo and setting repo variable PYPI_PUBLISH=true.
|
|
52
|
+
if: ${{ vars.PYPI_PUBLISH == 'true' }}
|
|
53
|
+
needs: build
|
|
54
|
+
runs-on: ubuntu-latest
|
|
55
|
+
environment: pypi
|
|
56
|
+
permissions:
|
|
57
|
+
id-token: write
|
|
58
|
+
steps:
|
|
59
|
+
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
|
60
|
+
with:
|
|
61
|
+
name: dist
|
|
62
|
+
path: dist/
|
|
63
|
+
- uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented here. Format: [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), versioning: [SemVer](https://semver.org/).
|
|
4
|
+
|
|
5
|
+
## [Unreleased]
|
|
6
|
+
|
|
7
|
+
## [0.1.2] - 2026-11-21
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
- Published to PyPI: `pipx install mcp-sdk-audit`.
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
- Release notes now contain only the tagged version's CHANGELOG section.
|
|
14
|
+
|
|
15
|
+
## [0.1.1] - 2026-11-21
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
- `action.yml` failed to load because of an unquoted colon in an input description. Use `@v0.1.1` or later for the GitHub Action.
|
|
19
|
+
|
|
20
|
+
## [0.1.0] - 2026-11-21
|
|
21
|
+
|
|
22
|
+
### Added
|
|
23
|
+
- Lockfile parsing for npm (`package-lock.json`, `npm-shrinkwrap.json`, `pnpm-lock.yaml`, `yarn.lock`, `bun.lock`), PyPI (`uv.lock`, `poetry.lock`, `pdm.lock`, `Pipfile.lock`, `requirements*.txt`) and Go (`go.mod`).
|
|
24
|
+
- Version matching against a bundled snapshot of 25 GitHub advisories for the official TypeScript, Python and Go MCP SDKs, plus `--online` lookups.
|
|
25
|
+
- 11 source rules (MCPA001–MCPA007 TypeScript, MCPA101–MCPA104 Python) for advisories where upgrading alone is not enough.
|
|
26
|
+
- Text, JSON and SARIF 2.1.0 output; `--fail-on` severity threshold.
|
|
27
|
+
- Composite GitHub Action with SARIF upload to code scanning.
|
|
28
|
+
- Test files skipped by default (`--include-tests` to include them).
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Murat Bekgi
|
|
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,152 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: mcp-sdk-audit
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Summary: Find MCP SDK versions with known advisories, and the code that stays exposed after you upgrade.
|
|
5
|
+
Project-URL: Homepage, https://github.com/garag0l/mcp-sdk-audit
|
|
6
|
+
Project-URL: Issues, https://github.com/garag0l/mcp-sdk-audit/issues
|
|
7
|
+
Project-URL: Changelog, https://github.com/garag0l/mcp-sdk-audit/blob/main/CHANGELOG.md
|
|
8
|
+
Author: Murat Bekgi
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: ai-security,mcp,model-context-protocol,oauth,sast,sca,security
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Intended Audience :: Information Technology
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Topic :: Security
|
|
18
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
19
|
+
Requires-Python: >=3.11
|
|
20
|
+
Provides-Extra: dev
|
|
21
|
+
Requires-Dist: pytest>=8; extra == 'dev'
|
|
22
|
+
Requires-Dist: ruff>=0.6; extra == 'dev'
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
|
|
25
|
+
# mcp-sdk-audit
|
|
26
|
+
|
|
27
|
+
**Upgrading your MCP SDK isn't always enough. This finds the code that stays exposed after you upgrade.**
|
|
28
|
+
|
|
29
|
+
[](https://github.com/garag0l/mcp-sdk-audit/actions/workflows/ci.yml)
|
|
30
|
+
[](LICENSE)
|
|
31
|
+

|
|
32
|
+

|
|
33
|
+
|
|
34
|
+
`mcp-sdk-audit` checks projects that use the official Model Context Protocol SDKs (TypeScript, Python, Go). It does two things:
|
|
35
|
+
|
|
36
|
+
1. **Dependencies.** It reads your lockfiles, including transitive dependencies, and matches every resolved MCP SDK version against the GitHub Advisory Database.
|
|
37
|
+
2. **Code.** Several 2026 advisories say that upgrading changes nothing unless you also change your code. The tool flags code that still has one of those problems, even when the SDK is already patched.
|
|
38
|
+
|
|
39
|
+

|
|
40
|
+
|
|
41
|
+
## Why this exists
|
|
42
|
+
|
|
43
|
+
Between December 2025 and November 2026 the official MCP SDKs received a run of security advisories. Several of them have a fix that is **off by default**, or that only works once your code changes:
|
|
44
|
+
|
|
45
|
+
| Advisory | What upgrading alone leaves open |
|
|
46
|
+
|---|---|
|
|
47
|
+
| [GHSA-6qxp-vccf-f47h](https://github.com/advisories/GHSA-6qxp-vccf-f47h) (TS) / [GHSA-qx49-fqc8-xw99](https://github.com/advisories/GHSA-qx49-fqc8-xw99) (Py) | Bundled client-credentials and private-key-JWT providers still send secrets to whichever authorization server the MCP server names, until you pass `expectedIssuer` / `issuer=`. |
|
|
48
|
+
| [GHSA-rvq5-wwqv-78pq](https://github.com/advisories/GHSA-rvq5-wwqv-78pq) (TS) / [GHSA-w4fh-qvv9-3v23](https://github.com/advisories/GHSA-w4fh-qvv9-3v23) (Py) | Bearer auth accepts tokens issued for *other* services until you set `expectedResource` / `validate_token_resource=True`. |
|
|
49
|
+
| [GHSA-345p-7cg4-v4c7](https://github.com/advisories/GHSA-345p-7cg4-v4c7), [GHSA-jm63-cq47-j5jp](https://github.com/advisories/GHSA-jm63-cq47-j5jp) (TS) | A transport or server created once at startup and shared across clients sends one client's responses to another. Older README examples showed this pattern, and patched SDKs now fail at runtime on it. |
|
|
50
|
+
| [GHSA-6prh-2h8m-c8cw](https://github.com/advisories/GHSA-6prh-2h8m-c8cw) (TS) / [GHSA-5h93-6whr-6q8j](https://github.com/advisories/GHSA-5h93-6whr-6q8j) (Py) | `redirectPolicy: 'follow'` or a `follow_redirects=True` client brings back cross-origin redirect leaks of API keys and token-request bodies. |
|
|
51
|
+
| [GHSA-w48q-cv73-mx4w](https://github.com/advisories/GHSA-w48q-cv73-mx4w), [GHSA-9h52-p55h-vw2f](https://github.com/advisories/GHSA-9h52-p55h-vw2f), [GHSA-vj7q-gjh5-988w](https://github.com/advisories/GHSA-vj7q-gjh5-988w) | Hand-built Express apps and low-level Python transports get no DNS-rebinding / Host-header protection unless you add it. |
|
|
52
|
+
|
|
53
|
+
Dependabot, `npm audit`, `pip-audit` and `osv-scanner` stop being useful once the version is bumped. That's exactly the point where these advisories still need a code change.
|
|
54
|
+
|
|
55
|
+
## Install
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
pipx install mcp-sdk-audit
|
|
59
|
+
# or
|
|
60
|
+
pip install mcp-sdk-audit
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Python 3.11+ and no third-party dependencies.
|
|
64
|
+
|
|
65
|
+
## Usage
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
mcp-sdk-audit # scan the current directory
|
|
69
|
+
mcp-sdk-audit path/to/project
|
|
70
|
+
mcp-sdk-audit --online # use the latest advisories instead of the bundled snapshot
|
|
71
|
+
mcp-sdk-audit -f sarif -o mcp.sarif # SARIF for GitHub code scanning
|
|
72
|
+
mcp-sdk-audit -f json # machine-readable
|
|
73
|
+
mcp-sdk-audit --fail-on high # exit 1 only on high/critical (default: medium)
|
|
74
|
+
mcp-sdk-audit --include-tests # also check test files (skipped by default)
|
|
75
|
+
mcp-sdk-audit --list-rules
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Exit codes: `0` nothing at or above `--fail-on`, `1` findings, `2` usage error.
|
|
79
|
+
|
|
80
|
+
### GitHub Action
|
|
81
|
+
|
|
82
|
+
```yaml
|
|
83
|
+
name: mcp-sdk-audit
|
|
84
|
+
on: [push, pull_request]
|
|
85
|
+
permissions:
|
|
86
|
+
contents: read
|
|
87
|
+
security-events: write # for SARIF upload
|
|
88
|
+
jobs:
|
|
89
|
+
audit:
|
|
90
|
+
runs-on: ubuntu-latest
|
|
91
|
+
steps:
|
|
92
|
+
- uses: actions/checkout@v7
|
|
93
|
+
- uses: garag0l/mcp-sdk-audit@v0.1.2
|
|
94
|
+
with:
|
|
95
|
+
fail-on: high # critical | high | medium | low | none
|
|
96
|
+
# upload-sarif: "true"
|
|
97
|
+
# online: "true" # fetch fresh advisories with the job's GITHUB_TOKEN
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Findings show up under **Security → Code scanning**, and the text report is added to the job summary.
|
|
101
|
+
|
|
102
|
+
## What it reads
|
|
103
|
+
|
|
104
|
+
| Ecosystem | Files |
|
|
105
|
+
|---|---|
|
|
106
|
+
| npm | `package-lock.json`, `npm-shrinkwrap.json`, `pnpm-lock.yaml`, `yarn.lock` (v1 and Berry), `bun.lock` |
|
|
107
|
+
| PyPI | `uv.lock`, `poetry.lock`, `pdm.lock`, `Pipfile.lock`, `requirements*.txt` (pinned) |
|
|
108
|
+
| Go | `go.mod` |
|
|
109
|
+
|
|
110
|
+
Packages: `@modelcontextprotocol/{sdk,client,server,server-legacy,core,node,express,hono,fastify}`, `mcp` (PyPI), `github.com/modelcontextprotocol/go-sdk`.
|
|
111
|
+
|
|
112
|
+
## Source rules
|
|
113
|
+
|
|
114
|
+
| ID | Lang | Severity | Flags |
|
|
115
|
+
|---|---|---|---|
|
|
116
|
+
| <a id="mcpa001"></a>MCPA001 | TS | high | `ClientCredentialsProvider` / `PrivateKeyJwtProvider` / `StaticPrivateKeyJwtProvider` / `CrossAppAccessProvider` without `expectedIssuer` |
|
|
117
|
+
| <a id="mcpa002"></a>MCPA002 | TS | medium | `requireBearerAuth()` / `verifyBearerToken()` without `expectedResource` |
|
|
118
|
+
| <a id="mcpa003"></a>MCPA003 | TS | medium | `redirectPolicy: 'follow'` |
|
|
119
|
+
| <a id="mcpa004"></a>MCPA004 | TS | high | Stateless HTTP server transport created at module scope in a file that serves HTTP |
|
|
120
|
+
| <a id="mcpa005"></a>MCPA005 | TS | high | Module-scope `McpServer`/`Server` that `connect()`s inside a request handler |
|
|
121
|
+
| <a id="mcpa006"></a>MCPA006 | TS | medium | Deprecated experimental `taskStore` / `InMemoryTaskStore` |
|
|
122
|
+
| <a id="mcpa007"></a>MCPA007 | TS | low | `express()` + HTTP MCP transport with no Host-header validation or auth |
|
|
123
|
+
| <a id="mcpa101"></a>MCPA101 | Py | high | `ClientCredentialsOAuthProvider` / `PrivateKeyJWTOAuthProvider` / `RFC7523OAuthClientProvider` without `issuer=` |
|
|
124
|
+
| <a id="mcpa102"></a>MCPA102 | Py | medium | `AuthSettings(...)` without `validate_token_resource` |
|
|
125
|
+
| <a id="mcpa103"></a>MCPA103 | Py | medium | `follow_redirects=True` in files that use MCP client transports |
|
|
126
|
+
| <a id="mcpa104"></a>MCPA104 | Py | low | `StreamableHTTPSessionManager` / `SseServerTransport` / `websocket_server` without `security_settings` |
|
|
127
|
+
|
|
128
|
+
The rules are deliberately simple text heuristics. Comments and strings are masked, and definitions, spread or `**kwargs` options, and options passed by variable are skipped rather than guessed at. Every finding names the advisory behind it, so you can confirm or dismiss it in seconds. Tuning: against the official `typescript-sdk`, `python-sdk`, `servers` and `github-mcp-server` repos, the remaining findings are SDK examples that leave `expectedResource` / `validate_token_resource` unset. The advisories themselves describe that pattern.
|
|
129
|
+
|
|
130
|
+
No Go source rules yet: the Go advisories are fixed by upgrading alone. Go dependencies are still version-checked.
|
|
131
|
+
|
|
132
|
+
## Keeping advisories current
|
|
133
|
+
|
|
134
|
+
The package ships a snapshot of the advisories in [`src/mcp_sdk_audit/data/advisories.json`](src/mcp_sdk_audit/data/advisories.json). A scheduled workflow refreshes it daily and opens a PR. `--online` (and the Action's default) queries the GitHub Advisory Database at scan time instead, using `GITHUB_TOKEN` if it's set.
|
|
135
|
+
|
|
136
|
+
## Scope and responsible use
|
|
137
|
+
|
|
138
|
+
This is a defensive tool for code you own or are authorized to assess. It reads files and makes no network calls except `--online` advisory lookups to `api.github.com`. It doesn't exploit anything.
|
|
139
|
+
|
|
140
|
+
## Contributing
|
|
141
|
+
|
|
142
|
+
Issues and PRs are welcome, especially new rules when an advisory says "upgrading alone is not enough", false-positive reports with a minimal snippet, and more lockfile formats.
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
python -m venv .venv && . .venv/bin/activate
|
|
146
|
+
pip install -e ".[dev]"
|
|
147
|
+
pytest && ruff check . && ruff format --check .
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## License
|
|
151
|
+
|
|
152
|
+
[MIT](LICENSE)
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# mcp-sdk-audit
|
|
2
|
+
|
|
3
|
+
**Upgrading your MCP SDK isn't always enough. This finds the code that stays exposed after you upgrade.**
|
|
4
|
+
|
|
5
|
+
[](https://github.com/garag0l/mcp-sdk-audit/actions/workflows/ci.yml)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+

|
|
8
|
+

|
|
9
|
+
|
|
10
|
+
`mcp-sdk-audit` checks projects that use the official Model Context Protocol SDKs (TypeScript, Python, Go). It does two things:
|
|
11
|
+
|
|
12
|
+
1. **Dependencies.** It reads your lockfiles, including transitive dependencies, and matches every resolved MCP SDK version against the GitHub Advisory Database.
|
|
13
|
+
2. **Code.** Several 2026 advisories say that upgrading changes nothing unless you also change your code. The tool flags code that still has one of those problems, even when the SDK is already patched.
|
|
14
|
+
|
|
15
|
+

|
|
16
|
+
|
|
17
|
+
## Why this exists
|
|
18
|
+
|
|
19
|
+
Between December 2025 and November 2026 the official MCP SDKs received a run of security advisories. Several of them have a fix that is **off by default**, or that only works once your code changes:
|
|
20
|
+
|
|
21
|
+
| Advisory | What upgrading alone leaves open |
|
|
22
|
+
|---|---|
|
|
23
|
+
| [GHSA-6qxp-vccf-f47h](https://github.com/advisories/GHSA-6qxp-vccf-f47h) (TS) / [GHSA-qx49-fqc8-xw99](https://github.com/advisories/GHSA-qx49-fqc8-xw99) (Py) | Bundled client-credentials and private-key-JWT providers still send secrets to whichever authorization server the MCP server names, until you pass `expectedIssuer` / `issuer=`. |
|
|
24
|
+
| [GHSA-rvq5-wwqv-78pq](https://github.com/advisories/GHSA-rvq5-wwqv-78pq) (TS) / [GHSA-w4fh-qvv9-3v23](https://github.com/advisories/GHSA-w4fh-qvv9-3v23) (Py) | Bearer auth accepts tokens issued for *other* services until you set `expectedResource` / `validate_token_resource=True`. |
|
|
25
|
+
| [GHSA-345p-7cg4-v4c7](https://github.com/advisories/GHSA-345p-7cg4-v4c7), [GHSA-jm63-cq47-j5jp](https://github.com/advisories/GHSA-jm63-cq47-j5jp) (TS) | A transport or server created once at startup and shared across clients sends one client's responses to another. Older README examples showed this pattern, and patched SDKs now fail at runtime on it. |
|
|
26
|
+
| [GHSA-6prh-2h8m-c8cw](https://github.com/advisories/GHSA-6prh-2h8m-c8cw) (TS) / [GHSA-5h93-6whr-6q8j](https://github.com/advisories/GHSA-5h93-6whr-6q8j) (Py) | `redirectPolicy: 'follow'` or a `follow_redirects=True` client brings back cross-origin redirect leaks of API keys and token-request bodies. |
|
|
27
|
+
| [GHSA-w48q-cv73-mx4w](https://github.com/advisories/GHSA-w48q-cv73-mx4w), [GHSA-9h52-p55h-vw2f](https://github.com/advisories/GHSA-9h52-p55h-vw2f), [GHSA-vj7q-gjh5-988w](https://github.com/advisories/GHSA-vj7q-gjh5-988w) | Hand-built Express apps and low-level Python transports get no DNS-rebinding / Host-header protection unless you add it. |
|
|
28
|
+
|
|
29
|
+
Dependabot, `npm audit`, `pip-audit` and `osv-scanner` stop being useful once the version is bumped. That's exactly the point where these advisories still need a code change.
|
|
30
|
+
|
|
31
|
+
## Install
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pipx install mcp-sdk-audit
|
|
35
|
+
# or
|
|
36
|
+
pip install mcp-sdk-audit
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Python 3.11+ and no third-party dependencies.
|
|
40
|
+
|
|
41
|
+
## Usage
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
mcp-sdk-audit # scan the current directory
|
|
45
|
+
mcp-sdk-audit path/to/project
|
|
46
|
+
mcp-sdk-audit --online # use the latest advisories instead of the bundled snapshot
|
|
47
|
+
mcp-sdk-audit -f sarif -o mcp.sarif # SARIF for GitHub code scanning
|
|
48
|
+
mcp-sdk-audit -f json # machine-readable
|
|
49
|
+
mcp-sdk-audit --fail-on high # exit 1 only on high/critical (default: medium)
|
|
50
|
+
mcp-sdk-audit --include-tests # also check test files (skipped by default)
|
|
51
|
+
mcp-sdk-audit --list-rules
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Exit codes: `0` nothing at or above `--fail-on`, `1` findings, `2` usage error.
|
|
55
|
+
|
|
56
|
+
### GitHub Action
|
|
57
|
+
|
|
58
|
+
```yaml
|
|
59
|
+
name: mcp-sdk-audit
|
|
60
|
+
on: [push, pull_request]
|
|
61
|
+
permissions:
|
|
62
|
+
contents: read
|
|
63
|
+
security-events: write # for SARIF upload
|
|
64
|
+
jobs:
|
|
65
|
+
audit:
|
|
66
|
+
runs-on: ubuntu-latest
|
|
67
|
+
steps:
|
|
68
|
+
- uses: actions/checkout@v7
|
|
69
|
+
- uses: garag0l/mcp-sdk-audit@v0.1.2
|
|
70
|
+
with:
|
|
71
|
+
fail-on: high # critical | high | medium | low | none
|
|
72
|
+
# upload-sarif: "true"
|
|
73
|
+
# online: "true" # fetch fresh advisories with the job's GITHUB_TOKEN
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Findings show up under **Security → Code scanning**, and the text report is added to the job summary.
|
|
77
|
+
|
|
78
|
+
## What it reads
|
|
79
|
+
|
|
80
|
+
| Ecosystem | Files |
|
|
81
|
+
|---|---|
|
|
82
|
+
| npm | `package-lock.json`, `npm-shrinkwrap.json`, `pnpm-lock.yaml`, `yarn.lock` (v1 and Berry), `bun.lock` |
|
|
83
|
+
| PyPI | `uv.lock`, `poetry.lock`, `pdm.lock`, `Pipfile.lock`, `requirements*.txt` (pinned) |
|
|
84
|
+
| Go | `go.mod` |
|
|
85
|
+
|
|
86
|
+
Packages: `@modelcontextprotocol/{sdk,client,server,server-legacy,core,node,express,hono,fastify}`, `mcp` (PyPI), `github.com/modelcontextprotocol/go-sdk`.
|
|
87
|
+
|
|
88
|
+
## Source rules
|
|
89
|
+
|
|
90
|
+
| ID | Lang | Severity | Flags |
|
|
91
|
+
|---|---|---|---|
|
|
92
|
+
| <a id="mcpa001"></a>MCPA001 | TS | high | `ClientCredentialsProvider` / `PrivateKeyJwtProvider` / `StaticPrivateKeyJwtProvider` / `CrossAppAccessProvider` without `expectedIssuer` |
|
|
93
|
+
| <a id="mcpa002"></a>MCPA002 | TS | medium | `requireBearerAuth()` / `verifyBearerToken()` without `expectedResource` |
|
|
94
|
+
| <a id="mcpa003"></a>MCPA003 | TS | medium | `redirectPolicy: 'follow'` |
|
|
95
|
+
| <a id="mcpa004"></a>MCPA004 | TS | high | Stateless HTTP server transport created at module scope in a file that serves HTTP |
|
|
96
|
+
| <a id="mcpa005"></a>MCPA005 | TS | high | Module-scope `McpServer`/`Server` that `connect()`s inside a request handler |
|
|
97
|
+
| <a id="mcpa006"></a>MCPA006 | TS | medium | Deprecated experimental `taskStore` / `InMemoryTaskStore` |
|
|
98
|
+
| <a id="mcpa007"></a>MCPA007 | TS | low | `express()` + HTTP MCP transport with no Host-header validation or auth |
|
|
99
|
+
| <a id="mcpa101"></a>MCPA101 | Py | high | `ClientCredentialsOAuthProvider` / `PrivateKeyJWTOAuthProvider` / `RFC7523OAuthClientProvider` without `issuer=` |
|
|
100
|
+
| <a id="mcpa102"></a>MCPA102 | Py | medium | `AuthSettings(...)` without `validate_token_resource` |
|
|
101
|
+
| <a id="mcpa103"></a>MCPA103 | Py | medium | `follow_redirects=True` in files that use MCP client transports |
|
|
102
|
+
| <a id="mcpa104"></a>MCPA104 | Py | low | `StreamableHTTPSessionManager` / `SseServerTransport` / `websocket_server` without `security_settings` |
|
|
103
|
+
|
|
104
|
+
The rules are deliberately simple text heuristics. Comments and strings are masked, and definitions, spread or `**kwargs` options, and options passed by variable are skipped rather than guessed at. Every finding names the advisory behind it, so you can confirm or dismiss it in seconds. Tuning: against the official `typescript-sdk`, `python-sdk`, `servers` and `github-mcp-server` repos, the remaining findings are SDK examples that leave `expectedResource` / `validate_token_resource` unset. The advisories themselves describe that pattern.
|
|
105
|
+
|
|
106
|
+
No Go source rules yet: the Go advisories are fixed by upgrading alone. Go dependencies are still version-checked.
|
|
107
|
+
|
|
108
|
+
## Keeping advisories current
|
|
109
|
+
|
|
110
|
+
The package ships a snapshot of the advisories in [`src/mcp_sdk_audit/data/advisories.json`](src/mcp_sdk_audit/data/advisories.json). A scheduled workflow refreshes it daily and opens a PR. `--online` (and the Action's default) queries the GitHub Advisory Database at scan time instead, using `GITHUB_TOKEN` if it's set.
|
|
111
|
+
|
|
112
|
+
## Scope and responsible use
|
|
113
|
+
|
|
114
|
+
This is a defensive tool for code you own or are authorized to assess. It reads files and makes no network calls except `--online` advisory lookups to `api.github.com`. It doesn't exploit anything.
|
|
115
|
+
|
|
116
|
+
## Contributing
|
|
117
|
+
|
|
118
|
+
Issues and PRs are welcome, especially new rules when an advisory says "upgrading alone is not enough", false-positive reports with a minimal snippet, and more lockfile formats.
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
python -m venv .venv && . .venv/bin/activate
|
|
122
|
+
pip install -e ".[dev]"
|
|
123
|
+
pytest && ruff check . && ruff format --check .
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## License
|
|
127
|
+
|
|
128
|
+
[MIT](LICENSE)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Security policy
|
|
2
|
+
|
|
3
|
+
Please report vulnerabilities in mcp-sdk-audit itself privately through GitHub's
|
|
4
|
+
[private vulnerability reporting](https://github.com/garag0l/mcp-sdk-audit/security/advisories/new),
|
|
5
|
+
not through public issues.
|
|
6
|
+
|
|
7
|
+
Vulnerabilities in the MCP SDKs belong upstream:
|
|
8
|
+
[typescript-sdk](https://github.com/modelcontextprotocol/typescript-sdk/security),
|
|
9
|
+
[python-sdk](https://github.com/modelcontextprotocol/python-sdk/security),
|
|
10
|
+
[go-sdk](https://github.com/modelcontextprotocol/go-sdk/security).
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
name: mcp-sdk-audit
|
|
2
|
+
description: Find MCP SDK versions with known advisories, and the code that stays exposed after you upgrade.
|
|
3
|
+
author: garag0l
|
|
4
|
+
branding:
|
|
5
|
+
icon: shield
|
|
6
|
+
color: red
|
|
7
|
+
|
|
8
|
+
inputs:
|
|
9
|
+
path:
|
|
10
|
+
description: Directory to scan.
|
|
11
|
+
default: "."
|
|
12
|
+
fail-on:
|
|
13
|
+
description: Fail the step at or above this severity (critical, high, medium, low, none).
|
|
14
|
+
default: medium
|
|
15
|
+
upload-sarif:
|
|
16
|
+
description: "Upload results to GitHub code scanning (needs security-events: write)."
|
|
17
|
+
default: "true"
|
|
18
|
+
online:
|
|
19
|
+
description: Fetch the latest advisories from the GitHub Advisory Database instead of the bundled snapshot.
|
|
20
|
+
default: "true"
|
|
21
|
+
include-tests:
|
|
22
|
+
description: Also apply source rules to test files.
|
|
23
|
+
default: "false"
|
|
24
|
+
|
|
25
|
+
outputs:
|
|
26
|
+
sarif:
|
|
27
|
+
description: Path to the SARIF report.
|
|
28
|
+
value: ${{ steps.scan.outputs.sarif }}
|
|
29
|
+
|
|
30
|
+
runs:
|
|
31
|
+
using: composite
|
|
32
|
+
steps:
|
|
33
|
+
- name: Install mcp-sdk-audit
|
|
34
|
+
shell: bash
|
|
35
|
+
run: python3 -m pip install --quiet --disable-pip-version-check "$GITHUB_ACTION_PATH"
|
|
36
|
+
|
|
37
|
+
- name: Scan
|
|
38
|
+
id: scan
|
|
39
|
+
shell: bash
|
|
40
|
+
env:
|
|
41
|
+
GITHUB_TOKEN: ${{ github.token }}
|
|
42
|
+
INPUT_PATH: ${{ inputs.path }}
|
|
43
|
+
INPUT_FAIL_ON: ${{ inputs.fail-on }}
|
|
44
|
+
INPUT_ONLINE: ${{ inputs.online }}
|
|
45
|
+
INPUT_INCLUDE_TESTS: ${{ inputs.include-tests }}
|
|
46
|
+
run: |
|
|
47
|
+
args=("$INPUT_PATH")
|
|
48
|
+
[ "$INPUT_INCLUDE_TESTS" = "true" ] && args+=(--include-tests)
|
|
49
|
+
if [ "$INPUT_ONLINE" = "true" ]; then
|
|
50
|
+
db="$RUNNER_TEMP/mcp-advisories.json"
|
|
51
|
+
if python3 -m mcp_sdk_audit --update-snapshot "$db"; then
|
|
52
|
+
args+=(--advisories "$db")
|
|
53
|
+
else
|
|
54
|
+
echo "::warning::Could not fetch advisories; using the bundled snapshot."
|
|
55
|
+
fi
|
|
56
|
+
fi
|
|
57
|
+
sarif="$RUNNER_TEMP/mcp-sdk-audit.sarif"
|
|
58
|
+
python3 -m mcp_sdk_audit "${args[@]}" --fail-on none -f sarif -o "$sarif"
|
|
59
|
+
echo "sarif=$sarif" >> "$GITHUB_OUTPUT"
|
|
60
|
+
set +e
|
|
61
|
+
python3 -m mcp_sdk_audit "${args[@]}" --fail-on "$INPUT_FAIL_ON" --no-color > "$RUNNER_TEMP/mcp-sdk-audit.txt"
|
|
62
|
+
echo "code=$?" >> "$GITHUB_OUTPUT"
|
|
63
|
+
set -e
|
|
64
|
+
cat "$RUNNER_TEMP/mcp-sdk-audit.txt"
|
|
65
|
+
{ echo '```'; cat "$RUNNER_TEMP/mcp-sdk-audit.txt"; echo '```'; } >> "$GITHUB_STEP_SUMMARY"
|
|
66
|
+
|
|
67
|
+
- name: Upload SARIF
|
|
68
|
+
if: ${{ inputs.upload-sarif == 'true' }}
|
|
69
|
+
uses: github/codeql-action/upload-sarif@1bd86f2fdb4b86187fa4059f16f31a3202acc9ea # v4.39.4
|
|
70
|
+
with:
|
|
71
|
+
sarif_file: ${{ steps.scan.outputs.sarif }}
|
|
72
|
+
category: mcp-sdk-audit
|
|
73
|
+
|
|
74
|
+
- name: Enforce threshold
|
|
75
|
+
shell: bash
|
|
76
|
+
env:
|
|
77
|
+
CODE: ${{ steps.scan.outputs.code }}
|
|
78
|
+
INPUT_FAIL_ON: ${{ inputs.fail-on }}
|
|
79
|
+
run: |
|
|
80
|
+
if [ "$CODE" != "0" ]; then
|
|
81
|
+
echo "::error::mcp-sdk-audit found issues at or above '$INPUT_FAIL_ON' (exit $CODE)."
|
|
82
|
+
exit 1
|
|
83
|
+
fi
|