fix: close MCP toolset sessions#346
Conversation
|
Related to: #377 |
| console.error(e); | ||
| } | ||
| // Async CLI actions can briefly await before opening a server handle. | ||
| const keepAliveUntilCommandStarts = setInterval(() => {}, 2 ** 31 - 1); |
There was a problem hiding this comment.
please revert that change
|
Please revert the |
…et-sessions # Conflicts: # core/test/tools/mcp/mcp_toolset_test.ts
|
Updated the branch to follow the maintainer feedback and keep the PR scoped to MCP session handling only.\n\nChanges in this push:\n- Reverted the CLI entrypoint change requested by @kalenkevich.\n- Removed the extra CLI stdin workaround as well, so the PR diff no longer touches CLI files.\n- Merged current main and resolved the remaining conflict in the MCP toolset test only.\n- Kept the remaining diff limited to MCP session manager/toolset code and tests.\n\nLocal verification:\n- |
Summary
Root cause
MCPToolset.close() was a no-op even though MCPToolset creates MCP clients when discovering tools and its MCPTool wrappers can create additional sessions when invoked. Those clients were not tracked for lifecycle cleanup, so callers had no way to release MCP transports through the toolset close path.
Validation
Note: npm install reports existing dependency audit findings (26 total: 9 low, 4 moderate, 13 high); no dependency changes are included in this PR.