Skip to main content
Glama
ebowwa
by ebowwa

xcode_build_for_device

Build Xcode projects for physical iOS/macOS devices with automatic code signing. Specify project path, scheme, and device ID to generate deployable builds.

Instructions

Build project specifically for physical device with automatic signing

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_pathYesPath to .xcodeproj file
schemeYesBuild scheme name
device_idYesPhysical device UUID from list_physical_devices

Implementation Reference

  • Core handler logic for building Xcode project for a specific device using xcodebuild with automatic development team detection and provisioning handling. This is the execution logic for the tool.
    case 'build_with_auto_team': // Dynamically detect team and build const teamId = await this.fileManager.getDefaultDevelopmentTeam(); const teamFlag = teamId ? `DEVELOPMENT_TEAM=${teamId}` : ''; const buildCommand = `xcodebuild -project "${args.project_path}" -scheme "${args.scheme}" -destination "id=${args.device_id}" ${teamFlag} -allowProvisioningUpdates -allowProvisioningDeviceRegistration build`; const { stdout, stderr } = await execAsync(buildCommand); output = stdout; if (stderr) output += `\n\nWarnings/Errors:\n${stderr}`; break;
  • src/index.ts:87-89 (registration)
    Registers the list of available MCP tools, including dynamically generated Xcode tools like xcode_build_for_device.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [...tools, ...webMonitorTools], }));
  • MCP CallTool request handler that processes tool calls, strips 'xcode_' prefix from tool name (e.g. xcode_build_for_device -> build_for_device), and delegates to CommandExecutor.executeCommand.
    this.server.setRequestHandler(CallToolRequestSchema, async (request) => { const { name, arguments: args } = request.params; try { // Handle web monitor tools 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}` } ] }; } if (name === 'stop_web_monitor') { const result = this.webMonitorManager.stop(); return { content: [ { type: 'text', text: result.message } ] }; } if (name === 'web_monitor_status') { const status = this.webMonitorManager.getStatus(); let text = status.running ? `Web monitor is running at ${status.url} (port ${status.port})` : 'Web monitor is not running'; return { content: [ { type: 'text', text: text } ] }; } // Handle Xcode commands // Remove 'xcode_' prefix if present const commandName = name.startsWith('xcode_') ? name.slice(6) : name; const result = await this.commandExecutor.executeCommand(commandName, args); let responseText = result.output; if (result.error) { responseText += `\n\nWarnings/Errors:\n${result.error}`; } if (!result.success) { responseText = `Command failed: ${result.error}\n\nCommand executed: ${result.command}`; } return { content: [ { type: 'text', text: responseText, }, ], };
  • Dynamically generates MCP tool definitions including name (xcode_ + command name), description, and inputSchema from loaded command definitions.
    // Generate MCP tool definitions from commands generateMCPToolDefinitions(): Array<{ name: string; description: string; inputSchema: any; }> { return Object.entries(this.commands).map(([name, command]) => ({ name: `xcode_${name}`, description: command.description, inputSchema: { type: 'object', properties: command.parameters ? Object.fromEntries( Object.entries(command.parameters).map(([paramName, paramDef]) => [ paramName, { type: paramDef.type, description: paramDef.description, ...(paramDef.default !== undefined && { default: paramDef.default }) } ]) ) : {}, required: command.parameters ? Object.entries(command.parameters) .filter(([_, paramDef]) => paramDef.required) .map(([paramName]) => paramName) : [] } })); }
  • Helper function to detect the default development team ID from Xcode preferences, used in the build process for automatic signing.
    async getDefaultDevelopmentTeam(): Promise<string | null> { try { const { stdout } = await execAsync('defaults read com.apple.dt.Xcode IDEProvisioningTeamManagerLastSelectedTeamID 2>/dev/null'); return stdout.trim(); } catch { return null; } }

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/ebowwa/xcode-mcp'

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