Skip to content

Commit b0ab86b

Browse files
committed
Fix MCP regex to handle SSE connection failures
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.
1 parent d6f853a commit b0ab86b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

main.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@ function spawnMcpPoller(sessionId: string, projectDir: string) {
144144

145145
// Parse output whenever we have MCP server entries
146146
// Match lines like: "servername: url (type) - ✓ Connected" or "servername: command (stdio) - ✓ Connected"
147-
// Pattern handles SSE, stdio, and HTTP types
148-
const mcpServerLineRegex = /^[\w-]+:.+\((?:SSE|stdio|HTTP)\)\s+-\s+[]/m;
147+
// Pattern handles SSE, stdio, and HTTP types (case-insensitive) with success (✓), warning (⚠), or failure (✗) status
148+
const mcpServerLineRegex = /^[\w-]+:.+\((?:SSE|sse|stdio|HTTP)\)\s+-\s+[]/mi;
149149

150150
if (mcpServerLineRegex.test(data) || data.includes("No MCP servers configured")) {
151151
try {
@@ -217,7 +217,7 @@ function parseMcpOutput(output: string): any[] {
217217

218218
// Only parse lines that match the MCP server format
219219
// Must have: "name: something (SSE|stdio|HTTP) - status"
220-
const serverMatch = line.match(/^([\w-]+):.+\((?:SSE|stdio|HTTP)\)\s+-\s+[]/);
220+
const serverMatch = line.match(/^([\w-]+):.+\((?:SSE|sse|stdio|HTTP)\)\s+-\s+[]/i);
221221
if (serverMatch) {
222222
const serverName = serverMatch[1];
223223
const isConnected = line.includes("✓") || line.includes("Connected");

0 commit comments

Comments
 (0)