protect-mcp 0.7.2 → 0.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,74 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.7.4: the self-serve trial path
4
+
5
+ Everything the scopeblind.com trial and docs pages describe now ships in the
6
+ published package: wrap, dashboard, trial, policy packs, connectors, the
7
+ registry client, and selective disclosure v0.
8
+
9
+ - Added `protect-mcp trial`, a guided ten-minute local trial: run the demo
10
+ tool server, watch risky calls, install a policy pack, require an approval,
11
+ and export a signed receipt you can verify offline.
12
+ - Added `protect-mcp connectors`, dry-run connector pilots for GitHub, email,
13
+ filesystem/Git, Slack or Teams, and a mock-to-real PMS adapter
14
+ (`connectors list|show|init|doctor`). These are scaffolds with policies and
15
+ config, not a managed marketplace; GitHub, Slack/Teams, and real PMS mode
16
+ still need customer tokens or adapters.
17
+ - Added `protect-mcp wrap` for install-to-aha onboarding. It prints a protected
18
+ MCP command, can patch Claude Desktop MCP server config in dry-run mode, and
19
+ writes only when `--write` is passed.
20
+ - Added `protect-mcp dashboard`, a local-only `127.0.0.1` dashboard for
21
+ shadow-mode inventory, risk review, receipts, and next policy moves.
22
+ - Added exact-action readbacks to decision logs and signed receipts: tool,
23
+ action, destination, redacted payload preview, payload hash, disclosed fields,
24
+ and redacted fields.
25
+ - Upgraded the local dashboard into an action-control surface: policy coverage,
26
+ one-click `Require approval`/`Block`/`Observe` drafting, pending approval
27
+ queue, reason capture, desktop approval forwarding, receipt-chain view, and
28
+ audit-bundle export with explicit signed-receipt preflight.
29
+ - Added `protect-mcp recommend`, which drafts a reviewable JSON policy from
30
+ observed local tool calls before users flip wrappers into `--enforce`.
31
+ - Added `protect-mcp registry`, a paid-boundary MVP for hosted org identity,
32
+ receipt digest anchoring, org public-key directory, billing-account metadata,
33
+ and a static verifier page. Hosted mode uploads digests only, not raw prompts,
34
+ payloads, outputs, private keys, or raw receipts.
35
+ - Added `protect-mcp killer-demo`, which generates a three-minute
36
+ shadow-mode → policy → exact approval → gateway execution → signed receipt →
37
+ tamper failure → selective-disclosure demo pack.
38
+ - Added Selective Disclosure v0 on committed receipts: `committed_fields_root`,
39
+ multi-field disclosure packages, verifier explanations for disclosed versus
40
+ hidden fields, CLI verification via `protect-mcp verify-disclosure`, and audit
41
+ bundle inclusion. This is salted commitments + Merkle proofs, not full ZK.
42
+ - Added `protect-mcp policy-packs`, a starter Cedar template library for
43
+ filesystem-safe, Git-safe, email-safe, database-safe, cloud-spend-safe,
44
+ secrets-safe, and finance-mandate-safe rollouts.
45
+ - Expanded the built-in demo MCP server with GitHub PR, email, and mock PMS
46
+ booking tools so the demo maps to agent actions a hedge fund actually cares
47
+ about.
48
+ - Reworked the README quickstart around the practical path: initialize, wrap,
49
+ inspect, draft policy, then enforce.
50
+
51
+ ## 0.7.3: tool input reaches `context.input`, and the hook path fails closed
52
+
53
+ Two correctness fixes for policy authors who rely on the documented Cedar shape.
54
+
55
+ The evaluator maps tool input to Cedar `context.input`, and the bundled policy
56
+ examples are written against `context.input.*`, but the `evaluate` CLI path and
57
+ the HTTP hook server only flattened tool input into top-level context fields. So
58
+ a policy keyed on `context.input.path` silently saw nothing on those paths: a
59
+ `forbid` that should have denied never fired, and the call was allowed. Both
60
+ paths now pass the tool input through, so nested-shape policies match. The
61
+ existing flattened fields are kept for back-compat. (Thanks to @koriyoshi2041,
62
+ scopeblind-gateway#8, for the report and repro.)
63
+
64
+ Separately, the hook server's Cedar evaluation fell through to **allow** on an
65
+ unexpected evaluator throw, which contradicted the "denies on any error"
66
+ guarantee from 0.7.0 (the CLI path already failed closed). The hook path now
67
+ denies on an unexpected eval error while a policy is configured.
68
+
69
+ Regression coverage added on all three paths; `npm ci` from a clean clone also
70
+ works again (the lockfile was out of sync).
71
+
3
72
  ## 0.7.2: run the gate in other agents (Codex, Cursor, Gemini, Hermes)
4
73
 
5
74
  The `evaluate` and `sign` verbs now accept `--format <host>`
package/README.md CHANGED
@@ -26,15 +26,136 @@ telemetry of your decisions anywhere, and is MIT licensed.
26
26
  and verifiable offline with [`@veritasacta/verify`](https://www.npmjs.com/package/@veritasacta/verify).
27
27
  No vendor trust required: the math does not care who runs it.
28
28
 
29
- ## Quickstart (30 seconds)
29
+ ## Quickstart: install to first useful proof
30
30
 
31
31
  ```bash
32
- # 1. Generate an Ed25519 keypair, a config template, and a sample policy.
32
+ # 1. Generate an Ed25519 keypair, config template, and sample policy.
33
33
  npx protect-mcp init
34
34
 
35
- # 2. Put a Cedar policy in ./cedar (see "Write a policy" below), then serve
36
- # the Claude Code hook gate in enforce mode. It runs a restraint self-test
37
- # first and refuses to start if it cannot prove it denies a forbidden vector.
35
+ # 2. Wrap any MCP server in shadow mode. Nothing is blocked yet; calls are logged.
36
+ npx protect-mcp wrap -- node your-mcp-server.js
37
+
38
+ # 3. Inspect the local-only dashboard: tool inventory, risk, approvals, receipts.
39
+ npx protect-mcp dashboard --open
40
+
41
+ # 4. Draft a reviewable policy from observed calls.
42
+ npx protect-mcp recommend --write
43
+
44
+ # 5. When reviewed, restart the wrapper in enforce mode with that policy.
45
+ npx protect-mcp --policy protect-mcp.recommended.json --enforce -- node your-mcp-server.js
46
+ ```
47
+
48
+ For Claude Desktop, run a dry-run config patch first, then apply it:
49
+
50
+ ```bash
51
+ npx protect-mcp wrap --claude-desktop
52
+ npx protect-mcp wrap --claude-desktop --write
53
+ npx protect-mcp dashboard --open
54
+ ```
55
+
56
+ The dashboard binds to `127.0.0.1`, reads only local log/receipt files, and does
57
+ not upload anything. Use `npx protect-mcp connect` only if you explicitly want a
58
+ hosted ScopeBlind dashboard.
59
+
60
+ ### Local Action Dashboard
61
+
62
+ `protect-mcp dashboard` is the operator view for moving from visibility to
63
+ enforcement:
64
+
65
+ - **Tool inventory:** every observed tool, call count, high/medium/low risk, and
66
+ whether the active policy has an exact rule, a wildcard fallback, or no rule.
67
+ - **Policy coverage:** one-click local policy edits for `Require approval`,
68
+ `Block`, or `Observe`. Restart the wrapper after reviewing changes.
69
+ - **Exact-action approval queue:** the exact tool, action, destination, redacted
70
+ payload preview, payload hash, policy basis, and reason capture before a human
71
+ approves, denies, edits, or takes over.
72
+ - **Receipt chain:** request ids correlated with signed receipt hashes, so an
73
+ audit reviewer can see which decisions have cryptographic proof.
74
+ - **Audit export:** downloads the offline-verifiable audit bundle when signed
75
+ receipts exist. If only unsigned local logs exist, the dashboard explains that
76
+ signing must be enabled first.
77
+
78
+ For live desktop fallback approvals, start the dashboard with the local gateway
79
+ approval endpoint and nonce printed by the wrapper:
80
+
81
+ ```bash
82
+ npx protect-mcp dashboard --open \
83
+ --approval-endpoint http://127.0.0.1:9876 \
84
+ --approval-nonce "$PROTECT_MCP_APPROVAL_NONCE"
85
+ ```
86
+
87
+ `Approve` forwards to the live local gateway when those flags are present.
88
+ `Deny`, `Edit`, and `Take over` are recorded locally as approval-resolution
89
+ records; use them as the operator instruction and rerun the tool when needed.
90
+
91
+ ### Paid Boundary MVP: digest anchoring, not data upload
92
+
93
+ Local self-signed receipts stay free and offline-verifiable. The paid boundary is
94
+ independent evidence that ScopeBlind saw a receipt digest at a time, under an org
95
+ identity, without receiving the raw prompt, tool payload, output, private key, or
96
+ raw receipt.
97
+
98
+ ```bash
99
+ # Create or refresh a local org identity and public-key directory.
100
+ npx protect-mcp registry init --org "Meridian Global Macro" --billing-account acct_meridian
101
+
102
+ # Local preview: writes a digest registry and shareable static verifier page.
103
+ npx protect-mcp registry anchor
104
+
105
+ # Hosted mode: uploads receipt digests only for independent anchoring.
106
+ SCOPEBLIND_TOKEN=... npx protect-mcp registry anchor \
107
+ --hosted \
108
+ --endpoint https://api.scopeblind.com \
109
+ --verifier-base https://legate.scopeblind.com
110
+ ```
111
+
112
+ The local preview is deliberately labeled `local-preview-not-independent`.
113
+ Hosted mode anchors only receipt hashes, request ids, org public keys, and
114
+ billing metadata. It does not upload raw receipts or sensitive context.
115
+
116
+ ### Killer Demo: shadow to policy to proof
117
+
118
+ `protect-mcp killer-demo` generates a complete three-minute sales/demo pack:
119
+
120
+ ```bash
121
+ npx protect-mcp killer-demo --dir ./scopeblind-demo
122
+ ```
123
+
124
+ It creates mock filesystem, GitHub, email, and PMS activity; shows risky calls in
125
+ shadow mode; applies a policy pack; requires approval for a sensitive PMS booking;
126
+ executes through the gateway; writes a signed receipt; proves the original
127
+ receipt verifies; proves a tampered receipt fails; and creates a selective
128
+ disclosure package that hides sensitive context while showing the minimum proof.
129
+
130
+ Open the generated `DEMO-RUNBOOK.md` first. Then run the printed dashboard
131
+ command to walk a customer through the exact sequence.
132
+
133
+ ### Selective Disclosure v0
134
+
135
+ Commitment-mode receipts can carry a `committed_fields_root` instead of exposing
136
+ every field in cleartext. Later, the holder can disclose selected fields only:
137
+
138
+ ```bash
139
+ npx protect-mcp verify-disclosure \
140
+ --receipt ./receipts/selective-disclosure.receipt.json \
141
+ --disclosure ./receipts/selective-disclosure.tool-only.json
142
+ ```
143
+
144
+ The verifier checks the parent receipt hash, Ed25519 signature, commitment root,
145
+ and each disclosed field's Merkle proof. It then explains which fields were
146
+ disclosed and which committed fields remain hidden. This is salted commitment
147
+ disclosure, not full zero-knowledge, but it makes the privacy claim concrete:
148
+ auditors can verify selected facts without receiving the full tool payload or
149
+ sensitive desk context.
150
+
151
+ ## Claude Code hook quickstart
152
+
153
+ ```bash
154
+ # Generate hook config and a sample Cedar policy.
155
+ npx protect-mcp init-hooks
156
+
157
+ # Serve the Claude Code hook gate in enforce mode. It runs a restraint self-test
158
+ # first and refuses to start if it cannot prove it denies a forbidden vector.
38
159
  npx protect-mcp serve --enforce --cedar ./cedar
39
160
  ```
40
161
 
@@ -68,7 +189,7 @@ session always runs the gate you tested:
68
189
  "hooks": [
69
190
  {
70
191
  "type": "command",
71
- "command": "npx protect-mcp@0.7.0 evaluate --cedar ./cedar --tool \"$TOOL_NAME\" --input \"$TOOL_INPUT\""
192
+ "command": "npx protect-mcp@0.7.3 evaluate --cedar ./cedar --tool \"$TOOL_NAME\" --input \"$TOOL_INPUT\""
72
193
  }
73
194
  ]
74
195
  }
@@ -79,7 +200,7 @@ session always runs the gate you tested:
79
200
  "hooks": [
80
201
  {
81
202
  "type": "command",
82
- "command": "npx protect-mcp@0.7.0 sign --tool \"$TOOL_NAME\" --receipts ./receipts --key ./keys/gateway.json"
203
+ "command": "npx protect-mcp@0.7.3 sign --tool \"$TOOL_NAME\" --receipts ./receipts --key ./keys/gateway.json"
83
204
  }
84
205
  ]
85
206
  }
