@strixgov/mcp-proxy 0.2.5 → 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.
- package/CHANGELOG.md +76 -8
- package/README.md +209 -20
- package/bin/strix-mcp-proxy.mjs +100 -5
- package/package.json +4 -4
- package/src/config.mjs +152 -2
- package/src/content-guard.mjs +432 -0
- package/src/http-upstream.mjs +431 -0
- package/src/index.mjs +11 -2
- package/src/proxy.mjs +241 -33
- package/src/tool-guard.mjs +183 -0
- package/src/types.d.ts +83 -1
- package/test/content-guard-hardening.test.mjs +159 -0
- package/test/content-guard.test.mjs +387 -0
- package/test/http-upstream-config.test.mjs +115 -0
- package/test/http-upstream-e2e.test.mjs +279 -0
- package/test/http-upstream.test.mjs +304 -0
- package/test/tool-guard.test.mjs +243 -0
- package/test/validate-cli.test.mjs +171 -0
package/CHANGELOG.md
CHANGED
|
@@ -7,14 +7,77 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
-
## [0.
|
|
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.
|
|
11
16
|
|
|
12
17
|
### Added
|
|
13
|
-
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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.)
|
|
18
81
|
|
|
19
82
|
### Changed (documentation and package metadata)
|
|
20
83
|
- README opens with a "Choose your path" table (Guard, this proxy, the adapter, the verifier,
|
|
@@ -24,11 +87,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
24
87
|
HTTP transport have not shipped in any release; the README no longer implies a version for them.
|
|
25
88
|
- Requirements note that `@strixgov/guard` needs Node 20 or later while this package still supports 18.
|
|
26
89
|
- `package.json` description no longer says Mode 3 is "the v0.2.0 upgrade path".
|
|
27
|
-
-
|
|
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.)
|
|
28
96
|
- Adds `mcpName` (`io.github.Strixgov/mcp-proxy`) to `package.json`, which the official MCP Registry
|
|
29
97
|
requires inside the published npm package to verify ownership, and a `server.json` for
|
|
30
98
|
`mcp-publisher` (validated with `mcp-publisher validate`; not shipped in the tarball).
|
|
31
|
-
The registry listing
|
|
99
|
+
The registry listing was published 2026-11-30 (pointer to the npm package).
|
|
32
100
|
|
|
33
101
|
## [0.2.4] - 2026-11-15
|
|
34
102
|
|
package/README.md
CHANGED
|
@@ -51,9 +51,12 @@ Only what has been run is marked Observed. Needs Node 20 or later for Guard (18
|
|
|
51
51
|
| macOS | Any | stdio | Not tested | No run. |
|
|
52
52
|
| Clean machine, cold install | Any | stdio | Not tested | Every run so far was on a build container with the monorepo present. |
|
|
53
53
|
| A person approving at a terminal | Signed approvals | stdio | Not tested | Approvals so far came from a script. |
|
|
54
|
-
| Hosted MCP
|
|
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. |
|
|
55
58
|
|
|
56
|
-
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.
|
|
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/`.
|
|
57
60
|
|
|
58
61
|
Compared to `@strixgov/mcp-adapter`, which is a library you integrate into
|
|
59
62
|
your own MCP server code: the proxy is a **standalone process** you run in
|
|
@@ -83,15 +86,190 @@ Tool implementations are untouched. The MCP client (Claude Desktop, mcp-cli,
|
|
|
83
86
|
IDE integration, your own code) doesn't need to know Strix exists — it just
|
|
84
87
|
spawns this proxy in place of the upstream server.
|
|
85
88
|
|
|
86
|
-
> **Transport scope
|
|
87
|
-
>
|
|
88
|
-
>
|
|
89
|
-
>
|
|
90
|
-
>
|
|
91
|
-
>
|
|
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
|
|
92
100
|
> [Posture B](https://github.com/Strixgov/strix/tree/main/docs/architecture/mcp-mode-3-enforcement-v1.md)
|
|
93
|
-
> in the Mode 3 architecture and is not built.
|
|
94
|
-
|
|
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.
|
|
95
273
|
|
|
96
274
|
## 5-line integration (Claude Desktop)
|
|
97
275
|
|
|
@@ -283,7 +461,18 @@ Run `strix-mcp-proxy --help` for the full flag list.
|
|
|
283
461
|
|---|---|---|
|
|
284
462
|
| MCP stdio transport (consumer side) | ✓ | — |
|
|
285
463
|
| MCP stdio transport (upstream side) | ✓ | — |
|
|
286
|
-
| MCP HTTP transport (
|
|
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 |
|
|
287
476
|
| Companion-pack classification | ✓ | — |
|
|
288
477
|
| Heuristic fallback for unknown tools | ✓ | — |
|
|
289
478
|
| Fail-closed default policy | ✓ | — |
|
|
@@ -420,15 +609,15 @@ keys are strictly better in every dimension that isn't a one-off demo.
|
|
|
420
609
|
the library; the proxy is the standalone process. They share the
|
|
421
610
|
same governance core (`@strixgov/tool-gateway`) and produce
|
|
422
611
|
byte-identical receipts.
|
|
423
|
-
- **Not an interceptor of HTTP-transport MCP servers.** The
|
|
424
|
-
the
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
- **Not Mode 3 today.** Releases through 0.2.
|
|
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.
|
|
432
621
|
Mode 3 enforcement was first sketched as a 0.2.0 item and has not
|
|
433
622
|
shipped; it is designed for, not implemented, and carries no date.
|
|
434
623
|
Do not describe the proxy as capability-enforced.
|
package/bin/strix-mcp-proxy.mjs
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* Audit events print to stderr so the MCP stdio channel on stdout stays clean.
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import { startProxy, loadConfig, resolveCapabilities } from "../src/index.mjs";
|
|
20
|
+
import { startProxy, loadConfig, resolveCapabilities, describeConfig, unknownConfigKeys } from "../src/index.mjs";
|
|
21
21
|
|
|
22
22
|
const argv = process.argv.slice(2);
|
|
23
23
|
if (argv.includes("--help") || argv.includes("-h")) {
|
|
@@ -30,6 +30,30 @@ if (argv.includes("--version") || argv.includes("-v")) {
|
|
|
30
30
|
process.exit(0);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
if (argv.includes("--validate")) {
|
|
34
|
+
// Dry run: read and check the config, resolve the capability pack, print what
|
|
35
|
+
// it would do, and exit. Connects to nothing, spawns nothing, prints no
|
|
36
|
+
// credential. Exit 0 = valid, 1 = invalid.
|
|
37
|
+
const configPath = argv[argv.indexOf("--config") + 1];
|
|
38
|
+
if (!argv.includes("--config") || !configPath || configPath.startsWith("--")) {
|
|
39
|
+
console.error("strix-mcp-proxy --validate needs --config <path>");
|
|
40
|
+
process.exit(1);
|
|
41
|
+
}
|
|
42
|
+
try {
|
|
43
|
+
const cfg = await loadConfig(configPath);
|
|
44
|
+
const capabilities = await resolveCapabilities(cfg.capabilities);
|
|
45
|
+
const report = describeConfig(cfg, capabilities);
|
|
46
|
+
process.stdout.write(JSON.stringify({ valid: true, ...report }, null, 2) + "\n");
|
|
47
|
+
process.exitCode = 0;
|
|
48
|
+
} catch (err) {
|
|
49
|
+
process.stdout.write(JSON.stringify({ valid: false, error: err.message }, null, 2) + "\n");
|
|
50
|
+
process.exitCode = 1;
|
|
51
|
+
}
|
|
52
|
+
// Let the stream drain before the process ends: process.exit() can cut piped output short.
|
|
53
|
+
await new Promise((resolve) => process.stdout.write("", resolve));
|
|
54
|
+
process.exit(process.exitCode ?? 0);
|
|
55
|
+
}
|
|
56
|
+
|
|
33
57
|
try {
|
|
34
58
|
const opts = await parseArgs(argv);
|
|
35
59
|
const handle = await startProxy({
|
|
@@ -79,6 +103,9 @@ async function parseArgs(argv) {
|
|
|
79
103
|
const configPath = flag("--config");
|
|
80
104
|
if (configPath) {
|
|
81
105
|
const cfg = await loadConfig(configPath);
|
|
106
|
+
for (const key of unknownConfigKeys(cfg)) {
|
|
107
|
+
console.error(`[strix-proxy] warning: unknown config key '${key}' is ignored (typo?)`);
|
|
108
|
+
}
|
|
82
109
|
return {
|
|
83
110
|
serverId: cfg.serverId,
|
|
84
111
|
upstream: cfg.upstream,
|
|
@@ -88,14 +115,44 @@ async function parseArgs(argv) {
|
|
|
88
115
|
approval: cfg.approval,
|
|
89
116
|
storagePath: cfg.storagePath,
|
|
90
117
|
keyPath: cfg.keyPath,
|
|
118
|
+
toolPinning: cfg.toolPinning,
|
|
119
|
+
hideDeniedTools: cfg.hideDeniedTools,
|
|
120
|
+
rateLimits: cfg.rateLimits,
|
|
121
|
+
// Command-line scanning flags override the file, the same way --repin-tools does.
|
|
122
|
+
secretScanning: flag("--secret-scanning-args") || flag("--secret-scanning-results")
|
|
123
|
+
? { ...(cfg.secretScanning || {}), ...(flag("--secret-scanning-args") ? { arguments: flag("--secret-scanning-args") } : {}), ...(flag("--secret-scanning-results") ? { results: flag("--secret-scanning-results") } : {}) }
|
|
124
|
+
: cfg.secretScanning,
|
|
125
|
+
argumentRules: cfg.argumentRules,
|
|
126
|
+
auditLog: cfg.auditLog,
|
|
127
|
+
// --repin-tools on the command line wins, so an operator can accept a
|
|
128
|
+
// changed tool without editing the config file.
|
|
129
|
+
repinTools: argv.includes("--repin-tools") || cfg.repinTools === true,
|
|
91
130
|
};
|
|
92
131
|
}
|
|
93
132
|
|
|
94
133
|
const upstreamCommand = flag("--upstream-command");
|
|
95
|
-
|
|
96
|
-
|
|
134
|
+
const upstreamUrl = flag("--upstream-url");
|
|
135
|
+
if (!upstreamCommand && !upstreamUrl) {
|
|
136
|
+
throw new Error("missing --config or --upstream-command (or --upstream-url) (run with --help)");
|
|
137
|
+
}
|
|
138
|
+
if (upstreamCommand && upstreamUrl) {
|
|
139
|
+
throw new Error("--upstream-command and --upstream-url are mutually exclusive");
|
|
97
140
|
}
|
|
98
141
|
const upstreamArgs = flagAll("--upstream-arg");
|
|
142
|
+
// --upstream-header-env "Authorization=NOTION_TOKEN" reads the header's
|
|
143
|
+
// value from the environment variable; the value never appears in argv.
|
|
144
|
+
const upstreamHeaders = {};
|
|
145
|
+
for (const spec of flagAll("--upstream-header-env")) {
|
|
146
|
+
const eq = spec.indexOf("=");
|
|
147
|
+
if (eq <= 0 || eq === spec.length - 1) {
|
|
148
|
+
throw new Error(`--upstream-header-env expects NAME=ENV_VAR, got '${spec}'`);
|
|
149
|
+
}
|
|
150
|
+
const name = spec.slice(0, eq);
|
|
151
|
+
const envVar = spec.slice(eq + 1);
|
|
152
|
+
upstreamHeaders[name] = /^authorization$/i.test(name)
|
|
153
|
+
? { fromEnv: envVar, prefix: "Bearer " }
|
|
154
|
+
: { fromEnv: envVar };
|
|
155
|
+
}
|
|
99
156
|
const serverId = flag("--server-id") ?? "proxy";
|
|
100
157
|
const capabilitiesPath = flag("--capabilities");
|
|
101
158
|
const policyDefault = flag("--policy-default") ?? "DENY";
|
|
@@ -109,7 +166,9 @@ async function parseArgs(argv) {
|
|
|
109
166
|
|
|
110
167
|
return {
|
|
111
168
|
serverId,
|
|
112
|
-
upstream:
|
|
169
|
+
upstream: upstreamUrl
|
|
170
|
+
? { url: upstreamUrl, headers: upstreamHeaders }
|
|
171
|
+
: { command: upstreamCommand, args: upstreamArgs },
|
|
113
172
|
capabilities: capabilitiesPath ? await resolveCapabilities(capabilitiesPath) : undefined,
|
|
114
173
|
policy: {
|
|
115
174
|
riskOverrides: Object.keys(riskOverrides).length > 0 ? riskOverrides : undefined,
|
|
@@ -117,6 +176,12 @@ async function parseArgs(argv) {
|
|
|
117
176
|
},
|
|
118
177
|
approval: { enabled: approvalEnabled },
|
|
119
178
|
storagePath,
|
|
179
|
+
toolPinning: flag("--tool-pinning") ?? undefined,
|
|
180
|
+
hideDeniedTools: argv.includes("--hide-denied-tools"),
|
|
181
|
+
repinTools: argv.includes("--repin-tools"),
|
|
182
|
+
secretScanning: flag("--secret-scanning-args") || flag("--secret-scanning-results")
|
|
183
|
+
? { arguments: flag("--secret-scanning-args"), results: flag("--secret-scanning-results") }
|
|
184
|
+
: undefined,
|
|
120
185
|
};
|
|
121
186
|
}
|
|
122
187
|
|
|
@@ -126,6 +191,7 @@ function printHelp() {
|
|
|
126
191
|
USAGE
|
|
127
192
|
strix-mcp-proxy --config <path>
|
|
128
193
|
strix-mcp-proxy --upstream-command <cmd> [--upstream-arg <a> ...] [other flags]
|
|
194
|
+
strix-mcp-proxy --upstream-url <https-url> [--upstream-header-env H=VAR ...] [other flags]
|
|
129
195
|
|
|
130
196
|
CONFIG-FILE MODE
|
|
131
197
|
--config <path> Path to a JSON config file (see README for shape)
|
|
@@ -133,6 +199,13 @@ CONFIG-FILE MODE
|
|
|
133
199
|
FLAG MODE
|
|
134
200
|
--upstream-command <cmd> Command to spawn the upstream MCP server (e.g. "npx")
|
|
135
201
|
--upstream-arg <arg> One arg for the upstream command (repeatable)
|
|
202
|
+
--upstream-url <url> Remote MCP server reached over Streamable HTTP
|
|
203
|
+
(https only; plain http only for a loopback host)
|
|
204
|
+
--upstream-header-env H=VAR
|
|
205
|
+
Send header H with the value of environment
|
|
206
|
+
variable VAR (repeatable). For Authorization the
|
|
207
|
+
value is sent as "Bearer <VAR>". Values never
|
|
208
|
+
appear in argv, receipts, logs or errors.
|
|
136
209
|
--server-id <id> Namespace prefix for capability ids (default: "proxy")
|
|
137
210
|
--capabilities <pkg> Companion-pack import path
|
|
138
211
|
(e.g. @strixgov/capabilities-mcp-common/notion)
|
|
@@ -145,6 +218,27 @@ FLAG MODE
|
|
|
145
218
|
--approval-enabled Enable the approval gate (requires custom prompt)
|
|
146
219
|
--storage-path <dir> Persist authorization receipts and execution outcomes
|
|
147
220
|
(default: ~/.strix-mcp-proxy/<serverId>)
|
|
221
|
+
--tool-pinning <mode> block (default) | warn | off. Pins each tool's
|
|
222
|
+
definition on first sight; a later change is
|
|
223
|
+
refused (block) or reported (warn)
|
|
224
|
+
--repin-tools Accept the upstream's current tool definitions
|
|
225
|
+
as the new pins (works with --config too)
|
|
226
|
+
--hide-denied-tools Leave tools that policy always denies out of
|
|
227
|
+
tools/list
|
|
228
|
+
--secret-scanning-args <m>
|
|
229
|
+
block (default) | warn | off. Refuse (block) or
|
|
230
|
+
report a call whose arguments contain a
|
|
231
|
+
credential-shaped string
|
|
232
|
+
--secret-scanning-results <m>
|
|
233
|
+
warn (default) | redact | off. Report, or replace
|
|
234
|
+
with [REDACTED:<kind>], credential-shaped strings
|
|
235
|
+
in a tool's result before the client sees it
|
|
236
|
+
|
|
237
|
+
CHECK A CONFIG
|
|
238
|
+
--validate --config <path>
|
|
239
|
+
Read and check the config, resolve the capability
|
|
240
|
+
pack, print what it would do (no credentials) and
|
|
241
|
+
exit 0 (valid) or 1 (invalid). Connects to nothing.
|
|
148
242
|
|
|
149
243
|
TRUSTED WORKLOAD IDENTITY
|
|
150
244
|
STRIX_TRUSTED_ACTOR_ID Fixed authenticated workload identity
|
|
@@ -157,7 +251,8 @@ GENERAL
|
|
|
157
251
|
--help, -h Show this help
|
|
158
252
|
--version, -v Show proxy version
|
|
159
253
|
|
|
160
|
-
The proxy speaks MCP over stdio toward its consumer.
|
|
254
|
+
The proxy speaks MCP over stdio toward its consumer. Its upstream can be a
|
|
255
|
+
child process (stdio) or a remote server (Streamable HTTP). NVIDIA OO Agents,
|
|
161
256
|
Claude Desktop, mcp-cli, and other .mcp.json clients can spawn this binary
|
|
162
257
|
in place of the upstream MCP server.
|
|
163
258
|
`);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strixgov/mcp-proxy",
|
|
3
3
|
"mcpName": "io.github.Strixgov/mcp-proxy",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.3.0",
|
|
5
5
|
"description": "Strix MCP Proxy — put an authorization decision in front of the MCP tools an agent uses. Point your MCP client at the proxy instead of the underlying server; every callTool is intercepted, evaluated against policy (reads pass, writes can wait for a person), and produces a signed Ed25519 receipt that verifies offline against the proxy's public key. Source-available (Elastic-2.0).",
|
|
6
6
|
"license": "Elastic-2.0",
|
|
7
7
|
"type": "module",
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
"strix-mcp-proxy": "bin/strix-mcp-proxy.mjs"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
19
|
+
"@modelcontextprotocol/sdk": "^1.10.0",
|
|
20
|
+
"@strixgov/tool-gateway": "0.5.2",
|
|
20
21
|
"@strixgov/capabilities-mcp-common": "0.1.2",
|
|
21
|
-
"@strixgov/mcp-adapter": "0.1.5"
|
|
22
|
-
"@strixgov/tool-gateway": "0.5.2"
|
|
22
|
+
"@strixgov/mcp-adapter": "0.1.5"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"zod": "^3.25.76"
|