start_web_monitor
Launch a web interface to visually execute and monitor commands for managing iOS/macOS projects programmatically via Xcode MCP Server.
Instructions
Start the web interface for visual command execution and monitoring
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:96-106 (handler)MCP tool handler for 'start_web_monitor': invokes WebMonitorManager.start() and formats the response with the web interface URL.if (name === 'start_web_monitor') { const result = await this.webMonitorManager.start(); return { content: [ { type: 'text', text: `${result.message}\n\nWeb interface available at: ${result.url}` } ] }; }
- src/index.ts:58-66 (schema)Tool schema definition including name, description, and empty input schema (no parameters required).{ name: 'start_web_monitor', description: 'Start the web interface for visual command execution and monitoring', inputSchema: { type: 'object', properties: {}, required: [] } },
- src/index.ts:87-89 (registration)Registers the 'start_web_monitor' tool (via webMonitorTools array) in the MCP listTools request handler.this.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [...tools, ...webMonitorTools], }));
- src/web-monitor-manager.ts:44-113 (helper)WebMonitorManager.start(): core logic finds an available port, spawns the web-server process with node, waits for startup confirmation, handles errors and cleanup.async start(): Promise<{ url: string; port: number; message: string }> { if (this.isRunning && this.webServerProcess) { return { url: `http://localhost:${this.port}`, port: this.port, message: 'Web monitor is already running' }; } try { // Find an available port this.port = await this.findAvailablePort(); // Spawn the web server process const webServerPath = join(__dirname, 'web-server.js'); console.error(`[WebMonitor] Starting web server at ${webServerPath} on port ${this.port}`); this.webServerProcess = spawn('node', [webServerPath], { env: { ...process.env, PORT: this.port.toString() }, stdio: ['ignore', 'pipe', 'pipe'], detached: false }); // Wait for the "running at" message await new Promise<void>((resolve, reject) => { const timeout = setTimeout(() => { reject(new Error('Web server failed to start within timeout')); }, 5000); if (this.webServerProcess!.stdout) { this.webServerProcess!.stdout.on('data', (data) => { const output = data.toString(); if (output.includes('running at')) { clearTimeout(timeout); resolve(); } }); } this.webServerProcess!.on('error', (err) => { clearTimeout(timeout); reject(err); }); this.webServerProcess!.on('exit', (code) => { clearTimeout(timeout); reject(new Error(`Web server exited with code ${code}`)); }); }); this.isRunning = true; // Handle process cleanup this.webServerProcess.on('exit', () => { this.isRunning = false; this.webServerProcess = null; }); const url = `http://localhost:${this.port}`; return { url, port: this.port, message: `Web monitor started successfully at ${url}` }; } catch (error) { this.stop(); throw error; } }