XcodeBuildMCP
一個模型上下文協定(MCP)伺服器與命令列工具,提供代理在處理 iOS 與 macOS 專案時所需的工具。
你可以用 XcodeBuildMCP MCP 做什麼?
- Build for simulator — 要求您的AI使用指定的scheme和项目路径,为特定模拟器编译iOS或macOS应用。
- Prepare test products — 让您的AI生成可移植的测试包,而无需运行测试,并针对所选模拟器。
- Run prepared tests — 指示您的AI在指定模拟器上执行先前构建的测试产品。
- List available tools — 要求您的AI展示其可调用的完整CLI命令集和MCP服务器能力。
- Check for updates — 请求您的AI验证已安装的版本,并在需要时就地升级该工具。
文件
一個模型上下文協定(MCP)伺服器與 CLI,提供工具供代理程式在處理 iOS 與 macOS 專案時使用。
安裝
MobileBuildMCP 以單一套件提供兩種模式:CLI 供直接於終端機使用,以及 MCP 伺服器供 AI 編碼代理程式使用。任一安裝方式皆可同時取得兩者。
選項 A — Homebrew
brew tap getsentry/xcodebuildmcp
brew install mobilebuildmcp
選項 B — npm(Node.js 18+)
npm install -g mobilebuildmcp@latest
驗證任一安裝:
mobilebuildmcp --help
連接您的 MCP 用戶端
適用於 Cursor、Claude Code、Codex 的即插即用設定片段,可在官方文件頁面 MCP Clients 中找到。大多數用戶端也可以透過 npx -y mobilebuildmcp@latest mcp 隨需執行 MCP 伺服器,無需全域安裝。
需求
- macOS 14.5 或更新版本
- Xcode 16.x 或更新版本
- Node.js 18.x 或更新版本(Homebrew 安裝不需此項)
技能
MobileBuildMCP 現已包含兩個選用的代理程式技能:
-
MCP 技能:為代理程式提供如何使用 MCP 伺服器工具的指示(使用 MCP 伺服器時為選用)。
-
CLI 技能:為代理程式提供如何操作 CLI 的指示(使用 CLI 時建議安裝)。
若要透過全域二進位檔安裝:
mobilebuildmcp init
或直接透過 npx 安裝,無需全域安裝:
npx -y mobilebuildmcp@latest init
有關安裝技能的進一步資訊,請參閱 Agent Skills。
備註
- MobileBuildMCP 會要求 xcodebuild 跳過巨集驗證,以避免在建立使用 Swift Macros 的專案時發生錯誤。
- 裝置工具需要在 Xcode 中設定代碼簽署。請參閱 Device Code Signing。
隱私權
MobileBuildMCP 僅使用 Sentry 進行內部執行時期錯誤遙測。如需詳細資訊與退出說明,請參閱 Privacy & Telemetry。
CLI
MobileBuildMCP 提供統一的命令列介面。mcp 子命令會啟動 MCP 伺服器,而所有其他命令則提供對工具的直接終端機存取:
# Install globally
npm install -g mobilebuildmcp@latest
# Start the MCP server (for MCP clients)
mobilebuildmcp mcp
# List available tools
mobilebuildmcp tools
# Build for simulator
mobilebuildmcp simulator build --scheme MyApp --project-path ./MyApp.xcodeproj
# Prepare portable test products without running tests
mobilebuildmcp simulator build --scheme MyApp --project-path ./MyApp.xcodeproj --simulator-name "iPhone 17" --build-for-testing --test-products-path ./MyApp.xctestproducts
# Run previously prepared test products
mobilebuildmcp simulator test --test-products-path ./MyApp.xctestproducts --simulator-name "iPhone 17"
檢查更新並就地升級:
mobilebuildmcp upgrade --check
mobilebuildmcp upgrade --yes
CLI 使用每個工作區的守護程式來進行有狀態的操作(日誌擷取、除錯等),該守護程式會在需要時自動啟動。完整文件請參閱 CLI guide。
文件
- 安裝:https://github.com/getsentry/xcodebuildmcp.com/blob/main/app/docs/_content/installation.mdx
- 設定:https://github.com/getsentry/xcodebuildmcp.com/blob/main/app/docs/_content/setup.mdx
- MCP 用戶端:https://github.com/getsentry/xcodebuildmcp.com/blob/main/app/docs/_content/clients.mdx
- CLI 使用方式:https://github.com/getsentry/xcodebuildmcp.com/blob/main/app/docs/_content/cli.mdx
- 設定與選項:https://github.com/getsentry/xcodebuildmcp.com/blob/main/app/docs/_content/configuration.mdx
- 工具參考:https://github.com/getsentry/xcodebuildmcp.com/blob/main/app/docs/_content/tools.mdx
- 疑難排解:https://github.com/getsentry/xcodebuildmcp.com/blob/main/app/docs/_content/troubleshooting.mdx
- 隱私權:https://github.com/getsentry/xcodebuildmcp.com/blob/main/app/docs/_content/privacy.mdx
- 技能:https://github.com/getsentry/xcodebuildmcp.com/blob/main/app/docs/_content/skills.mdx
- 貢獻:https://github.com/getsentry/xcodebuildmcp.com/blob/main/app/docs/_content/contributing.mdx
授權
本專案採用 MIT 授權條款 - 詳細資訊請參閱 LICENSE 檔案。 第三方授權聲明請參閱 THIRD_PARTY_LICENSES 檔案。 npm 套件歸屬請參閱 THIRD_PARTY_PACKAGE_LICENSES 檔案。