XcodeBuildMCP
一个模型上下文协议(MCP)服务器和命令行工具,为代理在iOS和macOS项目开发中提供工具支持。
你可以用 XcodeBuildMCP MCP 做什么?
- 为模拟器构建 — 让您的AI使用指定的方案和项目路径,为特定模拟器编译iOS或macOS应用。
- 准备测试产品 — 让您的AI生成可移植的测试包,而无需运行测试,并针对所选模拟器。
- 运行已准备的测试 — 指示您的AI在指定模拟器上执行先前构建的测试产品。
- 列出可用工具 — 让您的AI展示其可调用的完整CLI命令集和MCP服务器功能。
- 检查更新 — 请求您的AI验证已安装的版本,并在需要时就地升级工具。
文档
一个模型上下文协议(MCP)服务器和命令行工具,为在 iOS 和 macOS 项目上工作时提供可供智能体使用的工具。
安装
MobileBuildMCP 作为一个单一包发布,提供两种模式:用于直接终端使用的 CLI 和用于 AI 编码智能体的 MCP 服务器。任一安装方式都会同时提供这两种模式。
选项 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 客户端 中找到。大多数客户端也可以通过 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
有关安装技能的更多信息,请参阅 智能体技能。
注意事项
- MobileBuildMCP 请求 xcodebuild 跳过宏验证,以避免在构建使用 Swift 宏的项目时出现错误。
- 设备工具需要在 Xcode 中配置代码签名。请参阅 设备代码签名。
隐私
MobileBuildMCP 仅使用 Sentry 进行内部运行时错误遥测。有关详情和退出说明,请参阅 隐私与遥测。
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 指南。
文档
- 安装: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 文件。