agent-mcp-guard 0.4.3 → 0.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.md +30 -2
  2. package/action.yml +40 -11
  3. package/docs/audit.md +51 -0
  4. package/docs/baseline.md +2 -2
  5. package/docs/business-playbook.md +3 -1
  6. package/docs/examples/e2e-example.md +6 -2
  7. package/docs/github-action.md +26 -6
  8. package/docs/launch-checklist.md +7 -1
  9. package/docs/marketplace-action-readme.md +22 -4
  10. package/docs/marketplace.md +6 -6
  11. package/docs/operator-runbook.md +1 -0
  12. package/docs/paid-audit.md +1 -0
  13. package/docs/policy.md +50 -0
  14. package/docs/roadmap.md +4 -3
  15. package/docs/rules.md +5 -1
  16. package/docs/trusted-publishing.md +2 -2
  17. package/examples/mcp-guard-policy.json +16 -0
  18. package/examples/sample-report.md +57 -47
  19. package/package.json +1 -1
  20. package/scripts/action-comment.js +14 -2
  21. package/scripts/action-summary.js +14 -2
  22. package/scripts/prepare-marketplace-action.js +2 -0
  23. package/site/e2e/audit/mcp-guard-audit-manifest.json +39 -0
  24. package/site/e2e/audit/mcp-guard-executive-summary.md +43 -0
  25. package/site/e2e/audit/mcp-guard-remediation.md +46 -0
  26. package/site/e2e/audit/mcp-guard-report.html +453 -0
  27. package/site/e2e/audit/mcp-guard-report.json +176 -0
  28. package/site/e2e/audit/mcp-guard-report.md +47 -0
  29. package/site/e2e/audit/mcp-guard.sarif +570 -0
  30. package/site/e2e/index.html +5 -1
  31. package/site/e2e/report.html +3 -1
  32. package/site/e2e/report.json +5 -2
  33. package/site/e2e/report.md +1 -1
  34. package/site/e2e/report.sarif +1 -1
  35. package/src/audit.js +300 -0
  36. package/src/baseline.js +3 -1
  37. package/src/cli.js +120 -1
  38. package/src/init.js +24 -3
  39. package/src/policy.js +109 -0
  40. package/src/report.js +50 -1
  41. package/src/rules.js +142 -0
  42. package/src/scan.js +7 -2
