@strixgov/mcp-proxy 0.2.2 → 0.2.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.
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "@strixgov/github-mcp-reference-demo",
3
+ "version": "0.1.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "description": "Offline GitHub-shaped MCP acceptance demo; never contacts GitHub.",
7
+ "engines": {
8
+ "node": ">=18"
9
+ },
10
+ "scripts": {
11
+ "test": "node acceptance.mjs",
12
+ "demo": "node acceptance.mjs"
13
+ },
14
+ "dependencies": {
15
+ "@modelcontextprotocol/sdk": "1.32.2",
16
+ "@strixgov/capabilities-mcp-common": "0.1.2",
17
+ "@strixgov/guard": "0.1.4",
18
+ "@strixgov/mcp-adapter": "0.1.4",
19
+ "@strixgov/mcp-proxy": "0.2.3",
20
+ "@strixgov/tool-gateway": "0.5.2",
21
+ "@strixgov/verifier": "1.24.1"
22
+ }
23
+ }
@@ -0,0 +1,24 @@
1
+ # Reuse inventory
2
+
3
+ ## Published components exercised
4
+
5
+ | Existing component | Reused contract | Demo use |
6
+ |---|---|---|
7
+ | `@strixgov/guard@0.1.4` | `packForServer`, `buildProxyConfig`, `createApproverKey`, `approveSigned` | Selects the existing GitHub capability pack; writes exact approval requests; signs synthetic reviewer decisions over exact request bytes. |
8
+ | `@strixgov/capabilities-mcp-common@0.1.2` | Existing GitHub classifications | Classifies the read and merge tools; the fixture's unclassified `delete_repository` is denied by default. |
9
+ | `@strixgov/mcp-proxy@0.2.3` | Existing MCP interception and transport path | Intercepts calls over the supported in-memory test transport; no second proxy is added. |
10
+ | `@strixgov/mcp-adapter@0.1.4` | Capability resolution, policy evaluation, approval handling, receipt and outcome production | Used transitively by the published proxy. Its tarball's own `npm test` script fails because the tarball omits `scripts/preflight.mjs`; see the test logs. |
11
+ | `@strixgov/tool-gateway@0.5.2` | Existing policy, approval, storage, receipt, and signing primitives | Supplies the gateway and persisted logs; the harness adds no competing authority or signer. |
12
+ | `@strixgov/verifier@1.24.1` | Published receipt-chain and execution-outcome verification | Verifies signed receipts, receipt-linked outcomes, and tampering. Repository candidate 1.24.2 is unpublished and is not substituted. |
13
+
14
+ ## Existing source examined but not claimed as a published integration
15
+
16
+ The `docs/strategy/specs/execution-plane-phase-a-reference/github-merge-pep.mjs` and its tests implement a reference PEP with exact subject hashing, full head-SHA precondition, and injected single-use authority/revocation/evidence dependencies. It is source-reference-only, has no production callers, and returns unsigned results. Its source tests are not evidence that the published MCP stack or GitHub API executes a merge.
17
+
18
+ The production authority model remains the one to reuse: the first-party `github.pr.merge` capability is currently pending lifecycle and non-executable. `docs/architecture/mcp-mode-3-enforcement-v1.md` describes future signed execution authorization and atomic downstream nonce redemption; the published MCP proxy does not wire that Mode-3 path. The official GitHub MCP `merge_pull_request` shape also lacks the provider-side full-head-SHA precondition required by the PEP.
19
+
20
+ The adapter's `examples/github.mjs` can auto-approve a stub flow and can reach live GitHub when supplied a PAT; it was not run. `scripts/mcp-bundle-smoke.mjs` contains GitHub-related policy but exercises filesystem and `claude.read`, not a GitHub-specific end-to-end flow.
21
+
22
+ ## Integration gap
23
+
24
+ The published Mode-2 signed file approval is exact-request-bound, but it is not equivalent to a durable, atomic, payload-bound Mode-3 execution grant. This demo intentionally does not approve or dispatch a merge, and does not claim the proxy covers direct credentials or alternative routes.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strixgov/mcp-proxy",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "Strix MCP Proxy — the distribution wedge for governed agent tool execution. Point your MCP client at the proxy instead of the underlying server; every callTool is intercepted, evaluated against policy, and emits a signed Ed25519 receipt. Designed so Mode 3 (capability-enforced) is the v0.2.0 upgrade path, not a rewrite.",
5
5
  "license": "Elastic-2.0",
