Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix(mcp-host): drop the unreachable contextId branch from the broker subject (R2-L1)
Diego Zacarias86ff2f884cb1
diff --git a/mcp-host/package-lock.json b/mcp-host/package-lock.jsonindex 209ea04ec..698fb85b3 100644--- a/mcp-host/package-lock.json+++ b/mcp-host/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-mcp-host",- "version": "0.1.285",+ "version": "0.1.286","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-mcp-host",- "version": "0.1.285",+ "version": "0.1.286","license": "SEE LICENSE IN LICENSE","dependencies": {"@anthropic-ai/sdk": "^0.32.0",diff --git a/mcp-host/package.json b/mcp-host/package.jsonindex fd458bb54..83c4d8fce 100644--- a/mcp-host/package.json+++ b/mcp-host/package.json@@ -1,6 +1,6 @@{"name": "clerum-mcp-host",- "version": "0.1.285",+ "version": "0.1.286","description": "MCP Host - reads Host CRD and provides LLM access via OpenAI/Claude","main": "dist/main.js","engines": {diff --git a/mcp-host/src/mcp/brokerTokenProvider.ts b/mcp-host/src/mcp/brokerTokenProvider.tsindex b81f588e0..e3d38720f 100644--- a/mcp-host/src/mcp/brokerTokenProvider.ts+++ b/mcp-host/src/mcp/brokerTokenProvider.ts@@ -4,9 +4,10 @@** Reaches the control-api OAuth broker through the workflow-approval gateway* (decision #6/B — a POST-only L7-allowlisted location, NOT a new direct egress- * to control-api). The subject (userId | contextId) is baked into each provider- * INSTANCE, and its cache lives in a closure local to that instance: a provider- * built for user A can never POST — nor return — user B's token. The factory+ * to control-api). The subject (a userId, or empty for the shared context+ * identity) is baked into each provider INSTANCE, and its cache lives in a+ * closure local to that instance: a provider built for user A can never POST —+ * nor return — user B's token. The factory* builds a fresh provider per ClientKey, so per-user cache isolation is* structural, keyed by principal.*@@ -42,8 +43,14 @@ const CACHE_EXPIRY_HEADROOM_MS = 30_000export const NULL_EXPIRY_MAX_AGE_MS = 5 * 60_000export interface BrokerTokenSubject {+ /**+ * The per-user grant subject. Absent (`{}`) for oauth-context, where control-api+ * resolves the shared grant server-side from `server.spec.contextRef` and+ * mcp-host transports NO context identity (invariant I1). There is deliberately+ * no `contextId` here: the factory never sends one, so accepting it would be an+ * unreachable branch that contradicts I1.+ */userId?: string- contextId?: string}export interface BrokerTokenProviderDeps {@@ -91,11 +98,10 @@ export function createBrokerTokenProvider(console.warn('[BrokerTokenProvider] control token unavailable; failing closed')return undefined}- const body: { mcpServerName: string; userId?: string; contextId?: string } = {+ const body: { mcpServerName: string; userId?: string } = {mcpServerName: server.name,}if (subject.userId) body.userId = subject.userId- if (subject.contextId) body.contextId = subject.contextIdconst payload = JSON.stringify(body)const post = async (bearer: string): Promise<Response> =>