@strixgov/mcp-proxy 0.2.4 → 0.3.0

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 (50) hide show
  1. package/CHANGELOG.md +92 -1
  2. package/README.md +277 -38
  3. package/bin/strix-mcp-proxy.mjs +100 -5
  4. package/examples/controlled-launcher/README.md +33 -0
  5. package/examples/controlled-launcher/acceptance.mjs +337 -0
  6. package/examples/controlled-launcher/agent-client.mjs +18 -0
  7. package/examples/controlled-launcher/approval-relay.mjs +19 -0
  8. package/examples/controlled-launcher/approver.mjs +27 -0
  9. package/examples/controlled-launcher/authorizer.mjs +73 -0
  10. package/examples/controlled-launcher/bridge-client.mjs +8 -0
  11. package/examples/controlled-launcher/destination.mjs +18 -0
  12. package/examples/controlled-launcher/executor.mjs +74 -0
  13. package/examples/controlled-launcher/kernel-authority/acceptance.mjs +627 -0
  14. package/examples/controlled-launcher/kernel-authority/broker.mjs +83 -0
  15. package/examples/controlled-launcher/kernel-authority/derive.mjs +12 -0
  16. package/examples/controlled-launcher/kernel-authority/executor.mjs +105 -0
  17. package/examples/controlled-launcher/kernel-authority/reconcile.mjs +43 -0
  18. package/examples/controlled-launcher/kernel-authority/shim.mjs +38 -0
  19. package/examples/controlled-launcher/kernel-authority/signing-provider.mjs +137 -0
  20. package/examples/controlled-launcher/kernel-authority/strix-approver.mjs +73 -0
  21. package/examples/controlled-launcher/lib.mjs +63 -0
  22. package/examples/controlled-launcher/make-config.mjs +16 -0
  23. package/examples/controlled-launcher/proxy-host.mjs +19 -0
  24. package/examples/controlled-launcher/reconcile.mjs +30 -0
  25. package/examples/controlled-launcher/shim.mjs +32 -0
  26. package/examples/github-reference/README.md +1 -1
  27. package/examples/github-reference/acceptance.mjs +10 -3
  28. package/examples/github-reference/claims-matrix.md +3 -3
  29. package/examples/github-reference/package-lock.json +48 -44
  30. package/examples/github-reference/package.json +4 -4
  31. package/examples/github-reference/reuse-inventory.md +4 -4
  32. package/examples/synthetic-server/proxy-config.json +16 -0
  33. package/examples/synthetic-server/quickstart.mjs +98 -0
  34. package/examples/synthetic-server/server.mjs +54 -0
  35. package/package.json +5 -4
  36. package/src/config.mjs +152 -2
  37. package/src/content-guard.mjs +432 -0
  38. package/src/http-upstream.mjs +431 -0
  39. package/src/index.mjs +11 -2
  40. package/src/proxy.mjs +241 -33
  41. package/src/tool-guard.mjs +183 -0
  42. package/src/types.d.ts +83 -1
  43. package/test/content-guard-hardening.test.mjs +159 -0
  44. package/test/content-guard.test.mjs +387 -0
  45. package/test/http-upstream-config.test.mjs +115 -0
  46. package/test/http-upstream-e2e.test.mjs +279 -0
  47. package/test/http-upstream.test.mjs +304 -0
  48. package/test/synthetic-quickstart.test.mjs +44 -0
  49. package/test/tool-guard.test.mjs +243 -0
  50. package/test/validate-cli.test.mjs +171 -0
