build_mac_proj
Builds macOS applications using xcodebuild from Xcode project files by specifying project path, scheme, and optional configuration settings.
Instructions
Builds a macOS app using xcodebuild from a project file.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectPath | Yes | Path to the .xcodeproj file (Required) | |
| scheme | Yes | The scheme to use (Required) | |
| configuration | No | Build configuration (Debug, Release, etc.) | |
| derivedDataPath | No | Path where build products and other derived data will go | |
| arch | No | Architecture to build for (arm64 or x86_64). For macOS only. | |
| extraArgs | No | Additional xcodebuild arguments | |
| preferXcodebuild | No | If true, prefers xcodebuild over the experimental incremental build system, useful for when incremental build system fails. |
Implementation Reference
- src/tools/build_macos.ts:47-71 (handler)Core handler logic for the 'build_mac_proj' tool. Executes the xcodebuild build command for macOS projects using executeXcodeBuildCommand.async function _handleMacOSBuildLogic(params: { workspacePath?: string; projectPath?: string; scheme: string; configuration: string; derivedDataPath?: string; arch?: string; extraArgs?: string[]; preferXcodebuild?: boolean; }): Promise<ToolResponse> { log('info', `Starting macOS build for scheme ${params.scheme} (internal)`); return executeXcodeBuildCommand( { ...params, }, { platform: XcodePlatform.macOS, arch: params.arch, logPrefix: 'macOS Build', }, params.preferXcodebuild, 'build', ); }
- src/tools/build_macos.ts:255-286 (registration)Tool registration function that calls registerTool to add 'build_mac_proj' to the MCP server with schema and handler.export function registerMacOSBuildProjectTool(server: McpServer): void { type ProjectParams = { projectPath: string; scheme: string; configuration?: string; derivedDataPath?: string; arch?: string; extraArgs?: string[]; preferXcodebuild?: boolean; }; registerTool<ProjectParams>( server, 'build_mac_proj', 'Builds a macOS app using xcodebuild from a project file.', { projectPath: projectPathSchema, scheme: schemeSchema, configuration: configurationSchema, derivedDataPath: derivedDataPathSchema, arch: archSchema, extraArgs: extraArgsSchema, preferXcodebuild: preferXcodebuildSchema, }, async (params) => _handleMacOSBuildLogic({ ...params, configuration: params.configuration ?? 'Debug', preferXcodebuild: params.preferXcodebuild ?? false, }), ); }
- src/utils/register-tools.ts:199-203 (registration)Server-level registration entry for the 'build_mac_proj' tool, conditionally registered based on environment variable.{ register: registerMacOSBuildProjectTool, groups: [ToolGroup.MACOS_WORKFLOW], envVar: 'XCODEBUILDMCP_TOOL_MACOS_BUILD_PROJECT', },
- src/tools/common.ts:22-37 (schema)Zod input schemas used by the 'build_mac_proj' tool for parameter validation.export const workspacePathSchema = z.string().describe('Path to the .xcworkspace file (Required)'); export const projectPathSchema = z.string().describe('Path to the .xcodeproj file (Required)'); export const schemeSchema = z.string().describe('The scheme to use (Required)'); export const configurationSchema = z .string() .optional() .describe('Build configuration (Debug, Release, etc.)'); export const derivedDataPathSchema = z .string() .optional() .describe('Path where build products and other derived data will go'); export const extraArgsSchema = z .array(z.string()) .optional() .describe('Additional xcodebuild arguments'); export const simulatorNameSchema = z