stop_gui
Stop the web interface for managing Claude Code conversation sessions to conserve system resources.
Instructions
Stop the web GUI server
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/mcp/index.ts:252-281 (handler)Inline handler for the 'stop_gui' MCP tool. Checks if the web server instance exists, attempts a graceful shutdown via the /api/shutdown endpoint, calls stopWebServer to kill the process if necessary, clears the instance, and returns a success message.server.tool('stop_gui', 'Stop the web GUI server', {}, async () => { if (webServerInstance) { const port = webServerInstance.port // Call shutdown API first for graceful shutdown try { await fetch(`http://localhost:${port}/api/shutdown`, { method: 'POST' }) } catch { // Server might already be stopping } // Then kill the process if still running await stopWebServer(webServerInstance) webServerInstance = null return { content: [ { type: 'text', text: JSON.stringify({ success: true, message: 'Web GUI stopped successfully' }, null, 2), }, ], } } return { content: [ { type: 'text', text: JSON.stringify({ success: true, message: 'Web GUI was not running' }, null, 2), }, ], } })
- src/server.ts:65-67 (helper)Helper function stopWebServer that terminates the web server child process spawned by startWebServer, used by the stop_gui handler.export async function stopWebServer(server: WebServer): Promise<void> { server.process.kill('SIGTERM') }
- src/mcp/index.ts:170-170 (helper)Global variable storing the current web server instance, shared between start_gui and stop_gui tools.let webServerInstance: Awaited<ReturnType<typeof startWebServer>> | null = null
- src/mcp/index.ts:252-281 (registration)Registration of the 'stop_gui' tool on the MCP server with description, empty schema, and inline handler.server.tool('stop_gui', 'Stop the web GUI server', {}, async () => { if (webServerInstance) { const port = webServerInstance.port // Call shutdown API first for graceful shutdown try { await fetch(`http://localhost:${port}/api/shutdown`, { method: 'POST' }) } catch { // Server might already be stopping } // Then kill the process if still running await stopWebServer(webServerInstance) webServerInstance = null return { content: [ { type: 'text', text: JSON.stringify({ success: true, message: 'Web GUI stopped successfully' }, null, 2), }, ], } } return { content: [ { type: 'text', text: JSON.stringify({ success: true, message: 'Web GUI was not running' }, null, 2), }, ], } })