opencode
opencode copied to clipboard
feat(mcp): add restart all MCP servers functionality
Summary
- Add ability to restart all MCP servers without restarting opencode
- Useful for developers working on MCP servers who need to quickly reconnect after code changes
Changes
- Add
MCP.restartAll()function to disconnect and reconnect all connected/failed servers - Add
POST /mcp/restartAPI endpoint - Add
rkeybind in MCP dialog to restart all servers - Add
/restart-mcpslash command - Add "Restart MCPs" to command palette
- Regenerate SDK with new endpoint
Usage
- Open MCP dialog with
/mcp, then pressrto restart all - Use
/restart-mcpslash command - Use command palette → "Restart MCPs"
the api already allows u to disconnect and reconnect mcp servers I think u can just use that instead?
Good point! Updated the implementation to use the existing disconnect and connect endpoints instead of adding a new API endpoint. The restart logic now lives entirely on the client side - it:
- Gets all MCP servers with status "connected" or "failed"
- Calls disconnect on each in parallel
- Calls connect on each in parallel
- Refreshes the status No new API surface added.