关于 XcodeBuildMCP
XcodeBuildMCP 是面向 iOS 和 macOS 项目的 MCP 服务与命令行工具,为 Agent 提供 Xcode 项目、模拟器及应用相关的工具。它可通过 Homebrew 或 npm 安装,同时支持直接在终端中使用。
主要功能
- 01提供 Xcode 项目管理工具
- 02提供模拟器管理工具
- 03提供应用实用工具
- 04同时支持 MCP 服务与命令行两种模式
- 05内置可选的 Agent Skills
适用场景
- 01让编码 Agent 构建和管理 iOS 或 macOS 项目
- 02在终端中列出并执行 Xcode 相关工具
- 03在模拟器中辅助调试应用
MCP 相关
该项目作为 MCP 服务运行,通过 mobilebuildmcp mcp 命令启动,向 MCP 客户端暴露 Xcode 构建与模拟器相关的工具。
配置
本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。
npx -y xcodebuildmcpINCREMENTAL_BUILDS_ENABLEDEnable experimental xcodemake incremental builds (true/false or 1/0).XCODEBUILDMCP_ENABLED_WORKFLOWSComma-separated list of workflows to load at startup (e.g., 'simulator,device,project-discovery').XCODEBUILDMCP_SENTRY_DISABLEDDisable Sentry error reporting (preferred flag).XCODEBUILDMCP_DEBUGEnable verbose debug logging from the server.本地服务需要在你的电脑上安装运行环境(如 Node.js 18+)。各客户端的配置文件位置不同,请参考客户端文档。
工具
24收录的工具列表 · 更新于 2 周前
此工具无需参数。
详细介绍
一个模型上下文协议(MCP)服务和 CLI,为 Agent 在处理 iOS 和 macOS 项目时提供工具。
安装
MobileBuildMCP 以单个软件包的形式发布,提供两种模式:可直接在终端使用的 CLI,以及面向 AI 编码 Agent 的 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 Clients 中找到。大多数客户端也可以通过 npx -y mobilebuildmcp@latest mcp 按需运行 MCP 服务,无需全局安装。
要求
- macOS 14.5 或更高版本
- Xcode 16.x 或更高版本
- Node.js 18.x 或更高版本(通过 Homebrew 安装时不需要)
技能
MobileBuildMCP 现已包含两个可选的 Agent 技能:
-
MCP 技能:向 Agent 提供如何使用 MCP 服务工具的指引(使用 MCP 服务时可选)。
-
CLI 技能:向 Agent 提供如何使用 CLI 的指引(使用 CLI 时建议安装)。
使用全局二进制文件安装:
mobilebuildmcp init
或者直接通过 npx 安装,无需全局安装:
npx -y mobilebuildmcp@latest init
如需了解有关安装技能的更多信息,请参阅 Agent Skills。
备注
- MobileBuildMCP 会请求 xcodebuild 跳过宏验证,以避免构建使用 Swift 宏的项目时发生错误。
- 设备工具需要在 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 文件。
评论
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。