Merge pull request #10 from built-by-as/failed-to-connect-regex-mcp

Fix MCP regex to handle SSE connection failures
This commit is contained in:
built-by-as 2025-10-09 12:56:49 -04:00 committed by GitHub
commit 26ab4531fa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -144,8 +144,8 @@ function spawnMcpPoller(sessionId: string, projectDir: string) {
// Parse output whenever we have MCP server entries // Parse output whenever we have MCP server entries
// Match lines like: "servername: url (type) - ✓ Connected" or "servername: command (stdio) - ✓ Connected" // Match lines like: "servername: url (type) - ✓ Connected" or "servername: command (stdio) - ✓ Connected"
// Pattern handles SSE, stdio, and HTTP types // Pattern handles SSE, stdio, and HTTP types (case-insensitive) with success (✓), warning (⚠), or failure (✗) status
const mcpServerLineRegex = /^[\w-]+:.+\((?:SSE|stdio|HTTP)\)\s+-\s+[✓⚠]/m; const mcpServerLineRegex = /^[\w-]+:.+\((?:SSE|sse|stdio|HTTP)\)\s+-\s+[✓⚠]/mi;
if (mcpServerLineRegex.test(data) || data.includes("No MCP servers configured")) { if (mcpServerLineRegex.test(data) || data.includes("No MCP servers configured")) {
try { try {
@ -217,7 +217,7 @@ function parseMcpOutput(output: string): any[] {
// Only parse lines that match the MCP server format // Only parse lines that match the MCP server format
// Must have: "name: something (SSE|stdio|HTTP) - status" // 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) { if (serverMatch) {
const serverName = serverMatch[1]; const serverName = serverMatch[1];
const isConnected = line.includes("✓") || line.includes("Connected"); const isConnected = line.includes("✓") || line.includes("Connected");