@@ -153,8 +274,28 @@ forbid(
153
274
  > CI tripwire test fails the build if the pattern is reintroduced into a shipped
154
275
  > policy. See [GHSA-hm46-7j72-rpv9](https://github.com/ScopeBlind/scopeblind-gateway/security/advisories/GHSA-hm46-7j72-rpv9).
155
276
 
156
- Ready-to-use Cedar packs ship in `policies/cedar/` (Clinejection / CVE-2025-6514,
157
- Terraform destroy, secret-file exfiltration, spending authority).
277
+ ### Starter policy packs
278
+
279
+ Most teams should not write Cedar from scratch on day one. Install a starter
280
+ pack, run in shadow mode, inspect receipts, then tighten or enforce:
281
+
282
+ ```bash
283
+ npx protect-mcp policy-packs list
284
+ npx protect-mcp policy-packs show secrets-safe
285
+ npx protect-mcp policy-packs install filesystem-safe --dir ./cedar
286
+ npx protect-mcp policy-packs install all --dir ./cedar
287
+ npx protect-mcp serve --cedar ./cedar
288
+ ```
289
+
290
+ Built-in packs:
291
+
292
+ - `filesystem-safe`: destructive file actions and secret-like path reads.
293
+ - `git-safe`: force pushes, hard resets, destructive cleanup, repo deletion.
294
+ - `email-safe`: allow drafting, block unattended sends.
295
+ - `database-safe`: read-oriented DB posture, block write/admin SQL.
296
+ - `cloud-spend-safe`: obvious cloud spend creation and infrastructure destruction.
297
+ - `secrets-safe`: common file, env, shell, and cloud secret exfiltration.
298
+ - `finance-mandate-safe`: restricted-list and concentration breaches in booking flows.
158
299
 
159
300
  ## Verify a receipt
160
301
 
@@ -190,6 +331,13 @@ To report a vulnerability, see [SECURITY.md](./SECURITY.md).
190
331
  |---------|-------------|
191
332
  | `serve` | Start the HTTP hook server for Claude Code (port 9377). `--enforce` runs the restraint self-test first; `--cedar <dir>` and `--policy <path>` select the policy. |
192
333
  | `init` | Generate an Ed25519 keypair (`keys/gateway.json`), a config template, and a sample policy. |
334
+ | `wrap` | Print a protected MCP command or patch Claude Desktop MCP servers. Dry-run by default; use `--write` to update Claude Desktop config. |
335
+ | `dashboard` | Start a local-only dashboard on `127.0.0.1` showing tool inventory, risk, policy coverage, exact-action approvals, receipt chains, and audit export. |
336
+ | `recommend` | Draft a reviewable JSON policy from observed local calls. Dry-run by default; use `--write` to create `protect-mcp.recommended.json`. |
337
+ | `registry` | Create an org identity, anchor receipt digests, and write a static verifier page. Hosted mode uploads digests only. |
338
+ | `killer-demo` | Generate a complete shadow-mode to policy to approval to signed-receipt demo pack. |
339
+ | `verify-disclosure` | Verify a `scopeblind.selective_disclosure.v0` package and explain disclosed versus hidden fields. |
340
+ | `policy-packs` | List, inspect, and install starter Cedar policy packs. |
193
341
  | `evaluate` | Evaluate one tool call against a Cedar policy (PreToolUse gate). Exit 2 = deny (fail-closed), exit 0 = allow. |
194
342
  | `sign` | Sign one tool call into a receipt (PostToolUse). Best-effort: records an honest unsigned line if no key. |
195
343
  | `simulate` | Dry-run a policy against a recorded decision log to see what it would have blocked. |
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  collectSignedReceipts,
3
3
  createAuditBundle
4
- } from "./chunk-5JXFV37Y.mjs";
4
+ } from "./chunk-PM2ZO57M.mjs";
5
5
  import "./chunk-PQJP2ZCI.mjs";
6
6
  export {
7
7
  collectSignedReceipts,