expo.stop
Stop the Expo/Metro development server to end debugging sessions and free system resources for iOS React Native applications.
Instructions
Stop the Expo/Metro development server
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/mcp/server.ts:297-316 (registration)Registers the 'expo.stop' MCP tool with an empty input schema. The handler calls stopExpo() from expo.ts and returns a standardized MCP response or error.server.tool( "expo.stop", "Stop the Expo/Metro development server", {}, async () => { try { await stopExpo(); return { content: [ { type: "text", text: JSON.stringify({ success: true, message: "Expo stopped" }), }, ], }; } catch (error) { return handleToolError(error); } } );
- src/expo/expo.ts:178-213 (handler)Core implementation of stopping Expo: checks if process exists, sends SIGTERM, waits 2s, then SIGKILL if needed, clears state variables, updates global state manager, and logs.export async function stopExpo(): Promise<void> { logger.info("expo", "Stopping Expo/Metro..."); if (!expoProcess) { logger.info("expo", "No Expo process running"); stateManager.updateExpo({ state: "stopped" }); return; } try { // Send SIGTERM first for graceful shutdown expoProcess.kill("SIGTERM"); // Wait a bit for graceful shutdown await new Promise((resolve) => setTimeout(resolve, 2000)); // If still running, force kill if (expoProcess) { expoProcess.kill("SIGKILL"); } } catch { // Ignore errors during cleanup } expoProcess = null; outputBuffer = ""; startedAt = null; stateManager.updateExpo({ state: "stopped", metroUrl: undefined, processId: undefined, }); logger.info("expo", "Expo stopped"); }