From b0ab86ba9a6c0fdfc93af35b2bde720f31d1ab0d Mon Sep 17 00:00:00 2001 From: Amrit Subramanian Date: Thu, 9 Oct 2025 12:15:03 -0400 Subject: [PATCH] Fix MCP regex to handle SSE connection failures MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update regex patterns to recognize SSE servers (case-insensitive) with failed connection status (✗). Previously only matched successful (✓) or warning (⚠) states, causing failed SSE connections to be ignored. --- main.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.ts b/main.ts index f718322..34ceb40 100644 --- a/main.ts +++ b/main.ts @@ -144,8 +144,8 @@ function spawnMcpPoller(sessionId: string, projectDir: string) { // Parse output whenever we have MCP server entries // Match lines like: "servername: url (type) - ✓ Connected" or "servername: command (stdio) - ✓ Connected" - // Pattern handles SSE, stdio, and HTTP types - const mcpServerLineRegex = /^[\w-]+:.+\((?:SSE|stdio|HTTP)\)\s+-\s+[✓⚠]/m; + // Pattern handles SSE, stdio, and HTTP types (case-insensitive) with success (✓), warning (⚠), or failure (✗) status + const mcpServerLineRegex = /^[\w-]+:.+\((?:SSE|sse|stdio|HTTP)\)\s+-\s+[✓⚠✗]/mi; if (mcpServerLineRegex.test(data) || data.includes("No MCP servers configured")) { try { @@ -217,7 +217,7 @@ function parseMcpOutput(output: string): any[] { // Only parse lines that match the MCP server format // Must have: "name: something (SSE|stdio|HTTP) - status" - const serverMatch = line.match(/^([\w-]+):.+\((?:SSE|stdio|HTTP)\)\s+-\s+[✓⚠]/); + const serverMatch = line.match(/^([\w-]+):.+\((?:SSE|sse|stdio|HTTP)\)\s+-\s+[✓⚠✗]/i); if (serverMatch) { const serverName = serverMatch[1]; const isConnected = line.includes("✓") || line.includes("Connected");