Skip to main content
Glama
atom2ueki

MCP Server for iOS Simulator

boot-simulator-by-udid

Boot iOS simulators using their unique device identifier (UDID) with the MCP Server for iOS Simulator. Simplifies programmatic control and management of iOS simulators through standardized interfaces.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
udidYes

Implementation Reference

  • Registers the 'boot-simulator-by-udid' tool in the MCP server, defining its input schema (udid: string) and thin handler that calls simulatorManager.bootByUDID and formats the response.
    this.server.tool( 'boot-simulator-by-udid', { udid: z.string() }, async (params) => { fileLogger.info(`Booting simulator directly by UDID: ${params.udid}`); try { const result = await simulatorManager.bootByUDID(params.udid); if (result) { return { content: [{ type: 'text', text: `Successfully booted simulator with UDID: ${params.udid}` }] }; } else { return { content: [{ type: 'text', text: `Failed to boot simulator with UDID: ${params.udid}` }], isError: true }; } } catch (error) { fileLogger.error(`Failed to boot simulator by UDID: ${params.udid}`, { error }); return { content: [{ type: 'text', text: `Error: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } } );
  • Zod schema for the tool input: requires a 'udid' string parameter.
    udid: z.string() },
  • Main handler logic: validates simulator exists by UDID, checks if already booted, boots using appium-ios-simulator.getSimulator(udid).run(), waits and verifies boot status via getBootedSimulators.
    async bootByUDID(udid: string): Promise<boolean> { fileLogger.info(`Booting simulator with UDID: ${udid}`); try { // First check if a simulator with this UDID exists const allSimulators = await this.getAllSimulators(); const simulator = allSimulators.find(sim => sim.udid === udid); if (!simulator) { fileLogger.error(`No simulator found with UDID: ${udid}`); return false; } // Check if the simulator is already booted const bootedSimulators = await this.getBootedSimulators(); const isAlreadyBooted = bootedSimulators.some(sim => sim.udid === udid); if (isAlreadyBooted) { fileLogger.info(`Simulator with UDID ${udid} is already booted`); return true; } // Get a simulator instance from appium-ios-simulator const simulatorInstance = await getSimulator(udid); // Boot the simulator fileLogger.info(`Running simulator with UDID: ${udid}`); await simulatorInstance.run(); // Verify the simulator has booted await new Promise(resolve => setTimeout(resolve, 2000)); // Wait for simulator to register as booted const newBootedSimulators = await this.getBootedSimulators(); const didBoot = newBootedSimulators.some(sim => sim.udid === udid); if (didBoot) { fileLogger.info(`Successfully booted simulator with UDID: ${udid}`); return true; } else { fileLogger.error(`Simulator with UDID ${udid} did not register as booted after run() command`); return false; } } catch (error) { fileLogger.error(`Failed to boot simulator with UDID: ${udid}`, { error }); return false; } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/atom2ueki/mcp-server-ios-simulator'

If you have feedback or need assistance with the MCP directory API, please join our Discord server