Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

fix(mcp-host): gate reactive connect_required on authKind, not the dropped auth.type

Diego Zacarias17db002540b5
diff --git a/mcp-host/package-lock.json b/mcp-host/package-lock.json
index 7f6e1cb32..70e701bcf 100644
--- a/mcp-host/package-lock.json
+++ b/mcp-host/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-mcp-host",
- "version": "0.1.277",
+ "version": "0.1.278",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-mcp-host",
- "version": "0.1.277",
+ "version": "0.1.278",
"license": "SEE LICENSE IN LICENSE",
"dependencies": {
"@anthropic-ai/sdk": "^0.32.0",
diff --git a/mcp-host/package.json b/mcp-host/package.json
index 1908c8523..b34ffdd5f 100644
--- a/mcp-host/package.json
+++ b/mcp-host/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-mcp-host",
- "version": "0.1.277",
+ "version": "0.1.278",
"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/manager.ts b/mcp-host/src/mcp/manager.ts
index 9bef87245..860877a58 100644
--- a/mcp-host/src/mcp/manager.ts
+++ b/mcp-host/src/mcp/manager.ts
@@ -839,13 +839,21 @@ export class McpManager {
// U5 reactive-consent marker: a live 401 on an oauth server (surfaced
// only AFTER the client's single forced-refresh retry, so already
// terminal-after-retry — no loop) means the user must (re)connect. Gate
- // strictly on `auth.type==='oauth'` (covers BOTH per-user and shared
- // grantScope='context' — the shared flavor bootstraps on its first user)
- // AND `status===401`. A 403 (insufficient scope) is TERMINAL: no marker,
- // no connect flow. static (secretRef) has no consent flow → excluded by
- // the oauth type check. The marker is attached as a typed field so the
- // caller sees it (NOT flattened into the opaque error).
- if (info?.auth?.type === 'oauth' && error.status === 401) {
+ // strictly on `authKind ∈ {oauth-user, oauth-context}` (covers BOTH
+ // per-user and shared grantScope='context' — the shared flavor bootstraps
+ // on its first user) AND `status===401`. A 403 (insufficient scope) is
+ // TERMINAL: no marker, no connect flow. static (secretRef) has no consent
+ // flow → excluded by the authKind check. The marker is attached as a typed
+ // field so the caller sees it (NOT flattened into the opaque error).
+ //
+ // NOTE: this gate reads `authKind` (the HCC v2 inventory field), NOT the
+ // pre-mini-spec-10 `auth.type` — `decodeMcpServer` populates `authKind`
+ // and never `auth`, so `info.auth?.type` is always undefined here and the
+ // old check silently disabled reactive consent for every oauth server.
+ if (
+ (info?.authKind === 'oauth-user' || info?.authKind === 'oauth-context') &&
+ error.status === 401
+ ) {
return {
toolName: fullToolName,
result: { error: error.message },