package/CHANGELOG.md CHANGED
@@ -7,7 +7,98 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
- ## [0.2.4] - unreleased
10
+ ## [0.3.0] - unreleased
11
+
12
+ Why 0.3.0 and not a patch: the features below were merged to `main` after 0.2.5 was published
13
+ (2026-11-29T08:41Z) while this file already listed them under 0.2.5, so the 0.2.5 on npm does not contain
14
+ them (its `src/` has no `http-upstream.mjs` and no `tool-guard.mjs`). Tool pinning also changes a default
15
+ (`toolPinning: block`) and credential scanning refuses calls that used to pass, so this is a minor release.
16
+
17
+ ### Added
18
+ - Credential scanning of tool arguments and results (`src/content-guard.mjs`). `secretScanning.arguments`
19
+ (default `block`): a call whose arguments contain a credential-shaped string is refused before the upstream
20
+ is contacted, with a signed DENY (`SECRET_IN_ARGUMENTS`). `secretScanning.results` (default `warn`; `redact`
21
+ opt-in): credential-shaped strings in a result are reported or replaced with `[REDACTED:<kind>]` before the
22
+ client sees them. Formats listed in the README (cloud, source host, chat, payment and AI-provider keys,
23
+ private-key blocks, JWTs); it is not data-loss prevention and a clean scan means "no listed format found".
24
+ In `block` mode the matched text is not put in a receipt, audit event or log, and the denial receipt binds
25
+ the arguments with the credential redacted. In `warn` and `off` modes the call is sent unchanged: the receipt
26
+ hashes the real arguments and an approval request shows them. A credential used as an object key is masked in
27
+ finding paths. A value too deep or large to scan is a finding (fails closed). CLI
28
+ `--secret-scanning-args`, `--secret-scanning-results` (also with `--config`, where they override the file); config
29
+ `secretScanning` (or `false`). Hardened after an independent review: linear-time matchers, private keys
30
+ redacted through the END line, `redact` mode never returns an unscanned subtree, upstream error text scrubbed,
31
+ more formats (GitLab, Stripe webhook, Google OAuth, Hugging Face, SendGrid, OpenAI legacy and service-account
32
+ keys, `scheme://user:password@host`), a `result.unscanned_content` audit note for binary results, and argument
33
+ `pattern` rules that repeat a group containing a quantifier or an alternation, or exceed 1,000 characters, refused at startup (a heuristic, not a proof of cost). `auditLog` accepts only true, an absolute path or `~/`; upstream error text is scrubbed in the audit log in every mode.
34
+ **Behaviour change:** a call that carries a credential-shaped string in its arguments is now refused by
35
+ default. Set `secretScanning.arguments` to `warn` or `off` to keep the old behaviour.
36
+ - `auditLog` (`true` or a file path): appends every audit event as one JSON line, created owner-only (an existing file keeps its mode). Unsigned operational
37
+ log for log shippers; the signed receipts remain the record. Off by default.
38
+ - Argument rules (`argumentRules`): per tool (or `*`), constraints on a call's arguments (`required`, `max`,
39
+ `min`, `maxLength`, `in`, `pattern`, `notPattern`, `withinPath`). A violated rule refuses the call with a
40
+ signed DENY (`ARGUMENT_RULE_VIOLATION`) naming the path and rule, never the value. Rules only make a call
41
+ stricter; they cannot turn a policy DENY or an approval requirement into a pass. `withinPath` refuses `..`
42
+ escapes, backslash tricks, relative paths, NUL bytes and prefix look-alikes.
43
+ - `strix-mcp-proxy --validate --config <path>`: reads and checks a config, resolves the capability pack, prints
44
+ what it would do (upstream origin and header names, never values; approval mode; pinning; scanning; rules) with
45
+ warnings for risky settings, and exits 0 or 1. Connects to nothing. Unknown top-level config keys are
46
+ reported (and warned about at startup): a typo in a security setting used to be ignored silently.
47
+ - Type declarations now cover the HTTP upstream, pinning, rate limits, scanning, rules and `describeConfig`.
48
+ - HTTP upstream (`upstream.url`, CLI `--upstream-url` / `--upstream-header-env`): the proxy keeps
49
+ speaking stdio to its client and reaches a hosted MCP server over Streamable HTTP. Same policy,
50
+ approval, receipt and outcome pipeline as a stdio upstream; no receipt or outcome schema change.
51
+ New module `src/http-upstream.mjs` refuses non-https remote URLs, userinfo in URLs, literal
52
+ credential header values, off-origin requests, all redirects, and hosts resolving to private,
53
+ link-local, loopback or metadata addresses (`allowPrivateNetwork` admits private ranges only).
54
+ Header credentials come from environment variables and are scrubbed from error messages. A sent
55
+ but unanswered call is reported as `UPSTREAM_OUTCOME_UNKNOWN`, signed `FAILED`/`EXECUTOR_ERROR`,
56
+ and never retried. Tests: `test/http-upstream.test.mjs`, `test/http-upstream-e2e.test.mjs`
57
+ (a real SDK Streamable HTTP server on loopback), `test/http-upstream-config.test.mjs`.
58
+ Observed once against one public hosted server (`https://mcp.deepwiki.com/mcp`, no credential).
59
+ Not supported: the proxy listening on HTTP, legacy HTTP+SSE upstreams, OAuth.
60
+ - Tool-definition pinning (`toolPinning`, default `block`; CLI `--tool-pinning`, `--repin-tools`),
61
+ in new `src/tool-guard.mjs`. Each tool's name, description, input schema and annotations are
62
+ hashed on first sight and re-read before every call. A changed tool is hidden from `tools/list`
63
+ and refused before the upstream with a signed DENY (`TOOL_DEFINITION_CHANGED`). Pins persist in
64
+ `<storagePath>/tool-pins.json` (unsigned). Behaviour change for existing installs: a tool whose
65
+ definition changes after the first run is now refused until an operator repins.
66
+ - `hideDeniedTools` (opt-in; CLI `--hide-denied-tools`): leaves tools policy always denies out of
67
+ `tools/list`. Default unchanged: the list is passed through.
68
+ - `rateLimits` in config and `startProxy`. Fixes a silent gap: the option previously given to
69
+ `@strixgov/mcp-adapter` was never applied (the gateway reads `policy.rateLimits`), so the proxy
70
+ now passes limits inside `policy`. `policyVersion` is unchanged by them.
71
+ - HTTP upstream `maxResponseBytes` (default 8 MiB): an oversized response is discarded while
72
+ streaming and the call fails.
73
+ - Research note behind these choices: `docs/strategy/mcp-gateway-landscape-2026-11-29.md`.
74
+ - `@modelcontextprotocol/sdk` range raised to `^1.10.0`, the first release with the Streamable
75
+ HTTP client transport.
76
+
77
+ ## [0.2.5] - 2026-11-29
78
+
79
+ Published to npm 2026-11-29T08:41Z by the operator. Documentation and metadata only; the package's `src/` is
80
+ that of 0.2.4. (An earlier version of this file listed the 0.3.0 features here by mistake.)
81
+
82
+ ### Changed (documentation and package metadata)
83
+ - README opens with a "Choose your path" table (Guard, this proxy, the adapter, the verifier,
84
+ hosted/commercial) and states the boundary in two lines before any feature list.
85
+ - Removed "v0.2.0 (planned)" wording that outlived 0.2.0: the feature table now reads "Shipped
86
+ through 0.2.x" against "Not built (no date committed)". Mode 3 (capability-enforced) and the
87
+ HTTP transport have not shipped in any release; the README no longer implies a version for them.
88
+ - Requirements note that `@strixgov/guard` needs Node 20 or later while this package still supports 18.
89
+ - `package.json` description no longer says Mode 3 is "the v0.2.0 upgrade path".
90
+ - `examples/synthetic-server/`: a dependency-free synthetic stdio MCP server, a config that classifies its
91
+ three tools, and `quickstart.mjs`, a safe walkthrough (read passes, write pauses, a person decides,
92
+ refusals never run, signed receipts, the verify command). Covered by `test/synthetic-quickstart.test.mjs`.
93
+ No change to `src/` or `bin/`.
94
+ - README "Compatibility, as observed" table: two rows Observed, the rest Not tested or Not supported.
95
+ (Confirmed present in the published 0.2.5 tarball; an earlier draft listed it under 0.3.0.)
96
+ - Adds `mcpName` (`io.github.Strixgov/mcp-proxy`) to `package.json`, which the official MCP Registry
97
+ requires inside the published npm package to verify ownership, and a `server.json` for
98
+ `mcp-publisher` (validated with `mcp-publisher validate`; not shipped in the tarball).
99
+ The registry listing was published 2026-11-30 (pointer to the npm package).
100
+
101
+ ## [0.2.4] - 2026-11-15
11
102
 
