From cf511fa82016f9bf5dbd3fdacf790807fe0a1fbb Mon Sep 17 00:00:00 2001 From: Jonathan Haas Date: Mon, 13 Apr 2026 18:04:30 -0700 Subject: [PATCH] Generate config-relative Gate policy paths --- src/server.ts | 5 +++-- test/cli.test.ts | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/server.ts b/src/server.ts index f17058f..6fce03a 100644 --- a/src/server.ts +++ b/src/server.ts @@ -852,7 +852,7 @@ function buildGateConnectorYaml(upstreamPort: number, resourceName: string, hasP lines.push( "", "policies:", - " - path: \"gate/policies/mcp_tool_allowlist.rego\"", + " - path: \"policies/mcp_tool_allowlist.rego\"", " stage: \"pre_request\"" ); } @@ -888,7 +888,8 @@ function buildGateReadme(upstreamPort: number, hasPolicy: boolean): string { "", "## Generated Policy", "", - "The generated `gate/policies/mcp_tool_allowlist.rego` file allowlists the OpenAPI-derived tool names from this project." + "The generated `gate/policies/mcp_tool_allowlist.rego` file allowlists the OpenAPI-derived tool names from this project.", + "Its connector reference is config-relative, so `gate-connector -config /gate/connector.yaml` works regardless of your current working directory." ); } return `${lines.join("\n")}\n`; diff --git a/test/cli.test.ts b/test/cli.test.ts index fa8b8d4..e48af12 100644 --- a/test/cli.test.ts +++ b/test/cli.test.ts @@ -41,6 +41,7 @@ test("generate command creates project files", async () => { assert.match(serverTs, /--spec/); assert.match(gateReadme, /Point your MCP client at Gate/); assert.match(gateConnector, /protocol: "mcp"/); + assert.match(gateConnector, /path: "policies\/mcp_tool_allowlist\.rego"/); assert.match(gatePolicy, /approved_tools/); assert.match(gatePolicy, /getHealth/); assert.match(gatePolicy, /postEcho/);