From bc30ef22feb3ec89e29daf7a5bad43cf856781c8 Mon Sep 17 00:00:00 2001 From: Amrit Subramanian Date: Mon, 6 Oct 2025 20:46:04 -0400 Subject: [PATCH] Start MCP poller immediately when session starts --- main.ts | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/main.ts b/main.ts index 0190018..1fe22fc 100644 --- a/main.ts +++ b/main.ts @@ -220,7 +220,6 @@ function spawnSessionPty( activePtyProcesses.set(sessionId, ptyProcess); let terminalReady = false; - let claudeReady = false; let dataBuffer = ""; ptyProcess.onData((data) => { @@ -264,23 +263,16 @@ function spawnSessionPty( const flags = [sessionFlag, skipPermissionsFlag, mcpConfigFlag].filter(f => f).join(" "); const claudeCmd = `claude ${flags}\r`; ptyProcess.write(claudeCmd); + + // Start MCP poller immediately (auth is handled by shell environment) + if (!mcpPollerPtyProcesses.has(sessionId) && projectDir) { + spawnMcpPoller(sessionId, projectDir); + } } else if (config.codingAgent === "codex") { ptyProcess.write("codex\r"); } } } - - // Detect when Claude is ready (shows "> " prompt) - if (terminalReady && !claudeReady && config.codingAgent === "claude") { - if (data.includes("> ")) { - claudeReady = true; - // Spawn MCP poller now that Claude is authenticated and ready - // Check if poller doesn't already exist to prevent duplicates - if (!mcpPollerPtyProcesses.has(sessionId) && projectDir) { - spawnMcpPoller(sessionId, projectDir); - } - } - } }); return ptyProcess;