xcode-archive
Archive Xcode projects to create distributable packages for iOS apps by specifying project paths, schemes, and archive destinations.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectPath | Yes | Xcode 프로젝트 또는 워크스페이스 경로 | |
| scheme | Yes | 아카이브할 스킴 | |
| configuration | No | 빌드 구성 (예: Release) | |
| archivePath | Yes | 아카이브 파일(.xcarchive) 저장 경로 | |
| exportPath | No | 익스포트 경로 (IPA 파일 등) | |
| exportOptionsPlist | No | 익스포트 옵션 plist 파일 경로 |
Implementation Reference
- src/index.ts:309-367 (handler)The core handler function that constructs and executes xcodebuild archive and optional export commands using executeCommand utility, processes stdout/stderr, and returns formatted results or error responses.async ({ projectPath, scheme, configuration = "Release", archivePath, exportPath, exportOptionsPlist }) => { try { console.error(`Xcode 아카이브 생성: ${projectPath}, Scheme: ${scheme}`); let archiveCommand = `xcodebuild`; // 워크스페이스인지 프로젝트인지 확인 if (projectPath.endsWith(".xcworkspace")) { archiveCommand += ` -workspace "${projectPath}"`; } else { archiveCommand += ` -project "${projectPath}"`; } archiveCommand += ` -scheme "${scheme}" -configuration "${configuration}" archive -archivePath "${archivePath}"`; console.error(`실행할 아카이브 명령어: ${archiveCommand}`); // 아카이브 명령어 실행 try { const { stdout: archiveStdout, stderr: archiveStderr } = await executeCommand(archiveCommand); let resultText = "아카이브 결과:\n"; if (archiveStdout) resultText += `${archiveStdout}\n`; if (archiveStderr) resultText += `STDERR:\n${archiveStderr}\n`; // 익스포트 실행 (옵션이 제공된 경우) if (exportPath && exportOptionsPlist) { console.error(`Xcode 아카이브 익스포트: ${archivePath} -> ${exportPath}`); let exportCommand = `xcodebuild -exportArchive -archivePath "${archivePath}" -exportPath "${exportPath}" -exportOptionsPlist "${exportOptionsPlist}"`; console.error(`실행할 익스포트 명령어: ${exportCommand}`); // 익스포트 명령어 실행 const { stdout: exportStdout, stderr: exportStderr } = await executeCommand(exportCommand); resultText += "\n익스포트 결과:\n"; if (exportStdout) resultText += `${exportStdout}\n`; if (exportStderr) resultText += `STDERR:\n${exportStderr}\n`; } return { content: [{ type: "text", text: resultText }] }; } catch (error: any) { throw error; } } catch (error: any) { console.error(`Xcode 아카이브/익스포트 오류: ${error.message}`); return { content: [{ type: "text", text: `Xcode 아카이브/익스포트 중 오류가 발생했습니다:\n${error.message}\n${error.stderr || ''}` }], isError: true }; } }
- src/index.ts:301-307 (schema)Zod input schema defining parameters for the xcode-archive tool: project/workspace path, scheme, optional configuration, required archive path, optional export path and plist.{ projectPath: z.string().describe("Xcode 프로젝트 또는 워크스페이스 경로"), scheme: z.string().describe("아카이브할 스킴"), configuration: z.string().optional().describe("빌드 구성 (예: Release)"), archivePath: z.string().describe("아카이브 파일(.xcarchive) 저장 경로"), exportPath: z.string().optional().describe("익스포트 경로 (IPA 파일 등)"), exportOptionsPlist: z.string().optional().describe("익스포트 옵션 plist 파일 경로")
- src/index.ts:298-368 (registration)Registration of the 'xcode-archive' tool on the MCP server, specifying name, input schema, and inline handler function.// 6. 앱 아카이브 및 익스포트 도구 server.tool( "xcode-archive", { projectPath: z.string().describe("Xcode 프로젝트 또는 워크스페이스 경로"), scheme: z.string().describe("아카이브할 스킴"), configuration: z.string().optional().describe("빌드 구성 (예: Release)"), archivePath: z.string().describe("아카이브 파일(.xcarchive) 저장 경로"), exportPath: z.string().optional().describe("익스포트 경로 (IPA 파일 등)"), exportOptionsPlist: z.string().optional().describe("익스포트 옵션 plist 파일 경로") }, async ({ projectPath, scheme, configuration = "Release", archivePath, exportPath, exportOptionsPlist }) => { try { console.error(`Xcode 아카이브 생성: ${projectPath}, Scheme: ${scheme}`); let archiveCommand = `xcodebuild`; // 워크스페이스인지 프로젝트인지 확인 if (projectPath.endsWith(".xcworkspace")) { archiveCommand += ` -workspace "${projectPath}"`; } else { archiveCommand += ` -project "${projectPath}"`; } archiveCommand += ` -scheme "${scheme}" -configuration "${configuration}" archive -archivePath "${archivePath}"`; console.error(`실행할 아카이브 명령어: ${archiveCommand}`); // 아카이브 명령어 실행 try { const { stdout: archiveStdout, stderr: archiveStderr } = await executeCommand(archiveCommand); let resultText = "아카이브 결과:\n"; if (archiveStdout) resultText += `${archiveStdout}\n`; if (archiveStderr) resultText += `STDERR:\n${archiveStderr}\n`; // 익스포트 실행 (옵션이 제공된 경우) if (exportPath && exportOptionsPlist) { console.error(`Xcode 아카이브 익스포트: ${archivePath} -> ${exportPath}`); let exportCommand = `xcodebuild -exportArchive -archivePath "${archivePath}" -exportPath "${exportPath}" -exportOptionsPlist "${exportOptionsPlist}"`; console.error(`실행할 익스포트 명령어: ${exportCommand}`); // 익스포트 명령어 실행 const { stdout: exportStdout, stderr: exportStderr } = await executeCommand(exportCommand); resultText += "\n익스포트 결과:\n"; if (exportStdout) resultText += `${exportStdout}\n`; if (exportStderr) resultText += `STDERR:\n${exportStderr}\n`; } return { content: [{ type: "text", text: resultText }] }; } catch (error: any) { throw error; } } catch (error: any) { console.error(`Xcode 아카이브/익스포트 오류: ${error.message}`); return { content: [{ type: "text", text: `Xcode 아카이브/익스포트 중 오류가 발생했습니다:\n${error.message}\n${error.stderr || ''}` }], isError: true }; } } );