6
6
  "type": "module",
@@ -16,9 +16,9 @@
16
16
  },
17
17
  "dependencies": {
18
18
  "@modelcontextprotocol/sdk": "^1.0.0",
19
- "@strixgov/capabilities-mcp-common": "^0.1.0",
20
- "@strixgov/mcp-adapter": "^0.1.0",
21
- "@strixgov/tool-gateway": "^0.5.0"
19
+ "@strixgov/capabilities-mcp-common": "0.1.2",
20
+ "@strixgov/tool-gateway": "0.5.2",
21
+ "@strixgov/mcp-adapter": "0.1.5"
22
22
  },
23
23
  "devDependencies": {
24
24
  "zod": "^3.25.76"
package/src/proxy.mjs CHANGED
@@ -451,6 +451,7 @@ function resolveApproval(approval, opts) {
451
451
  requestDir,
452
452
  timeoutMs: approval.timeoutMs,
453
453
  pollIntervalMs: approval.pollIntervalMs,
454
+ ...signedResponseOptions(approval),
454
455
  }),
455
456
  };
456
457
  }
@@ -479,6 +480,7 @@ function resolveApproval(approval, opts) {
479
480
  requestDir,
480
481
  timeoutMs: approval.timeoutMs,
481
482
  pollIntervalMs: approval.pollIntervalMs,
483
+ ...signedResponseOptions(approval),
482
484
  onAudit: (event) => audit(opts, event),
483
485
  fetchImpl: approval.fetchImpl, // programmatic/test seam; not JSON-configurable
484
486
  }),
@@ -490,6 +492,21 @@ function resolveApproval(approval, opts) {
490
492
  );
491
493
  }
492
494
 
