[FEATURE] Allow hooks to trigger MCP server reconnection
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
SessionStart hooks can start/restart MCP servers and output system messages, but they cannot programmatically trigger MCP reconnection. After a hook restarts an MCP server (e.g., as part of an environment switch workflow), the user must manually run /mcp → Reconnect before tools become available again.
This creates a multi-step manual workflow where it could be seamless:
- A skill restarts an MCP server with new configuration
- The user runs
/clear(triggering the SessionStart hook) - The hook detects the restarted server
- The user must manually run
/mcp→ Reconnect ← this step should be automatable
Proposed Solution
Allow the SessionStart hook's JSON response to include a directive that triggers MCP reconnection for specified servers. For example:
{
"systemMessage": "MCP server restarted with new config.",
"hookSpecificOutput": {
"hookEventName": "SessionStart",
"reconnectMcpServers": ["snowflake"]
}
}
Claude Code would process this by automatically re-initializing the MCP session for the named servers, the same way /mcp → Reconnect does today.
Alternative Solutions
- Document the manual step clearly: This is the current workaround. The hook outputs a message telling the user to run
/mcp. Works but adds friction. - Auto-reconnect on connection failure: Claude Code could detect a broken MCP connection on the next tool call and automatically reconnect. This would help but is reactive rather than proactive, and the first tool call after a restart would still fail.
Priority
Low - Nice to have
Feature Category
MCP server integration
Use Case Example
Workflows that restart MCP servers mid-session — such as switching between environments, rotating credentials, or changing server configuration — currently require the user to remember and execute /mcp → Reconnect after every switch. This is error-prone (users forget and get confusing tool errors) and adds friction to what should be a single-action workflow.
Additional Context
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