Skip to content

Commit bc30ef2

Browse files
committed
Start MCP poller immediately when session starts
1 parent ad3c292 commit bc30ef2

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

main.ts

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,6 @@ function spawnSessionPty(
220220
activePtyProcesses.set(sessionId, ptyProcess);
221221

222222
let terminalReady = false;
223-
let claudeReady = false;
224223
let dataBuffer = "";
225224

226225
ptyProcess.onData((data) => {
@@ -264,23 +263,16 @@ function spawnSessionPty(
264263
const flags = [sessionFlag, skipPermissionsFlag, mcpConfigFlag].filter(f => f).join(" ");
265264
const claudeCmd = `claude ${flags}\r`;
266265
ptyProcess.write(claudeCmd);
266+
267+
// Start MCP poller immediately (auth is handled by shell environment)
268+
if (!mcpPollerPtyProcesses.has(sessionId) && projectDir) {
269+
spawnMcpPoller(sessionId, projectDir);
270+
}
267271
} else if (config.codingAgent === "codex") {
268272
ptyProcess.write("codex\r");
269273
}
270274
}
271275
}
272-
273-
// Detect when Claude is ready (shows "> " prompt)
274-
if (terminalReady && !claudeReady && config.codingAgent === "claude") {
275-
if (data.includes("> ")) {
276-
claudeReady = true;
277-
// Spawn MCP poller now that Claude is authenticated and ready
278-
// Check if poller doesn't already exist to prevent duplicates
279-
if (!mcpPollerPtyProcesses.has(sessionId) && projectDir) {
280-
spawnMcpPoller(sessionId, projectDir);
281-
}
282-
}
283-
}
284276
});
285277

286278
return ptyProcess;

0 commit comments

Comments
 (0)