package/README.md CHANGED
@@ -19,7 +19,7 @@ Live demo PR: [mcp-guard-demo#1](https://github.com/ChaoYue0307/mcp-guard-demo/p
19
19
  <a href="https://github.com/marketplace/actions/mcp-guard-mcp-security-scanner"><img alt="GitHub Marketplace" src="https://img.shields.io/badge/Marketplace-mcp--guard-0f766e?logo=github"></a>
20
20
  <a href="https://github.com/ChaoYue0307/mcp-guard/actions"><img alt="CI" src="https://github.com/ChaoYue0307/mcp-guard/actions/workflows/ci.yml/badge.svg"></a>
21
21
  <a href="LICENSE"><img alt="License" src="https://img.shields.io/badge/license-Apache--2.0-111827"></a>
22
- <a href="https://github.com/ChaoYue0307/mcp-guard/releases/tag/v0.4.3"><img alt="Release" src="https://img.shields.io/github/v/release/ChaoYue0307/mcp-guard?color=7c2d12"></a>
22
+ <a href="https://github.com/ChaoYue0307/mcp-guard/releases/tag/v0.4.5"><img alt="Release" src="https://img.shields.io/github/v/release/ChaoYue0307/mcp-guard?color=7c2d12"></a>
23
23
  </p>
24
24
 
25
25
  ## Install
@@ -65,12 +65,24 @@ Generate SARIF for GitHub code scanning:
65
65
  mcp-guard scan --format sarif --output mcp-guard.sarif
66
66
  ```
67
67
 
68
+ Generate a review-ready audit pack:
69
+
70
+ ```bash
71
+ mcp-guard audit --config .mcp.json --policy .mcp-guard-policy.json --output-dir mcp-guard-audit
72
+ ```
73
+
68
74
  Use in CI:
69
75
 
70
76
  ```bash
71
77
  mcp-guard scan --config .mcp.json --fail-on high
72
78
  ```
73
79
 
80
+ Enforce a team policy for approved commands, packages, directories, and remote URLs:
81
+
82
+ ```bash
83
+ mcp-guard scan --config .mcp.json --policy .mcp-guard-policy.json --fail-on high
84
+ ```
85
+
74
86
  Accept known findings and fail only on new risk:
75
87
 
76
88
  ```bash
@@ -81,9 +93,10 @@ mcp-guard scan --config .mcp.json --baseline .mcp-guard-baseline.json --fail-on
81
93
  Use the GitHub Action:
82
94
 
83
95
  ```yaml
84
- - uses: ChaoYue0307/mcp-guard-action@v0.4.3
96
+ - uses: ChaoYue0307/mcp-guard-action@v0.4.5
85
97
  with:
86
98
  config: .mcp.json
99
+ # policy: .mcp-guard-policy.json
87
100
  baseline: .mcp-guard-baseline.json
88
101
  fail-on: high
89
102
  comment-pr: "true"
@@ -101,6 +114,8 @@ Use the transparent example to evaluate what the scanner actually does:
101
114
  - generated HTML report: [site/e2e/report.html](site/e2e/report.html)
102
115
  - generated JSON report: [site/e2e/report.json](site/e2e/report.json)
103
116
  - generated SARIF report: [site/e2e/report.sarif](site/e2e/report.sarif)
117
+ - generated audit summary: [site/e2e/audit/mcp-guard-executive-summary.md](site/e2e/audit/mcp-guard-executive-summary.md)
118
+ - generated remediation plan: [site/e2e/audit/mcp-guard-remediation.md](site/e2e/audit/mcp-guard-remediation.md)
104
119
 
105
120
  The example scans 3 MCP servers and reports 9 active findings with a risk score of 98. It is synthetic, but fully reproducible from committed files.
106
121
 
@@ -117,6 +132,7 @@ For the GitHub Action workflow, inspect the public demo repository: [ChaoYue0307
117
132
  | Broad filesystem access | Home, root, Desktop, Documents, and Downloads are high-blast-radius paths. |
118
133
  | Remote MCP URLs | Data may leave the local trust boundary. |
119
134
  | Dangerous command patterns | `rm -rf`, `sudo`, `chmod 777`, and curl-pipe-shell should block review. |
135
+ | Policy violations | Teams can enforce approved commands, packages, directories, and remote URLs. |
120
136
 
121
137
  ## Team Workflow
122
138
 
@@ -129,6 +145,15 @@ For the GitHub Action workflow, inspect the public demo repository: [ChaoYue0307
129
145
 
130
146
  The GitHub Action can also post an optional pull request comment with the active finding summary.
131
147
 
148
+ For paid setup or internal review handoff, `mcp-guard audit` writes a complete evidence package with:
149
+
150
+ - executive summary;
151
+ - remediation plan grouped by MCP server;
152
+ - Markdown, HTML, JSON, and SARIF reports;
153
+ - machine-readable audit manifest.
154
+
155
+ For stricter governance, commit `.mcp-guard-policy.json` and define the commands, remote packages, filesystem roots, and remote MCP endpoints the team has approved. See [Policy files](docs/policy.md).
156
+
132
157
  For a guided setup, run:
133
158
 
134
159
  ```bash
@@ -193,6 +218,7 @@ Typical scope:
193
218
 
194
219
  - install and run the CLI against redacted local MCP configs;
195
220
  - create the GitHub Action workflow;
221
+ - define an initial `.mcp-guard-policy.json`;
196
222
  - generate and review an initial baseline;
197
223
  - enable PR comments and optional GitHub code scanning;
198
224
  - record missing rules or config shapes as product feedback.
@@ -202,7 +228,9 @@ Contact: [hechaoyue0307@gmail.com](mailto:hechaoyue0307@gmail.com)
202
228
  ## Documentation
203
229
 
204
230
  - [Rule reference](docs/rules.md)
231
+ - [Audit packs](docs/audit.md)
205
232
  - [Baseline and allowlist](docs/baseline.md)
233
+ - [Policy files](docs/policy.md)
206
234
  - [GitHub Action](docs/github-action.md)
207
235
  - [Marketplace publishing plan](docs/marketplace.md)
208
236
  - [Privacy and security](docs/privacy-and-security.md)
package/action.yml CHANGED
@@ -19,6 +19,10 @@ inputs:
19
19
  description: Optional mcp-guard baseline/allowlist JSON path. Matching findings are accepted and do not fail the workflow.
20
20
  required: false
21
21
  default: ""
22
+ policy:
23
+ description: Optional mcp-guard policy JSON path. Leave empty to auto-load .mcp-guard-policy.json when present.
24
+ required: false
25
+ default: ""
22
26
  comment-pr:
23
27
  description: "Post or update a pull request comment with the scan summary. Requires pull-requests: write permission."
24
28
  required: false
@@ -41,6 +45,9 @@ inputs:
41
45
  default: mcp-guard-report
42
46
 
43
47
  outputs:
48
+ executive-summary:
49
+ description: Path to the generated executive summary.
50
+ value: ${{ steps.reports.outputs.executive-summary }}
44
51
  markdown-report:
45
52
  description: Path to the generated Markdown report.
46
53
  value: ${{ steps.reports.outputs.markdown-report }}
@@ -53,6 +60,12 @@ outputs:
53
60
  sarif-report:
54
61
  description: Path to the generated SARIF report.
55
62
  value: ${{ steps.reports.outputs.sarif-report }}
63
+ remediation-report:
64
+ description: Path to the generated remediation plan.
65
+ value: ${{ steps.reports.outputs.remediation-report }}
66
+ audit-manifest:
67
+ description: Path to the generated audit pack manifest.
68
+ value: ${{ steps.reports.outputs.audit-manifest }}
56
69
  exit-code:
57
70
  description: mcp-guard threshold exit code.
58
71
  value: ${{ steps.reports.outputs.exit-code }}
@@ -67,6 +80,7 @@ runs:
67
80
  uses: actions/setup-node@v6
68
81
  with:
69
82
  node-version: "24"
83
+ package-manager-cache: false
70
84
 
71
85
  - name: Generate reports
72
86
  id: reports
@@ -74,6 +88,7 @@ runs:
74
88
  env:
75
89
  MCP_GUARD_CONFIG: ${{ inputs.config }}
76
90
  MCP_GUARD_BASELINE: ${{ inputs.baseline }}
91
+ MCP_GUARD_POLICY: ${{ inputs.policy }}
77
92
  MCP_GUARD_FAIL_ON: ${{ inputs.fail-on }}
78
93
  MCP_GUARD_OUTPUT_DIR: ${{ inputs.output-dir }}
79
94
  run: |
@@ -89,34 +104,45 @@ runs:
89
104
  if [ -n "${MCP_GUARD_BASELINE}" ]; then
90
105
  scan_args+=(--baseline "${MCP_GUARD_BASELINE}")
91
106
  fi
107
+ if [ -n "${MCP_GUARD_POLICY}" ]; then
108
+ scan_args+=(--policy "${MCP_GUARD_POLICY}")
109
+ fi
92
110
 
93
111
  markdown_report="${MCP_GUARD_OUTPUT_DIR}/mcp-guard-report.md"
94
112
  html_report="${MCP_GUARD_OUTPUT_DIR}/mcp-guard-report.html"
95
113
  json_report="${MCP_GUARD_OUTPUT_DIR}/mcp-guard-report.json"
96
114
  sarif_report="${MCP_GUARD_OUTPUT_DIR}/mcp-guard.sarif"
115
+ executive_summary="${MCP_GUARD_OUTPUT_DIR}/mcp-guard-executive-summary.md"
116
+ remediation_report="${MCP_GUARD_OUTPUT_DIR}/mcp-guard-remediation.md"
117
+ audit_manifest="${MCP_GUARD_OUTPUT_DIR}/mcp-guard-audit-manifest.json"
97
118
  comment_report="${MCP_GUARD_OUTPUT_DIR}/mcp-guard-pr-comment.md"
98
119
 
99
- node "${guard_bin}" scan "${scan_args[@]}" --format markdown --output "${markdown_report}" --fail-on none
100
- node "${guard_bin}" scan "${scan_args[@]}" --format html --output "${html_report}" --fail-on none
101
- node "${guard_bin}" scan "${scan_args[@]}" --format json --output "${json_report}" --fail-on none
102
- node "${guard_bin}" scan "${scan_args[@]}" --format sarif --output "${sarif_report}" --fail-on none
120
+ set +e
121
+ node "${guard_bin}" audit "${scan_args[@]}" --output-dir "${MCP_GUARD_OUTPUT_DIR}" --fail-on "${MCP_GUARD_FAIL_ON}"
122
+ status="$?"
123
+ set -e
124
+ if [ "${status}" != "0" ] && [ "${status}" != "2" ]; then
125
+ exit "${status}"
126
+ fi
127
+
103
128
  node "${GITHUB_ACTION_PATH}/scripts/action-comment.js" \
104
129
  "${json_report}" \
105
130
  "${markdown_report}" \
106
131
  "${html_report}" \
107
132
  "${sarif_report}" \
108
- "${MCP_GUARD_FAIL_ON}" > "${comment_report}"
109
-
110
- set +e
111
- node "${guard_bin}" scan "${scan_args[@]}" --fail-on "${MCP_GUARD_FAIL_ON}"
112
- status="$?"
113
- set -e
133
+ "${MCP_GUARD_FAIL_ON}" \
134
+ "${executive_summary}" \
135
+ "${remediation_report}" \
136
+ "${audit_manifest}" > "${comment_report}"
114
137
 
115
138
  {
139
+ echo "executive-summary=${executive_summary}"
116
140
  echo "markdown-report=${markdown_report}"
117
141
  echo "html-report=${html_report}"
118
142
  echo "json-report=${json_report}"
119
143
  echo "sarif-report=${sarif_report}"
144
+ echo "remediation-report=${remediation_report}"
145
+ echo "audit-manifest=${audit_manifest}"
120
146
  echo "comment-report=${comment_report}"
121
147
  echo "exit-code=${status}"
122
148
  } >> "${GITHUB_OUTPUT}"
@@ -132,7 +158,10 @@ runs:
132
158
  "${{ steps.reports.outputs.markdown-report }}" \
133
159
  "${{ steps.reports.outputs.html-report }}" \
134
160
  "${{ steps.reports.outputs.sarif-report }}" \
135
- "${MCP_GUARD_FAIL_ON}" >> "${GITHUB_STEP_SUMMARY}"
161
+ "${MCP_GUARD_FAIL_ON}" \
162
+ "${{ steps.reports.outputs.executive-summary }}" \
163
+ "${{ steps.reports.outputs.remediation-report }}" \
164
+ "${{ steps.reports.outputs.audit-manifest }}" >> "${GITHUB_STEP_SUMMARY}"
136
165
 
137
166
  - name: Comment on pull request
138
167
  if: ${{ always() && inputs.comment-pr == 'true' && github.event_name == 'pull_request' && steps.reports.outputs.comment-report != '' }}
package/docs/audit.md ADDED
@@ -0,0 +1,51 @@
1
+ # Audit Packs
2
+
3
+ `mcp-guard audit` generates a review-ready evidence package for setup pilots, internal security reviews, and customer handoff notes.
4
+
5
+ It runs the same scanner as `mcp-guard scan`, then writes a directory with human-readable reports, machine-readable outputs, and a manifest.
6
+
7
+ ## Usage
8
+
9
+ ```bash
10
+ mcp-guard audit --config .mcp.json --policy .mcp-guard-policy.json --output-dir mcp-guard-audit
11
+ ```
12
+
13
+ Use a baseline when the team has accepted known findings:
14
+
15
+ ```bash
16
+ mcp-guard audit \
17
+ --config .mcp.json \
18
+ --baseline .mcp-guard-baseline.json \
19
+ --policy .mcp-guard-policy.json \
20
+ --output-dir mcp-guard-audit
21
+ ```
22
+
23
+ Use `--fail-on` in CI when the audit should write artifacts and then fail on active risk:
24
+
25
+ ```bash
26
+ mcp-guard audit --config .mcp.json --fail-on high
27
+ ```
28
+
29
+ ## Generated Files
30
+
31
+ | File | Purpose |
32
+ | --- | --- |
33
+ | `mcp-guard-executive-summary.md` | Short decision summary for founders, security leads, and engineering managers. |
34
+ | `mcp-guard-remediation.md` | Server-by-server remediation plan with evidence and fixes. |
35
+ | `mcp-guard-report.md` | Full Markdown scan report. |
36
+ | `mcp-guard-report.html` | Readable HTML report for review artifacts. |
37
+ | `mcp-guard-report.json` | Redacted machine-readable report for automation. |
38
+ | `mcp-guard.sarif` | SARIF 2.1.0 report for GitHub code scanning. |
39
+ | `mcp-guard-audit-manifest.json` | Manifest listing status, summary, policy/baseline context, and file paths. |
40
+
41
+ ## Review Flow
42
+
43
+ 1. Run `mcp-guard audit` locally or through the GitHub Action.
44
+ 2. Open `mcp-guard-executive-summary.md` to decide whether the MCP setup is acceptable.
45
+ 3. Work through `mcp-guard-remediation.md` with the engineering team.
46
+ 4. Use `mcp-guard-report.html` for readable evidence and `mcp-guard-report.json` or `mcp-guard.sarif` for automation.
47
+ 5. Commit a reviewed policy and baseline only after the team has decided what risk is intentionally accepted.
48
+
49
+ ## Privacy
50
+
51
+ The audit pack is generated locally. Secret-like environment variables and headers are redacted in reports before they are written.
package/docs/baseline.md CHANGED
@@ -30,7 +30,7 @@ If the scan finds only baseline-accepted findings, the exit code is `0`. If a ne
30
30
  ## GitHub Action
31
31
 
32
32
  ```yaml
33
- - uses: ChaoYue0307/mcp-guard-action@v0.4.3
33
+ - uses: ChaoYue0307/mcp-guard-action@v0.4.5
34
34
  with:
35
35
  config: .mcp.json
36
36
  baseline: .mcp-guard-baseline.json
@@ -45,7 +45,7 @@ The generated Markdown, HTML, JSON, and PR comment separate active findings from
45
45
  {
46
46
  "version": 1,
47
47
  "generatedAt": "2026-05-10T00:00:00.000Z",
48
- "toolVersion": "0.4.3",
48
+ "toolVersion": "0.4.5",
49
49
  "findings": [
50
50
  {
51
51
  "fingerprint": "mcpg_a009b2c2",
@@ -17,6 +17,8 @@ Deliverables:
17
17
  - install the CLI and GitHub Action;
18
18
  - run `mcp-guard init` or generate an equivalent workflow manually;
19
19
  - generate Markdown, HTML, JSON, and SARIF reports;
20
+ - generate a customer handoff audit pack with executive summary, remediation plan, reports, and manifest;
21
+ - define an initial `.mcp-guard-policy.json` for approved commands, packages, directories, and remote URLs;
20
22
  - create an initial baseline for accepted known findings;
21
23
  - enable PR comments and optional SARIF upload;
22
24
  - document missing rule requests for future product work;
@@ -39,7 +41,7 @@ I built mcp-guard, an open-source local scanner for MCP and AI agent tool config
39
41
 
40
42
  It checks for risky shell access, unpinned npx packages, broad filesystem permissions, exposed secrets, and remote MCP servers.
41
43
 
42
- It now includes `mcp-guard init`, which creates a GitHub Action workflow and can generate a baseline for accepted current findings.
44
+ It now includes `mcp-guard init`, which creates a GitHub Action workflow, can generate a baseline for accepted current findings, can enforce a committed policy for approved MCP commands, packages, directories, and URLs, and can export a review-ready audit pack.
43
45
 
44
46
  I am collecting real-world MCP and AI agent config patterns from teams using Claude, Cursor, Codex, or MCP in production-like workflows. If you can share a redacted config or run the CLI locally, your feedback can help improve the scanner's rules and reports.
45
47
  ```
@@ -1,6 +1,6 @@
1
1
  # End-to-End Example
2
2
 
3
- This example is designed for transparent product evaluation. It uses a synthetic MCP config committed to the repository, then runs the real `mcp-guard` CLI to generate Markdown, HTML, JSON, and SARIF outputs.
3
+ This example is designed for transparent product evaluation. It uses a synthetic MCP config committed to the repository, then runs the real `mcp-guard` CLI to generate Markdown, HTML, JSON, SARIF, and audit pack outputs.
4
4
 
5
5
  The input is intentionally unsafe so users can see whether the scanner catches concrete risks.
6
6
 
@@ -23,6 +23,7 @@ node ./bin/mcp-guard.js scan --config site/e2e/claude_desktop_config.json --form
23
23
  node ./bin/mcp-guard.js scan --config site/e2e/claude_desktop_config.json --format html --output site/e2e/report.html
24
24
  node ./bin/mcp-guard.js scan --config site/e2e/claude_desktop_config.json --format json --output site/e2e/report.json
25
25
  node ./bin/mcp-guard.js scan --config site/e2e/claude_desktop_config.json --format sarif --output site/e2e/report.sarif
26
+ node ./bin/mcp-guard.js audit --config site/e2e/claude_desktop_config.json --output-dir site/e2e/audit
26
27
  ```
27
28
 
28
29
  ## Expected Result
@@ -51,10 +52,13 @@ Important findings include:
51
52
  - [HTML report](../../site/e2e/report.html)
52
53
  - [JSON report](../../site/e2e/report.json)
53
54
  - [SARIF report](../../site/e2e/report.sarif)
55
+ - [Audit executive summary](../../site/e2e/audit/mcp-guard-executive-summary.md)
56
+ - [Audit remediation plan](../../site/e2e/audit/mcp-guard-remediation.md)
57
+ - [Audit manifest](../../site/e2e/audit/mcp-guard-audit-manifest.json)
54
58
 
55
59
  ## What This Proves
56
60
 
57
61
  - The scanner does not need the config to leave the machine.
58
62
  - Secret-like values are redacted in reports.
59
63
  - Findings include rule IDs, severity, evidence, and remediation guidance.
60
- - The same scan can feed a human-readable HTML report, automation JSON, and GitHub code scanning SARIF.
64
+ - The same scan can feed a human-readable HTML report, automation JSON, GitHub code scanning SARIF, and a review-ready audit handoff package.
@@ -2,9 +2,11 @@
2
2
 
3
3
  Use the `mcp-guard` action to scan MCP and AI agent tool configuration in pull requests and CI.
4
4
 
5
- The action runs the CLI from the pinned GitHub Action tag, generates Markdown, HTML, JSON, and SARIF reports, writes a job summary, uploads reports as an artifact, and fails the job when findings meet your selected severity threshold.
5
+ The action runs the CLI from the pinned GitHub Action tag, generates an audit pack with Markdown, HTML, JSON, SARIF, remediation, and manifest files, writes a job summary, uploads reports as an artifact, and fails the job when findings meet your selected severity threshold.
6
6
 
7
- It can also use a committed baseline to accept known findings and optionally post a pull request comment with only the active findings.
7
+ It can also use a committed baseline to accept known findings, enforce a committed policy file, and optionally post a pull request comment with only the active findings.
8
+
9
+ If `.mcp-guard-policy.json` is committed at the repository root, the CLI auto-loads it. Use the `policy` input when the policy file lives elsewhere.
8
10
 
9
11
  Marketplace/action repository: <https://github.com/ChaoYue0307/mcp-guard-action>
10
12
 
@@ -35,7 +37,7 @@ jobs:
35
37
  runs-on: ubuntu-latest
36
38
  steps:
37
39
  - uses: actions/checkout@v6
38
- - uses: ChaoYue0307/mcp-guard-action@v0.4.3
40
+ - uses: ChaoYue0307/mcp-guard-action@v0.4.5
39
41
  with:
40
42
  config: .mcp.json
41
43
  fail-on: high
@@ -63,7 +65,7 @@ jobs:
63
65
  runs-on: ubuntu-latest
64
66
  steps:
65
67
  - uses: actions/checkout@v6
66
- - uses: ChaoYue0307/mcp-guard-action@v0.4.3
68
+ - uses: ChaoYue0307/mcp-guard-action@v0.4.5
67
69
  with:
68
70
  config: .mcp.json
69
71
  fail-on: high
@@ -75,7 +77,7 @@ jobs:
75
77
  Use `fail-on: none` when you want artifacts and summaries without blocking a pull request.
76
78
 
77
79
  ```yaml
78
- - uses: ChaoYue0307/mcp-guard-action@v0.4.3
80
+ - uses: ChaoYue0307/mcp-guard-action@v0.4.5
79
81
  with:
80
82
  fail-on: none
81
83
  ```
@@ -91,7 +93,7 @@ mcp-guard scan --config .mcp.json --write-baseline .mcp-guard-baseline.json
91
93
  Commit `.mcp-guard-baseline.json`, then reference it from the action:
92
94
 
93
95
  ```yaml
94
- - uses: ChaoYue0307/mcp-guard-action@v0.4.3
96
+ - uses: ChaoYue0307/mcp-guard-action@v0.4.5
95
97
  with:
96
98
  config: .mcp.json
97
99
  baseline: .mcp-guard-baseline.json
@@ -100,6 +102,20 @@ Commit `.mcp-guard-baseline.json`, then reference it from the action:
100
102
 
101
103
  Reports will show active findings separately from findings accepted by the baseline.
102
104
 
105
+ ## Policy Mode
106
+
107
+ Use a policy when you want CI to enforce approved commands, packages, directories, and remote URLs.
108
+
109
+ ```yaml
110
+ - uses: ChaoYue0307/mcp-guard-action@v0.4.5
111
+ with:
112
+ config: .mcp.json
113
+ policy: .mcp-guard-policy.json
114
+ fail-on: high
115
+ ```
116
+
117
+ See [Policy files](policy.md) for the file format.
118
+
103
119
  ## Inputs
104
120
 
105
121
  | Input | Default | Description |
@@ -107,6 +123,7 @@ Reports will show active findings separately from findings accepted by the basel
107
123
  | `config` | empty | Optional MCP config path. Empty scans default project and user config locations. |
108
124
  | `fail-on` | `high` | Fails the job for `critical`, `high`, `medium`, or `low` findings. Use `none` for report-only mode. |
109
125
  | `baseline` | empty | Optional baseline/allowlist JSON path. Matching findings are accepted and do not fail the workflow. |
126
+ | `policy` | empty | Optional policy JSON path. Empty auto-loads `.mcp-guard-policy.json` when present. |
110
127
  | `comment-pr` | `false` | Posts or updates a pull request comment with the scan summary. Requires `pull-requests: write`. |
111
128
  | `output-dir` | `mcp-guard-report` | Directory for generated reports. |
112
129
  | `upload-artifact` | `true` | Uploads generated reports as a workflow artifact. |
@@ -117,9 +134,12 @@ Reports will show active findings separately from findings accepted by the basel
117
134
 
118
135
  | Output | Description |
119
136
  | --- | --- |
137
+ | `executive-summary` | Path to the generated executive summary. |
120
138
  | `markdown-report` | Path to the generated Markdown report. |
121
139
  | `html-report` | Path to the generated HTML report. |
122
140
  | `json-report` | Path to the generated JSON report. |
123
141
  | `sarif-report` | Path to the generated SARIF report. |
142
+ | `remediation-report` | Path to the generated remediation plan. |
143
+ | `audit-manifest` | Path to the generated audit pack manifest. |
124
144
  | `comment-report` | Path to the generated pull request comment body. |
125
145
  | `exit-code` | `0` when below threshold, `2` when findings met the threshold. |
@@ -28,10 +28,16 @@ mcp-guard scan
28
28
  mcp-guard scan --config .mcp.json --fail-on high
29
29
  ```
30
30
 
31
+ ## Audit Pack
32
+
33
+ ```bash
34
+ mcp-guard audit --config .mcp.json --policy .mcp-guard-policy.json --output-dir mcp-guard-audit
35
+ ```
36
+
31
37
  ## GitHub Action Setup
32
38
 
33
39
  ```yaml
34
- - uses: ChaoYue0307/mcp-guard-action@v0.4.3
40
+ - uses: ChaoYue0307/mcp-guard-action@v0.4.5
35
41
  with:
36
42
  config: .mcp.json
37
43
  baseline: .mcp-guard-baseline.json
@@ -23,7 +23,7 @@ jobs:
23
23
  runs-on: ubuntu-latest
24
24
  steps:
25
25
  - uses: actions/checkout@v6
26
- - uses: ChaoYue0307/mcp-guard-action@v0.4.3
26
+ - uses: ChaoYue0307/mcp-guard-action@v0.4.5
27
27
  with:
28
28
  config: .mcp.json
29
29
  fail-on: high
@@ -42,7 +42,7 @@ jobs:
42
42
  runs-on: ubuntu-latest
43
43
  steps:
44
44
  - uses: actions/checkout@v6
45
- - uses: ChaoYue0307/mcp-guard-action@v0.4.3
45
+ - uses: ChaoYue0307/mcp-guard-action@v0.4.5
46
46
  with:
47
47
  config: .mcp.json
48
48
  fail-on: high
@@ -56,6 +56,7 @@ jobs:
56
56
  | `config` | empty | Optional MCP config path. Empty scans default project and user config locations. |
57
57
  | `fail-on` | `high` | Fails the job for `critical`, `high`, `medium`, or `low` findings. Use `none` for report-only mode. |
58
58
  | `baseline` | empty | Optional baseline/allowlist JSON path. Matching findings are accepted and do not fail the workflow. |
59
+ | `policy` | empty | Optional policy JSON path. Empty auto-loads `.mcp-guard-policy.json` when present. |
59
60
  | `comment-pr` | `false` | Posts or updates a pull request comment with the scan summary. Requires `pull-requests: write`. |
60
61
  | `output-dir` | `mcp-guard-report` | Directory for generated reports. |
61
62
  | `upload-artifact` | `true` | Uploads generated reports as a workflow artifact. |
@@ -66,21 +67,26 @@ jobs:
66
67
 
67
68
  | Output | Description |
68
69
  | --- | --- |
70
+ | `executive-summary` | Path to the generated executive summary. |
69
71
  | `markdown-report` | Path to the generated Markdown report. |
70
72
  | `html-report` | Path to the generated HTML report. |
71
73
  | `json-report` | Path to the generated JSON report. |
72
74
  | `sarif-report` | Path to the generated SARIF report. |
75
+ | `remediation-report` | Path to the generated remediation plan. |
76
+ | `audit-manifest` | Path to the generated audit pack manifest. |
73
77
  | `comment-report` | Path to the generated pull request comment body. |
74
78
  | `exit-code` | `0` when below threshold, `2` when findings met the threshold. |
75
79
 
76
80
  ## Reports
77
81
 
78
- The action generates:
82
+ The action generates an audit pack:
79
83
 
80
84
  - Markdown for pull request review.
81
85
  - HTML for review-ready artifacts.
82
86
  - JSON for automation.
83
87
  - SARIF 2.1.0 for GitHub code scanning.
88
+ - Remediation Markdown for server-by-server handoff.
89
+ - Audit manifest JSON for downstream automation.
84
90
 
85
91
  Secret-like values are redacted before reports are written.
86
92
 
@@ -95,13 +101,25 @@ mcp-guard scan --config .mcp.json --write-baseline .mcp-guard-baseline.json
95
101
  Then enforce only new findings:
96
102
 
97
103
  ```yaml
98
- - uses: ChaoYue0307/mcp-guard-action@v0.4.3
104
+ - uses: ChaoYue0307/mcp-guard-action@v0.4.5
99
105
  with:
100
106
  config: .mcp.json
101
107
  baseline: .mcp-guard-baseline.json
102
108
  fail-on: high
103
109
  ```
104
110
 
111
+ ## Policy Mode
112
+
113
+ Commit `.mcp-guard-policy.json` or pass `policy` to enforce approved commands, remote packages, directories, and remote MCP URLs.
114
+
115
+ ```yaml
116
+ - uses: ChaoYue0307/mcp-guard-action@v0.4.5
117
+ with:
118
+ config: .mcp.json
119
+ policy: .mcp-guard-policy.json
120
+ fail-on: high
121
+ ```
122
+
105
123
  ## Transparent Example
106
124
 
107
125
  Inspect a committed input config, reproduction commands, and generated Markdown, HTML, JSON, and SARIF artifacts:
@@ -82,17 +82,17 @@ Code quality
82
82
  Current release title:
83
83
 
84
84
  ```text
85
- v0.4.3
85
+ v0.4.5
86
86
  ```
87
87
 
88
88
  Release notes:
89
89
 
90
90
  ```text
91
- Trusted Publishing readiness release.
91
+ Audit pack release.
92
92
 
93
- - Adds a GitHub Actions workflow for npm Trusted Publishing readiness.
94
- - Keeps `mcp-guard init` for generating a GitHub Action workflow and baseline.
95
- - Keeps Node.js 24, PR comments, artifacts, and SARIF upload support.
93
+ - Adds `mcp-guard audit` for executive summary, remediation plan, Markdown, HTML, JSON, SARIF, and manifest outputs.
94
+ - The GitHub Action now uploads audit pack artifacts, including remediation and manifest files.
95
+ - Keeps policy enforcement, baseline support, PR comments, artifacts, and SARIF upload support.
96
96
  ```
97
97
 
98
98
  ## Manual Publishing Steps
@@ -105,7 +105,7 @@ Completed:
105
105
  - README, docs, and website examples now use:
106
106
 
107
107
  ```yaml
108
- - uses: ChaoYue0307/mcp-guard-action@v0.4.3
108
+ - uses: ChaoYue0307/mcp-guard-action@v0.4.5
109
109
  ```
110
110
 
111
111
  Remaining Marketplace web step:
@@ -11,6 +11,7 @@ npm test
11
11
  npm run release:check
12
12
  npm --cache ./.npm-cache pack --dry-run
13
13
  node ./bin/mcp-guard.js scan --config examples/unsafe-claude_desktop_config.json
14
+ node ./bin/mcp-guard.js audit --config examples/unsafe-claude_desktop_config.json --policy examples/mcp-guard-policy.json --output-dir .release-check/audit-pack
14
15
  ```
15
16
 
16
17
  If your global npm cache has permission errors, either keep using the local cache flag above or fix ownership:
@@ -13,6 +13,7 @@ It is not currently advertised as an active consulting service. Keep public webs
13
13
  ## Deliverables
14
14
 
15
15
  - MCP and agent tool inventory.
16
+ - `mcp-guard audit` evidence pack with executive summary, remediation plan, reports, and manifest.
16
17
  - Risk report covering shell access, package execution, filesystem scope, secrets, remote servers, and dangerous commands.
17
18
  - Practical remediation checklist.
18
19
  - Optional PR with safer config and policy changes.
package/docs/policy.md ADDED
@@ -0,0 +1,50 @@
1
+ # Policy Files
2
+
3
+ Use a policy file when a team wants an explicit approval boundary for MCP servers, not just heuristic risk findings.
4
+
5
+ `mcp-guard scan` automatically loads `.mcp-guard-policy.json` from the working directory when the file exists. You can also pass a policy explicitly:
6
+
7
+ ```bash
8
+ mcp-guard scan --config .mcp.json --policy .mcp-guard-policy.json --fail-on high
9
+ ```
10
+
11
+ Disable automatic policy loading with:
12
+
13
+ ```bash
14
+ mcp-guard scan --no-policy
15
+ ```
16
+
17
+ ## Example
18
+
19
+ ```json
20
+ {
21
+ "version": 1,
22
+ "allowedCommands": ["node", "uvx"],
23
+ "allowedPackages": ["@approved/mcp-server"],
24
+ "allowedDirectories": ["./workspace"],
25
+ "allowedRemoteUrls": ["https://approved.example.com"]
26
+ }
27
+ ```
28
+
29
+ Each field is optional. Empty or omitted fields are not enforced.
30
+
31
+ ## Fields
32
+
33
+ | Field | Meaning |
34
+ | --- | --- |
35
+ | `allowedCommands` | Approved command basenames, such as `node`, `docker`, or `uvx`. |
36
+ | `allowedPackages` | Approved remote-runner package names, without requiring a version suffix. |
37
+ | `allowedDirectories` | Approved filesystem roots. Relative paths resolve from the scan working directory. |
38
+ | `allowedRemoteUrls` | Approved remote MCP URL origins or path prefixes. |
39
+
40
+ ## Policy Findings
41
+
42
+ | Rule | Severity | What it detects |
43
+ | --- | --- | --- |
44
+ | MCP070 | High | MCP server command is not in `allowedCommands`. |
45
+ | MCP071 | High | Remote package runner uses a package outside `allowedPackages`. |
46
+ | MCP072 | High | MCP server `cwd` is outside `allowedDirectories`. |
47
+ | MCP073 | High | Filesystem argument is outside `allowedDirectories`. |
48
+ | MCP074 | High | Remote MCP URL is outside `allowedRemoteUrls`. |
49
+
50
+ Policy findings are additive. A policy does not suppress the built-in rules for shell execution, unpinned packages, broad filesystem access, secret-like values, or dangerous commands.
package/docs/roadmap.md CHANGED
@@ -12,15 +12,16 @@
12
12
  - Baseline/allowlist mode for accepting known findings and failing only on new risks.
13
13
  - Optional GitHub pull request comments from the Marketplace Action.
14
14
  - `mcp-guard init` for bootstrapping a GitHub Action workflow and optional baseline.
15
+ - Policy file enforcement for approved commands, packages, directories, and remote URLs.
16
+ - `mcp-guard audit` for review-ready executive summaries, remediation plans, reports, and manifests.
15
17
  - npm Trusted Publishing workflow prepared for tokenless release publishing.
16
18
 
17
19
  ## Next
18
20
 
19
21
  1. More MCP client discovery paths.
20
22
  2. Rule packs mapped to MCP security best practices.
21
- 3. Policy file for approved commands, packages, directories, and remote URLs.
22
- 4. `mcp-guard audit` mode for review-ready reports.
23
- 5. Safer default remediation snippets for common MCP servers.
23
+ 3. Safer default remediation snippets for common MCP servers.
24
+ 4. Package metadata checks for remote MCP server packages.
24
25
 
25
26
  ## Later
26
27
 
package/docs/rules.md CHANGED
@@ -18,6 +18,11 @@
18
18
  | MCP050 | Critical | Dangerous command pattern such as `rm -rf`, `sudo`, `chmod 777`, or curl pipe to shell. |
19
19
  | MCP060 | Medium | Remote MCP server URL configured. |
20
20
  | MCP061 | High | Secret-like header configured for a remote MCP server. |
21
+ | MCP070 | High | MCP server command is outside `allowedCommands` policy. |
22
+ | MCP071 | High | Remote MCP package is outside `allowedPackages` policy. |
23
+ | MCP072 | High | MCP server working directory is outside `allowedDirectories` policy. |
24
+ | MCP073 | High | Filesystem argument is outside `allowedDirectories` policy. |
25
+ | MCP074 | High | Remote MCP URL is outside `allowedRemoteUrls` policy. |
21
26
 
22
27
  ## Severity Model
23
28
 
@@ -32,4 +37,3 @@
32
37
  - The scanner does not upload configs.
33
38
  - Detection is heuristic and will miss some risks.
34
39
  - A clean report is not a security guarantee.
35
-