Skip to content

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

TypeScript

fix(mcp-host): use the authoritative server name for connect_required tool_source_ref (R3-L3)

Diego Zacarias9794c6fafe9e
diff --git a/mcp-host/package-lock.json b/mcp-host/package-lock.json
index 698fb85b3..82b3ff5e1 100644
--- a/mcp-host/package-lock.json
+++ b/mcp-host/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-mcp-host",
- "version": "0.1.286",
+ "version": "0.1.287",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-mcp-host",
- "version": "0.1.286",
+ "version": "0.1.287",
"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 83c4d8fce..ba757d8ba 100644
--- a/mcp-host/package.json
+++ b/mcp-host/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-mcp-host",
- "version": "0.1.286",
+ "version": "0.1.287",
"description": "MCP Host - reads Host CRD and provides LLM access via OpenAI/Claude",
"main": "dist/main.js",
"engines": {
diff --git a/mcp-host/src/core/extensions/__tests__/connectRequiredApproval.test.ts b/mcp-host/src/core/extensions/__tests__/connectRequiredApproval.test.ts
index b3ac20243..ceb1170f8 100644
--- a/mcp-host/src/core/extensions/__tests__/connectRequiredApproval.test.ts
+++ b/mcp-host/src/core/extensions/__tests__/connectRequiredApproval.test.ts
@@ -49,4 +49,15 @@ describe('buildConnectRequiredApproval', () => {
expect(approval.tool_source_ref).toBe('monday')
expect(typeof approval.request_id).toBe('string')
})
+
+ it('uses the authoritative server name for a server whose own name contains "__" (R3-L3)', () => {
+ // getMcpServerPrefix splits on the FIRST '__' → 'my' for this tool, but the
+ // authoritative server name is 'my__srv'. tool_source_ref must match the HITL
+ // gate's sourceRef (the whole server name), not the truncated prefix.
+ const approval = buildConnectRequiredApproval(
+ { id: 'call-2', name: 'my__srv__do', arguments: {} },
+ { mcpServerName: 'my__srv' }
+ )
+ expect(approval.tool_source_ref).toBe('my__srv')
+ })
})
diff --git a/mcp-host/src/core/extensions/mcpApprovalGateController.ts b/mcp-host/src/core/extensions/mcpApprovalGateController.ts
index f3427708d..ee772d6e6 100644
--- a/mcp-host/src/core/extensions/mcpApprovalGateController.ts
+++ b/mcp-host/src/core/extensions/mcpApprovalGateController.ts
@@ -83,7 +83,12 @@ export function buildConnectRequiredApproval(
request_id: randomUUID(),
tool_name: call.name,
tool_kind: 'mcp_server_tool',
- tool_source_ref: getMcpServerPrefix(call.name),
+ // The authoritative server name is the marker's mcpServerName (set from the
+ // manager's sourceRef), mirroring the HITL gate's createSuspension
+ // (tool_source_ref = traceDescriptor.sourceRef). getMcpServerPrefix splits on
+ // the FIRST '__', so it truncates a server whose own name contains '__';
+ // reuse the marker to keep both suspension paths consistent (R3-L3).
+ tool_source_ref: marker.mcpServerName,
parameters: call.arguments,
description: `Connect ${marker.mcpServerName} to continue`,
tool_call_id: call.id,