In ACP mode, the Mcp server list sent by the IDE client can include
SSE (type: "sse") and HTTP (type: "http") transports, but the previous
implementation only handled stdio servers via toStdioServer(). Non-stdio
servers were silently skipped (continue), so any SSE/HTTP-configured
MCP server would never be registered.
Changes:
- Add toSseServer() helper: detects type=="sse" servers and maps them
to MCPServerConfig(url=..., headers=...)
- Add toHttpServer() helper: detects type=="http" servers and maps them
to MCPServerConfig(httpUrl=..., headers=...)
- Refactor newSessionConfig() loop to handle all three transport types
- Declare mcpCapabilities: { sse: true, http: true } in agentCapabilities
so IDE clients know this agent supports these transports without needing
a transparent proxy
- Export the three helper functions for unit testing
Tests:
- Unit tests for toStdioServer / toSseServer / toHttpServer helpers
(type discrimination, mutual exclusion)
- Integration-style tests for QwenAgent.initialize() mcpCapabilities
- Integration-style tests for newSession() with SSE/HTTP MCP servers,
verifying MCPServerConfig is constructed with the correct arguments
(url vs httpUrl, headers passthrough, empty-headers → undefined)
Fixes#3472
PR #2472 added SIGTERM/SIGINT handlers in runAcpAgent() that destroy
stdin/stdout streams, allowing the ACP connection to close. However,
it did not call runExitCleanup() to terminate child processes (MCP
servers, etc.) spawned by the CLI. This caused orphan subprocesses
to persist after the IDE disconnects, especially noticeable in VSCode
with multiple tabs.
Changes:
- acpAgent.ts: Call runExitCleanup() in the shutdown signal handler
before process.exit(0), ensuring MCP server subprocesses are killed
- gemini.tsx: Call runExitCleanup() + process.exit(0) after
runAcpAgent() returns normally, matching the cleanup pattern used
by other non-interactive exit paths
- Add 4 unit tests covering SIGTERM cleanup, SIGINT cleanup,
idempotent shutdown, and cleanup-failure resilience
Closes#1884