fix: dont immediately exit on mcp config error

This commit is contained in:
Ting-Wai To 2025-08-13 11:03:02 -07:00
parent 8c40116364
commit 2dd39f7f54
2 changed files with 6 additions and 2 deletions

View file

@ -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({

View file

@ -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,