From 2dd39f7f548f05f7d7745bde735c74ee30c38b17 Mon Sep 17 00:00:00 2001 From: Ting-Wai To <40179554+tingwai@users.noreply.github.com> Date: Wed, 13 Aug 2025 11:03:02 -0700 Subject: [PATCH] fix: dont immediately exit on mcp config error --- src/MCPConnection.ts | 4 +++- src/mcp.ts | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/MCPConnection.ts b/src/MCPConnection.ts index 1eb9decff..8347cf0bf 100644 --- a/src/MCPConnection.ts +++ b/src/MCPConnection.ts @@ -28,7 +28,9 @@ export class MCPConnection { } if (!config?.command) { - throw new Error("MCP server command is not specified"); + const name = config?.name ?? config?.url ?? "server"; + logger.error(`MCP command missing for ${name}`); + return; } const transport = new StdioClientTransport({ diff --git a/src/mcp.ts b/src/mcp.ts index 2119916ff..bf2c82f96 100644 --- a/src/mcp.ts +++ b/src/mcp.ts @@ -27,7 +27,9 @@ export class MCPService { const connectionPromises = assistant.mcpServers.map((server) => MCPConnection.create(server), ); - const connections = await Promise.all(connectionPromises); + const connections = (await Promise.all(connectionPromises)).filter( + (item) => item !== undefined, + ); service.connections.push(...connections); logger.debug("MCP connections established", { connectionCount: connections.length,