Description
When reloading MCP servers with /mcp reload, the CLI correctly terminates the existing stdio MCP server child process before starting a new one. However, running /clear (start fresh session) spawns a new stdio MCP server process without terminating the previous session's MCP server process, leaking orphaned processes over time.
Steps to reproduce
- Start a session with a stdio-based MCP server configured (e.g. a custom
*.exe MCP server).
- Confirm the server process is running (e.g. via Task Manager /
Get-Process).
- Run
/clear.
- Observe: a new instance of the MCP server process starts, but the previous one is still running.
- Repeat
/clear multiple times — orphaned process count grows unbounded.
- Contrast with
/mcp reload, which correctly stops the old process before starting the new one.
Expected behavior
/clear should terminate/clean up MCP server child processes from the previous session (or reuse them) before/while starting the new session's servers, matching the behavior of /mcp reload.
Actual behavior
Old MCP stdio server processes are left running indefinitely after /clear, accumulating over repeated use (observed 22+ orphaned exe instances in one session).
Environment
- Copilot CLI version: 1.0.82
- OS: Windows
- MCP server type: stdio-based custom MCP server
Description
When reloading MCP servers with
/mcp reload, the CLI correctly terminates the existing stdio MCP server child process before starting a new one. However, running/clear(start fresh session) spawns a new stdio MCP server process without terminating the previous session's MCP server process, leaking orphaned processes over time.Steps to reproduce
*.exeMCP server).Get-Process)./clear./clearmultiple times — orphaned process count grows unbounded./mcp reload, which correctly stops the old process before starting the new one.Expected behavior
/clearshould terminate/clean up MCP server child processes from the previous session (or reuse them) before/while starting the new session's servers, matching the behavior of/mcp reload.Actual behavior
Old MCP stdio server processes are left running indefinitely after
/clear, accumulating over repeated use (observed 22+ orphaned exe instances in one session).Environment