495
+ /**
496
+ * Signed-approval settings from the JSON config. When `requireSignedResponse`
497
+ * is true, an approving response must be signed by one of `approverKeys`
498
+ * (see tool-gateway approval-signing). A bad value throws at startup via the
499
+ * approver's own validation, so a half-configured gate never runs.
500
+ */
501
+ function signedResponseOptions(approval) {
502
+ if (approval.requireSignedResponse !== true) return {};
503
+ return {
504
+ requireSignedResponse: true,
505
+ approverKeys: approval.approverKeys,
506
+ maxResponseAgeMs: approval.maxResponseAgeMs,
507
+ };
508
+ }
509
+
493
510
  /**
494
511
  * Expand a leading `~` or `~/` to the OS user-home directory. Mirrors the
495
512
  * tilde-expansion behavior in loadConfig so `~/.strix-gateway/approvals`
@@ -120,6 +120,9 @@ export function webhookApprover(opts) {
120
120
  requestDir: opts.requestDir,
121
121
  timeoutMs: opts.timeoutMs,
122
122
  pollIntervalMs: opts.pollIntervalMs,
123
+ requireSignedResponse: opts.requireSignedResponse,
124
+ approverKeys: opts.approverKeys,
125
+ maxResponseAgeMs: opts.maxResponseAgeMs,
123
126
  onRequestWritten: async (_requestPath, requestId) => {
124
127
  const payload = buildWebhookPayload({ ...pendingRequest, requestId });
125
128
  try {
@@ -18,3 +18,15 @@ test("every script file the `test` script runs ships in the tarball", () => {
18
18
  assert.ok(covered(rel), `${rel} is used by \`npm test\` but excluded by package.json "files"`);
19
19
  }
20
20
  });
21
+
22
+ test("Strix dependencies are pinned exactly, so Guard's pinned proxy version fixes the whole Strix stack", () => {
23
+ // In this repository they are `workspace:*`, which pnpm publishes as the exact
24
+ // current version; in an installed copy they must already be exact versions.
25
+ // A range here means a new tool-gateway release changes what an existing Guard
26
+ // install runs (finding 1 of the #2810 evidence run).
27
+ const strix = Object.entries(pkg.dependencies).filter(([n]) => n.startsWith("@strixgov/"));
28
+ assert.ok(strix.length >= 3, "expected the Strix runtime dependencies");
29
+ for (const [name, spec] of strix) {
30
+ assert.ok(spec === "workspace:*" || /^\d+\.\d+\.\d+$/.test(spec), `${name} is "${spec}"; pin it exactly (workspace:*)`);
31
+ }
32
+ });
@@ -713,3 +713,75 @@ test("approval.prompt (function) wins over approval.type (programmatic caller pr
713
713
  await ctx.cleanup();
714
714
  }
715
715
  });
716
+
717
+ // --- Signed approvals (approval.requireSignedResponse) ---------------------
718
+ // The file approver is the decision channel. With signing required, an
719
+ // approving response written by anyone but an approver-key holder must not
720
+ // reach the upstream.
721
+ async function signedApprovalFixture() {
722
+ const cryptoMod = await import("node:crypto");
723
+ const { signApprovalResponse, approverKeyId, sha256Hex } = await import("@strixgov/tool-gateway");
724
+ const { publicKey, privateKey } = cryptoMod.generateKeyPairSync("ed25519");
725
+ const x = publicKey.export({ format: "jwk" }).x;
726
+ const kid = approverKeyId(x);
727
+ const requestDir = await tempDir("signed-approver");
728
+ const waitRequest = async () => {
729
+ for (let i = 0; i < 200; i++) {
730
+ const f = (await fs.readdir(requestDir)).find((n) => n.endsWith(".request.json"));
731
+ if (f) return { requestId: f.replace(".request.json", ""), text: await fs.readFile(path.join(requestDir, f), "utf8") };
732
+ await new Promise((r) => setTimeout(r, 20));
733
+ }
734
+ throw new Error("no approval request appeared");
735
+ };
736
+ const write = (id, body) => fs.writeFile(path.join(requestDir, `${id}.response.json`), JSON.stringify(body));
737
+ const sign = (requestId, text) => {
738
+ const requestSha256 = sha256Hex(text);
739
+ const decidedAt = new Date().toISOString();
740
+ return { approved: true, requestSha256, decidedAt, kid, signature: signApprovalResponse({ privateKey, kid, requestId, requestSha256, approved: true, decidedAt }) };
741
+ };
742
+ const approval = { enabled: true, type: "file", requestDir, timeoutMs: 4000, pollIntervalMs: 20, requireSignedResponse: true, approverKeys: [{ publicKey: x, label: "alice" }] };
743
+ return { requestDir, waitRequest, write, sign, approval };
744
+ }
745
+
746
+ test("signed approvals: a correctly signed approval lets the write reach the upstream", async () => {
747
+ const f = await signedApprovalFixture();
748
+ const ctx = await startProxyWithApproval(f.approval);
749
+ try {
750
+ const call = ctx.consumer.callTool({ name: "write_thing", arguments: { id: "x" } });
751
+ const { requestId, text } = await f.waitRequest();
752
+ await f.write(requestId, f.sign(requestId, text));
753
+ const result = await call;
754
+ assert.equal(result.content[0].text, "executed write_thing");
755
+ assert.equal(ctx.upstreamCallLog.length, 1);
756
+ } finally {
757
+ await ctx.cleanup();
758
+ await fs.rm(f.requestDir, { recursive: true, force: true });
759
+ }
760
+ });
761
+
762
+ test("signed approvals: an unsigned approving response (self-approval) never reaches the upstream", async () => {
763
+ const f = await signedApprovalFixture();
764
+ const ctx = await startProxyWithApproval(f.approval);
765
+ try {
766
+ const call = ctx.consumer.callTool({ name: "write_thing", arguments: { id: "x" } });
767
+ const { requestId } = await f.waitRequest();
768
+ await f.write(requestId, { approved: true, approvedBy: "alice (human reviewer)" });
769
+ await assert.rejects(() => call, /denied|approval/i);
770
+ assert.equal(ctx.upstreamCallLog.length, 0, "unsigned approval must not execute the write");
771
+ } finally {
772
+ await ctx.cleanup();
773
+ await fs.rm(f.requestDir, { recursive: true, force: true });
774
+ }
775
+ });
776
+
777
+ test("signed approvals: requiring signatures with no approver keys refuses to start", async () => {
778
+ const requestDir = await tempDir("signed-misconfig");
779
+ try {
780
+ await assert.rejects(
781
+ () => startProxyWithApproval({ enabled: true, type: "file", requestDir, requireSignedResponse: true }),
782
+ /approverKeys/,
783
+ );
784
+ } finally {
785
+ await fs.rm(requestDir, { recursive: true, force: true });
786
+ }
787
+ });