github / github/copilot-cli

/clear  does not terminate previous stdio MCP server child processes (unlike  /mcp reload )

Open
#4,697 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area:mcp area:sessions
Dominant language
Shell
Stars
11.2k
Forks
1.9k
Avg merge
14h 16m
Merged PRs (30d)
6

Description

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

  1. Start a session with a stdio-based MCP server configured (e.g. a custom *.exe MCP server).
  2. Confirm the server process is running (e.g. via Task Manager / Get-Process).
  3. Run /clear.
  4. Observe: a new instance of the MCP server process starts, but the previous one is still running.
  5. Repeat /clear multiple times — orphaned process count grows unbounded.
  6. 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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files or tests are named. Reproduce on Windows with a stdio MCP server, then trace the /clear session reset alongside the existing /mcp reload cleanup path. Done means repeated /clear commands do not leave previous MCP child processes running and existing reload behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
shell
Domain
cli, operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.