/clear and /restart breaks mcp integration
Nobody has claimed this yet.
- Dominant language
- Shell
- Stars
- 11.2k
- Forks
- 1.9k
- Avg merge
- 14h 16m
- Merged PRs (30d)
- 6
Description
/clear and /restart leave MCP tools broken; only /mcp reload recovers them
Description
After running /clear (and also /restart), MCP tools stop working correctly in the new session. Restarting the CLI process from scratch (full exit + relaunch) works fine, so the issue is isolated to in-process session/state carryover — not the MCP server config itself. Running /mcp reload after /clear or /restart fixes it without needing a full process exit.
Steps to reproduce
- Start a session with MCP servers configured and working.
- Use MCP tools normally — confirm they work.
- Run /clear.
- Try to use an MCP tool — it fails / tools are unavailable.
- Run /restart — issue persists.
- Run /mcp reload — MCP tools work again.
- Alternatively, fully exit and relaunch the CLI — works fine on first try.
Expected behavior
/clear and /restart should leave MCP tools in the same working state as a fresh CLI launch, without requiring a manual /mcp reload.
Environment
- Copilot CLI version: 1.0.83
- OS: Linux
- Related: possibly same root cause as #4697 (/clear doesn't terminate previous stdio MCP server child processes)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the /clear, /restart, and /mcp reload command handling and the in-process MCP session/state lifecycle described here. Compare those paths with a fresh CLI launch and the related issue #4697; done means MCP tools remain available after /clear and /restart without requiring /mcp reload.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- shell
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100