Commit dd6c8ea
fix(mcp): ensure MCP servers are gracefully shut down on CLI exit
This commit introduces a cleanup mechanism for MCP servers to prevent them from being orphaned or terminated abruptly when the Gemini CLI exits.
- Added a `dispose()` method to the `Config` class in `packages/core` that triggers `McpClientManager.stop()`.
- Registered `config.dispose()` as a cleanup handler in the main CLI entry point (`packages/cli/src/gemini.tsx`).
This ensures that the `stop()` method of `McpClientManager` is invoked, allowing for the proper closing of transport connections (sending SIGTERM/closing streams) to downstream MCP servers.1 parent 53f5443 commit dd6c8ea
2 files changed
+12
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
477 | 477 | | |
478 | 478 | | |
479 | 479 | | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
480 | 483 | | |
481 | 484 | | |
482 | 485 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
824 | 824 | | |
825 | 825 | | |
826 | 826 | | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
827 | 836 | | |
828 | 837 | | |
829 | 838 | | |
| |||
0 commit comments