12
103
  ### Changed
13
104
  - Pins `@strixgov/mcp-adapter` 0.1.5 (was 0.1.4), whose published package runs `npm test`.
package/README.md CHANGED
@@ -1,12 +1,63 @@
1
1
  # @strixgov/mcp-proxy
2
2
 
3
- **The distribution wedge for governed agent tool execution. Point your MCP client at the proxy instead of the underlying server — every `callTool` becomes intercepted, evaluated against policy, and emits a signed Ed25519 receipt. Designed so Mode 3 enforcement is the v0.2.0 upgrade path, not a rewrite.**
3
+ **Put an authorization decision in front of the MCP tools your agent already uses. Point your MCP client at the proxy instead of the underlying server — every `callTool` is intercepted, evaluated against policy, and produces a signed Ed25519 receipt, whether the call was allowed or refused. Reads you classify as low-risk pass; writes and unclassified tools stop and wait for a person under Guard's defaults, or as your config says.**
4
+
5
+ ## Choose your path
6
+
7
+ | You want | Use | Licence |
8
+ |---|---|---|
9
+ | The fastest start: wrap the MCP servers in Claude Code, Claude Desktop or Cursor (designed for all three; only Claude Code has been observed end to end, through Guard with unsigned approvals and with a hand-written config; signed approvals have not been exercised with a person), with signed approvals, in one command | [`npx @strixgov/guard init`](https://www.npmjs.com/package/@strixgov/guard) (Guard configures this proxy for you) | Guard: MIT |
10
+ | Hand-written policy for one server, a CI job, or a server Guard does not know | This package: `strix-mcp-proxy --config <file>` | Elastic-2.0 (free to use; see [`COMMERCIAL.md`](./COMMERCIAL.md)) |
11
+ | Governance inside your own MCP server code, no extra process | [`@strixgov/mcp-adapter`](https://www.npmjs.com/package/@strixgov/mcp-adapter) | Elastic-2.0 |
12
+ | To check a receipt without trusting Strix | [`@strixgov/verifier`](https://www.npmjs.com/package/@strixgov/verifier) | MIT |
13
+ | Hosted approvals, retention, enterprise features, a pilot | Email `sales@strixgov.com` (person-assisted today; there is no self-serve path from a local install to a hosted tenant) | Commercial |
14
+
15
+ What this gives you, and what it does not: the proxy decides by tool name and the classification you configure, and records what it decided. It does not read the SQL or message body to infer intent, it covers only the calls routed through it, and a signature authenticates a record without proving the policy was right or that the upstream tool did what it reported.
4
16
 
5
17
  ```sh
6
18
  npm install -g @strixgov/mcp-proxy
7
19
  strix-mcp-proxy --config ./proxy-config.json
8
20
  ```
9
21
 
22
+ ### Try it safely first (0.2.5 and later)
23
+
24
+ A synthetic notes server ships in the package, so you can see the whole loop before routing anything real.
25
+ Nothing leaves your machine and no credential is involved.
26
+
27
+ ```sh
28
+ npm install @strixgov/mcp-proxy
29
+ node node_modules/@strixgov/mcp-proxy/examples/synthetic-server/quickstart.mjs
30
+ ```
31
+
32
+ In about three seconds it shows a classified read passing, a write pausing (the notes file is unchanged while
33
+ it waits), a person approving it so it runs, a second write refused, a call your policy denies never running,
34
+ and the four signed receipts that left. It then prints the `@strixgov/verifier` command that checks them.
35
+ A receipt is evidence of the proxy's recorded decision; it does not by itself prove the downstream server
36
+ executed the action. The notes file change is what shows that in this walkthrough. To write your own
37
+ config, start from `examples/synthetic-server/proxy-config.json`.
38
+
39
+ ### Compatibility, as observed
40
+
41
+ Only what has been run is marked Observed. Needs Node 20 or later for Guard (18 or later for the proxy alone) and an MCP server your client starts with a command.
42
+
43
+ | Client or platform | Setup | Transport | Status | Detail |
44
+ |---|---|---|---|---|
45
+ | Claude Code 2.1.330 | Hand-written proxy config via --mcp-config | stdio | Observed | Read allowed; one write held then approved; one write held then refused; receipts verified offline. 2026-11-21, Linux container, Node 22, scripted approver, unsigned file approvals. |
46
+ | Scripted MCP client (SDK 1.29.0) | Guard init, and the synthetic quickstart | stdio | Observed | Guard init output accepted without edits; the quickstart loop runs. 2026-11-05 and 2026-11-22. A script, not a person or a product client. |
47
+ | Claude Code 2.1.330 | Guard init (unsigned approvals) | stdio | Observed | Read allowed; one write held then approved with guard approve; one held then refused with guard deny; receipts verified offline. 2026-11-22, Linux container, Node 22, scripted approver. Signed approvals not exercised. |
48
+ | Claude Desktop | Guard init or hand-written config | stdio | Not tested | Designed for; no run. |
49
+ | Cursor | Guard init or hand-written config | stdio | Not tested | Designed for; no run. |
50
+ | Windows | Guard writes a cmd /c npx entry | stdio | Not tested | Written by design because clients start commands without a shell; no run. |
51
+ | macOS | Any | stdio | Not tested | No run. |
52
+ | Clean machine, cold install | Any | stdio | Not tested | Every run so far was on a build container with the monorepo present. |
53
+ | A person approving at a terminal | Signed approvals | stdio | Not tested | Approvals so far came from a script. |
54
+ | Hosted MCP server over Streamable HTTP: `https://mcp.deepwiki.com/mcp` (public, no credential) | Programmatic `startProxy({ upstream: { url } })`, scripted SDK client | stdio in, HTTPS out | Observed | Three tools listed; one call allowed and answered; authorization receipt and execution outcome both verified with the proxy key. 2026-11-29, Linux container, Node 22. Unreleased code (0.3.0 source), not the npm package. One server, no credential, implementer run. |
55
+ | Hosted MCP servers that need a credential (header sourced from an env var) | Config `upstream.url` + `headers` | stdio in, HTTPS out | Not tested | Exercised only against a local test server on loopback. No vendor server with a credential has been run. |
56
+ | Hosted MCP servers over legacy HTTP+SSE | Any | HTTP | Not supported | Only Streamable HTTP is implemented. |
57
+ | An MCP client that itself connects to a URL | Any | HTTP (proxy listens) | Not supported | The proxy does not listen on HTTP. The client must start the proxy over stdio. |
58
+
59
+ Real upstream server observed: the published reference filesystem server (`@modelcontextprotocol/server-filesystem`) on a scratch directory, in one Claude Code run on 2026-11-21. Evidence: `docs/evidence/mcp-proxy-real-client-2026-11-21/`. The synthetic notes server shipped for the quickstart is a demonstration, not a real upstream, and shows nothing about any other server. Hosted server observed over Streamable HTTP: `https://mcp.deepwiki.com/mcp`, one scripted run on 2026-11-29 against the unreleased 0.3.0 source (no credential, implementer run); evidence: `docs/evidence/mcp-proxy-http-upstream-2026-11-29/`.
60
+
10
61
  Compared to `@strixgov/mcp-adapter`, which is a library you integrate into
11
62
  your own MCP server code: the proxy is a **standalone process** you run in
12
63
  front of any existing MCP server, with **zero changes** to your tool
@@ -29,21 +80,196 @@ For every incoming `callTool`:
29
80
  2. **Evaluate** policy — `ALLOW` / `DENY` / `APPROVAL_REQUIRED`.
30
81
  3. **Hold** for an approver when policy demands it.
31
82
  4. **Execute** via the upstream MCP server (only on `ALLOW`).
32
- 5. **Sign** an Ed25519 receipt — allowed or denied — verifiable against the public JWKS by `@strixgov/verifier`.
83
+ 5. **Sign** an Ed25519 receipt — allowed or denied — verifiable offline by `@strixgov/verifier` against the proxy's own public key (`public-jwk.json`).
33
84
 
34
85
  Tool implementations are untouched. The MCP client (Claude Desktop, mcp-cli,
35
86
  IDE integration, your own code) doesn't need to know Strix exists — it just
36
87
  spawns this proxy in place of the upstream server.
37
88
 
38
- > **Transport scope (v0.1.x):** the proxy wraps MCP servers that speak
39
- > the **stdio transport** — the `command` / `args` pattern in
40
- > `claude_desktop_config.json`. It does **not** intercept HTTP-based
41
- > hosted MCP servers (e.g. Notion's `https://mcp.notion.com/mcp`
42
- > Claude Desktop "Connector" pattern). If your MCP server is reachable
43
- > only over HTTPS, the proxy cannot govern it today; that's
89
+ > **Transport scope.** Released versions through 0.2.5 wrap only **stdio** upstreams (the
90
+ > `command` / `args` pattern). The unreleased 0.3.0 source adds an **HTTP upstream**: the
91
+ > client still starts the proxy over stdio, and the proxy reaches a hosted MCP server over
92
+ > Streamable HTTP (`upstream.url`, see [HTTP upstream](#http-upstream-unreleased)).
93
+ >
94
+ > What that does and does not cover: a call governed this way is governed only because the
95
+ > client was pointed at the proxy instead of the vendor URL. A client configured with the
96
+ > vendor URL directly (Claude Desktop's "Add connector" pattern, for example) talks to the
97
+ > vendor and never reaches the proxy. The proxy does not listen on HTTP, does not support
98
+ > legacy HTTP+SSE servers, and does not run an OAuth flow. Preventing a client from reaching
99
+ > the vendor directly is
44
100
  > [Posture B](https://github.com/Strixgov/strix/tree/main/docs/architecture/mcp-mode-3-enforcement-v1.md)
45
- > in the Mode 3 architecture and is deferred to a future release. Use
46
- > the local stdio version of the upstream MCP server in the meantime.
101
+ > in the Mode 3 architecture and is not built.
102
+
103
+ ## Tool-definition pinning (unreleased)
104
+
105
+ In the 0.3.0 source (not yet on npm), on by default. The first time the proxy sees a tool it hashes the tool's
106
+ name, description, input schema and annotations. Before every call it re-reads the upstream's
107
+ definitions. If a tool's definition changed since it was pinned:
108
+
109
+ - `toolPinning: "block"` (default): the tool is hidden from `tools/list`, and a call to it is
110
+ refused before it reaches the upstream, with a signed DENY receipt (`denialReason:
111
+ TOOL_DEFINITION_CHANGED`).
112
+ - `"warn"`: the change is reported in the audit stream (`tools.definition_changed`) and the call proceeds.
113
+ - `"off"`: no pinning.
114
+
115
+ Pins are kept in `<storagePath>/tool-pins.json`, so a change made while the proxy was stopped is
116
+ caught at the next start. To accept a change, restart with `--repin-tools` (or `repinTools: true`).
117
+
118
+ What it does not cover: the pin is over what the server *says* the tool is, not what its code
119
+ does. The pin file is unsigned, so anyone who can write it can change the pins. The first
120
+ definition the proxy sees is trusted.
121
+
122
+ Related options: `hideDeniedTools: true` leaves tools that policy always denies out of
123
+ `tools/list` (calling one by name is still refused). `rateLimits` takes
124
+ `{ "<capability id or prefix.*>": { "windowMs": 60000, "max": 10 } }` and refuses calls over the limit.
125
+
126
+ ## Credential scanning (unreleased)
127
+
128
+ In the 0.3.0 source, on for arguments by default. A policy engine that decides on a tool's name and risk class
129
+ cannot see what a call carries. The proxy therefore also checks the call's content:
130
+
131
+ - **Arguments (outbound), `secretScanning.arguments`:** `block` (default) refuses a call whose arguments contain
132
+ a credential-shaped string, before the upstream is contacted, with a signed DENY (`denialReason:
133
+ SECRET_IN_ARGUMENTS`). `warn` reports it in the audit stream and allows the call. `off` disables the check.
134
+ - **Results (inbound), `secretScanning.results`:** `warn` (default) reports a credential-shaped string in a tool's
135
+ result and returns the result unchanged. `redact` replaces each match with `[REDACTED:<kind>]` before the client
136
+ sees it. The signed outcome is recorded over the upstream's answer as received; only the client's copy is
137
+ rewritten.
138
+ - Formats: AWS access key ids, GitHub tokens (classic and fine-grained), GitLab tokens, Slack tokens, Stripe keys
139
+ and webhook secrets, Google API keys and OAuth tokens, Anthropic and OpenAI keys, Hugging Face tokens,
140
+ SendGrid keys, npm tokens, private-key blocks (matched through the END line, or to the end of the text when
141
+ there is none), JWTs, and `scheme://user:password@host` URLs. Each is matched on a distinctive prefix or
142
+ marker, to keep false positives rare. A letter or digit directly beside the value means it is part of a
143
+ longer word and is not matched; an underscore or hyphen counts as a delimiter.
144
+ - In `block` mode the matched text is not put in a receipt, audit event or log: findings carry the kind and the
145
+ JSON path (a credential used as an object key is masked in the path), and the denial receipt binds the
146
+ arguments with the credential replaced by its marker. In `warn` and `off` modes the call is sent unchanged: the
147
+ receipt hashes the real arguments, and an approval request shows them.
148
+ - A value too deep or too large to scan completely is reported as `scan_limit_exceeded`; `block` treats it as a
149
+ finding, so an argument with more than 10,000 nodes, nesting deeper than 32 levels or a string over 1,000,000
150
+ characters is refused in `block` mode even when it holds no credential.
151
+ - Error messages from the upstream are scrubbed in the audit stream, and in the client's copy in `redact` mode.
152
+ Tool names and the actor fields a client puts in `_meta` are recorded as given.
153
+ - Image, audio and binary resource content is base64 and is not decoded: the audit stream records
154
+ `result.unscanned_content` when a result carries any.
155
+
156
+ ```json
157
+ { "secretScanning": { "arguments": "block", "results": "redact" } }
158
+ ```
159
+
160
+ What it does not do: it is not data-loss prevention. It does not find a password in prose, a card number,
161
+ personal data, or a secret in a format not listed above, and a clean scan means "no listed format found", not
162
+ "no secret present". A credential that is encoded (base64, hex, URL-encoding), split across fields or interleaved
163
+ with zero-width characters is not matched, so `block` does not stop an agent that deliberately disguises one. In
164
+ `redact` mode, anything past 10,000 nodes or 32 levels of nesting is replaced with `[UNSCANNED:limit]` and a string
165
+ over 1,000,000 characters with `[UNSCANNED:string-too-large]`, so unscanned text is not returned; the audit stream
166
+ reports `scan_limit_exceeded`. A person who must send a credential on purpose sets `arguments` to `warn` or `off`.
167
+
168
+ ## Argument rules (unreleased)
169
+
170
+ In the 0.3.0 source. `argumentRules` constrains what a call may carry, per tool name (or `*` for every tool):
171
+
172
+ ```json
173
+ {
174
+ "argumentRules": {
175
+ "transfer_funds": [
176
+ { "path": "amount", "max": 500 },
177
+ { "path": "currency", "in": ["USD", "EUR"] }
178
+ ],
179
+ "read_file": [{ "path": "path", "withinPath": "/srv/data" }],
180
+ "*": [{ "path": "query", "maxLength": 2000 }]
181
+ }
182
+ }
183
+ ```
184
+
185
+ Each rule has a dot `path` into the arguments and exactly one of `required`, `max`, `min`, `maxLength`, `in`,
186
+ `pattern`, `notPattern`, `withinPath`. A rule on a path that is absent passes (except `required`). A violated rule
187
+ refuses the call before the upstream is contacted, with a signed DENY (`denialReason: ARGUMENT_RULE_VIOLATION`)
188
+ and an error naming the path and rule, never the value. `withinPath` normalizes the string as a POSIX path and
189
+ refuses `..` escapes, backslash tricks, relative paths, NUL bytes and look-alike prefixes (`/srv/database` is not
190
+ inside `/srv/data`).
191
+
192
+ Rules only tighten: they run in addition to policy and approval and cannot turn a DENY or an approval
193
+ requirement into a pass. They match the upstream's own tool names. A path is a plain dot path: it has no wildcard for array elements
194
+ (`files.0` constrains the first element only), and a key that contains a dot cannot be addressed. A `pattern` or
195
+ `notPattern` is refused at startup if it is longer than 1,000 characters or repeats a group that contains a
196
+ quantifier or an alternation (`(a+)+`, `(a|aa)*`), which can take exponential time on a hostile string. That is a
197
+ heuristic, not a proof: other patterns are not checked for cost (`\d+\d+` is slow on long input), and a rule
198
+ is evaluated on the proxy's single thread, so keep patterns simple. They do not make an unclassified tool safe,
199
+ and a `withinPath` rule does not follow symlinks on the upstream's file system.
200
+
201
+ ## Audit log file (unreleased)
202
+
203
+ In the 0.3.0 source, off by default. `auditLog: true` (or an absolute file path, or one starting with `~/`) appends every
204
+ audit event the proxy emits once it is running, except the credential-resolution notice at startup, as one JSON line (`{"ts": "...", "kind": "...", "detail": {...}}`) to `<storagePath>/audit.jsonl`, created
205
+ owner-only when the proxy creates it (an existing file keeps its mode, and a symlink at the path is followed), so a
206
+ log shipper can follow the file. `true` needs a `storagePath`; a relative path is refused because it would depend on
207
+ where the client launched the proxy.
208
+
209
+ ```json
210
+ { "auditLog": true }
211
+ ```
212
+
213
+ It is an operational log, not evidence: it is not signed or chained, a person who can write the file can change it,
214
+ and a failed write prints one warning and does not stop calls. The signed receipts remain the record. It is not
215
+ an OpenTelemetry exporter, which is not built.
216
+
217
+ ## Check a config before running it (unreleased)
218
+
219
+ ```sh
220
+ strix-mcp-proxy --validate --config ./proxy-config.json
221
+ ```
222
+
223
+ Reads the config, resolves the capability pack, prints a JSON report of what it would do, and exits 0 (valid) or
224
+ 1 (invalid). It opens no network connection of its own and starts no upstream, but resolving `capabilities` imports
225
+ that package's code, so only validate a config whose capability pack you would run. The report names the upstream origin and header names but
226
+ never header values, environment variable names or upstream arguments, and lists warnings: a default policy of
227
+ `ALLOW`, auto-approval, pinning or scanning turned off, no classified capabilities, and any top-level key the
228
+ proxy would silently ignore (a typo in a security setting). The same unknown-key warning is printed at startup; a top-level key that starts with `_` is treated as a
229
+ comment and ignored. `--validate` does not read the environment values behind `fromEnv` headers, but it warns
230
+ when one of those variables is not set in the shell that runs it, because startup refuses a missing one.
231
+
232
+ ## HTTP upstream (unreleased)
233
+
234
+ In the 0.3.0 source, not in any npm release. Replace `command`/`args` with `url`:
235
+
236
+ ```json
237
+ {
238
+ "serverId": "deepwiki",
239
+ "upstream": {
240
+ "url": "https://mcp.deepwiki.com/mcp",
241
+ "headers": { "Authorization": { "fromEnv": "UPSTREAM_TOKEN", "prefix": "Bearer " } },
242
+ "timeoutMs": 60000
243
+ },
244
+ "policy": { "default": "DENY", "riskOverrides": { "LOW": "ALLOW", "MEDIUM": "APPROVAL_REQUIRED" } }
245
+ }
246
+ ```
247
+
248
+ Flag form: `strix-mcp-proxy --upstream-url https://mcp.example.com/mcp --upstream-header-env Authorization=UPSTREAM_TOKEN`.
249
+
250
+ Policy, approvals, receipts and outcomes work exactly as for a stdio upstream. What the HTTP
251
+ leg adds is a set of refusals, each covered by a test that counts requests:
252
+
253
+ | Refused | How |
254
+ |---|---|
255
+ | Plain `http://` to a remote host | Startup error. `http://` is accepted only for a loopback host. |
256
+ | A username or password in the URL | Startup error. |
257
+ | A literal value for a credential-shaped header (`Authorization`, `Cookie`, anything named like a token, key, secret or password) | Startup error. Use `{ "fromEnv": "VAR" }`. A missing variable is also a startup error. |
258
+ | A request to any origin other than the upstream's (or one listed in `allowedOrigins`) | Refused before it is sent. |
259
+ | Any redirect | `fetch` runs with `redirect: "manual"`; a 3xx is an error and is not followed. |
260
+ | A host that resolves to a private, link-local, loopback (unless the URL itself is loopback) or cloud-metadata address | Refused before it is sent. `allowPrivateNetwork: true` admits private ranges for an upstream inside your network; metadata and link-local stay refused. |
261
+ | A credential echoed in an upstream error | Scrubbed before it reaches the client or the gateway's error event. |
262
+ | A response body over `maxResponseBytes` (default 8 MiB) | Discarded while streaming; the call fails and is signed `FAILED`. The upstream may already have acted. |
263
+
264
+ A call that is sent but not answered within `timeoutMs` (default 60000) is reported to the
265
+ client as `UPSTREAM_OUTCOME_UNKNOWN` and is **not retried**: the upstream may have acted. The
266
+ signed execution outcome for it reads `FAILED` with `errorCode: EXECUTOR_ERROR`; the frozen
267
+ outcome schema has no "unknown" status, so the distinction lives in the error message and the
268
+ `upstream.outcome_unknown` audit event, not in the signed record. The upstream's origin is
269
+ recorded in the unsigned audit stream (`upstream.connected`), never in a receipt.
270
+
271
+ Known gap: the address check and the connection resolve the host separately, so a host whose
272
+ DNS answer changes between the two (rebinding) is not fully excluded.
47
273
 
48
274
  ## 5-line integration (Claude Desktop)
49
275
 
@@ -133,7 +359,7 @@ for a complete example.
133
359
 
134
360
  ### Where the upstream's secrets should live
135
361
 
136
- v0.1.x does **no env-var substitution inside the config file** — there
362
+ The proxy does **no env-var substitution inside the config file** — there
137
363
  is no `${NOTION_TOKEN}` template syntax. Two supported patterns for
138
364
  upstream secrets:
139
365
 
@@ -231,22 +457,33 @@ Run `strix-mcp-proxy --help` for the full flag list.
231
457
 
232
458
  ## What ships with the proxy
233
459
 
234
- | Feature | v0.1.x (shipped) | v0.2.0 (planned) |
460
+ | Feature | Shipped through 0.2.x | Not built (no date committed) |
235
461
  |---|---|---|
236
462
  | MCP stdio transport (consumer side) | ✓ | — |
237
463
  | MCP stdio transport (upstream side) | ✓ | — |
238
- | MCP HTTP transport (either side) | — | ✓ |
464
+ | MCP Streamable HTTP transport, upstream side (proxy reaches a hosted server) | unreleased: in 0.3.0 source, not on npm | — |
465
+ | MCP HTTP transport, consumer side (proxy listens on HTTP) | — | planned |
466
+ | Legacy HTTP+SSE upstreams, OAuth for upstreams | — | planned |
467
+ | Tool-definition pinning (refuse a tool whose description or schema changed) | unreleased: in 0.3.0 source, on by default (`toolPinning: "block"`) | — |
468
+ | Hide always-denied tools from `tools/list` | unreleased: opt-in `hideDeniedTools: true` | — |
469
+ | Rate limits per capability from config (`rateLimits`) | unreleased | — |
470
+ | Credential scanning of arguments (refuse) and results (report or redact) | unreleased: in 0.3.0 source, arguments on by default (`secretScanning.arguments: "block"`) | — |
471
+ | Argument rules per tool (`argumentRules`) | unreleased: in 0.3.0 source | — |
472
+ | `--validate` config dry run | unreleased: in 0.3.0 source | — |
473
+ | Append-only JSONL audit log file (`auditLog`) | unreleased: in 0.3.0 source | — |
474
+ | OpenTelemetry export, upstream OAuth, signed pin file | — | planned |
475
+ | Personal-data (PII) detection, secrets in unlisted formats | — | planned |
239
476
  | Companion-pack classification | ✓ | — |
240
477
  | Heuristic fallback for unknown tools | ✓ | — |
241
478
  | Fail-closed default policy | ✓ | — |
242
479
  | Per-capability rules + risk overrides | ✓ | — |
243
480
  | Approval gate (any approver implementation) | ✓ | — |
244
481
  | Local-mode signed receipts (in-memory or JSONL) | ✓ | — |
245
- | Connected mode (sync receipts to `strixgov.com`) | ✓ programmatic only via `startProxy({ connectedMode })` | ✓ JSON config |
482
+ | Connected mode (sync receipts to `strixgov.com`) | ✓ programmatic only via `startProxy({ connectedMode })` | JSON config: planned |
246
483
  | Mode 1 (Observed) | ✓ | — |
247
- | Mode 2 (Approval-Gated) | ✓ | — |
248
- | **Mode 3 (Capability-Enforced) — `execution_authorization_v1` token mint + transport** | — | ✓ |
249
- | **Posture B reference impl (HTTP outbound enforcement)** | — | ✓ |
484
+ | Mode 2 (Approval-Gated) | ✓ (file approvals can require an Ed25519-signed response from a listed approver key, 0.2.3+) | — |
485
+ | **Mode 3 (Capability-Enforced) — `execution_authorization_v1` token mint + transport** | — | planned |
486
+ | **Posture B reference impl (HTTP outbound enforcement)** | — | planned |
250
487
 
251
488
  See [`docs/strategy/mcp-mode-ladder-v1.md`](https://github.com/Strixgov/strix/tree/main/docs/strategy/mcp-mode-ladder-v1.md)
252
489
  for the framing of Mode 1 / 2 / 3 and the exact public claim available
@@ -255,21 +492,22 @@ at each enforcement strength.
255
492
  ## The upgrade path to Mode 3
256
493
 
257
494
  Mode 3 — Capability-Enforced — is the upgrade, not a rewrite. The
258
- v0.1.x proxy already routes every outbound call through a single
259
- `buildUpstreamIface()` seam in `src/proxy.mjs`. In v0.2.0 a new option
260
- (`mode: "enforced"`) will wrap that seam with the
495
+ proxy already routes every outbound call through a single
496
+ `buildUpstreamIface()` seam in `src/proxy.mjs`. A future option
497
+ (`mode: "enforced"`, **not implemented in any released version, including
498
+ 0.2.4**) is intended to wrap that seam with the
261
499
  `execution_authorization_v1` token mint + transport step per
262
500
  [`docs/architecture/mcp-mode-3-enforcement-v1.md`](https://github.com/Strixgov/strix/tree/main/docs/architecture/mcp-mode-3-enforcement-v1.md).
263
501
 
264
- Operators turn on Mode 3 by adding `"mode": "enforced"` to the config
265
- file. Upstream MCP servers that opt in to validation (via
502
+ Once built, operators would turn on Mode 3 by adding `"mode": "enforced"`
503
+ to the config file, and upstream MCP servers that opt in to validation (via
266
504
  [`@strixgov/mcp-token-validator`](https://www.npmjs.com/package/@strixgov/mcp-token-validator))
267
- refuse to act on sensitive tools unless the token is present.
505
+ would refuse to act on sensitive tools unless the token is present.
268
506
 
269
507
  The cryptographic primitive is already shipped — see
270
508
  [`@strixgov/mcp-token-validator`](https://www.npmjs.com/package/@strixgov/mcp-token-validator).
271
- v0.1.x of the proxy does not mint these tokens yet; what it does is
272
- make sure the *seam* exists so v0.2.0 plugs in cleanly.
509
+ The proxy does not mint these tokens today; what it does is
510
+ make sure the *seam* exists so the step can be added without a rewrite.
273
511
 
274
512
  ## Listening to receipts (programmatic embedding)
275
513
 
@@ -371,17 +609,18 @@ keys are strictly better in every dimension that isn't a one-off demo.
371
609
  the library; the proxy is the standalone process. They share the
372
610
  same governance core (`@strixgov/tool-gateway`) and produce
373
611
  byte-identical receipts.
374
- - **Not an interceptor of HTTP-transport MCP servers.** v0.1.x wraps
375
- the stdio transport only. Hosted HTTP MCP servers (the Claude
376
- Desktop "Add Connector" URL pattern, e.g.
377
- `https://mcp.notion.com/mcp`) are not in scope — the client talks
378
- to them over HTTPS directly and no local process exists to wrap.
379
- Use the upstream's local stdio server in the meantime; the
380
- HTTP-transport story is Posture B in
381
- [`docs/architecture/mcp-mode-3-enforcement-v1.md`](https://github.com/Strixgov/strix/tree/main/docs/architecture/mcp-mode-3-enforcement-v1.md).
382
- - **Not Mode 3 today.** v0.1.x ships Mode 1 + Mode 2. Mode 3
383
- enforcement is the v0.2.0 upgrade path, designed for, but not
384
- implemented in, this release.
612
+ - **Not an interceptor of HTTP-transport MCP servers.** The unreleased
613
+ HTTP upstream lets the proxy *call* a hosted server on the client's
614
+ behalf. It does not intercept a client that connects to the hosted
615
+ URL itself (the Claude Desktop "Add Connector" pattern, e.g.
616
+ `https://mcp.notion.com/mcp`): that traffic never passes through the
617
+ proxy. Stopping it is Posture B in
618
+ [`docs/architecture/mcp-mode-3-enforcement-v1.md`](https://github.com/Strixgov/strix/tree/main/docs/architecture/mcp-mode-3-enforcement-v1.md),
619
+ which is not built.
620
+ - **Not Mode 3 today.** Releases through 0.2.5 ship Mode 1 + Mode 2.
621
+ Mode 3 enforcement was first sketched as a 0.2.0 item and has not
622
+ shipped; it is designed for, not implemented, and carries no date.
623
+ Do not describe the proxy as capability-enforced.
385
624
  - **Not a credential vault.** Upstream tokens (`NOTION_TOKEN`,
386
625
  `GITHUB_TOKEN`, etc.) flow through `process.env` or
387
626
  `upstream.env` and reach the upstream MCP server as-is. The
@@ -419,7 +658,7 @@ posture, including:
419
658
  - **Process model** — what happens on crash / mid-approval / disk
420
659
  full. Fail-closed at every boundary; the proxy will not start
421
660
  without a loadable signing key.
422
- - **Multi-tenant boundary** — single-tenant by design in v0.1.x;
661
+ - **Multi-tenant boundary** — single-tenant by design through 0.2.x;
423
662
  run one proxy process per tenant for isolation.
424
663
  - **What the proxy does NOT govern** — out-of-wrapper traffic, the
425
664
  agent's internal state, the upstream's own argument handling
@@ -451,5 +690,5 @@ this license boundary.
451
690
 
452
691
  ## Requirements
453
692
 
454
- - Node.js ≥ 18
693
+ - Node.js ≥ 18 for this package (`@strixgov/guard`, which configures it, needs ≥ 20)
455
694
  - An upstream MCP server (stdio transport)