设备相关工具需要先在 Xcode 中配置好代码签名;使用 npm 方式需 Node.js 18+,Homebrew 方式则不需要;MCP 客户端可改用 npx -y mobilebuildmcp@latest mcp 免全局安装启动。
MobileBuildMCP
getsentryMIT活跃维护给 AI Agent 提供 iOS/macOS 项目构建工具的 MCP 服务器和命令行,让 Agent 能直接调用 xcodebuild 完成编译、打包等操作。
A Model Context Protocol (MCP) server and CLI that provides tools for agent use when working on iOS and macOS projects.
brew tap getsentry/xcodebuildmcp && brew install mobilebuildmcp
npm install -g mobilebuildmcp@latestREADME 未说明显存或 GPU 要求;需 macOS 14.5 及以上、Xcode 16.x 及以上,npm 安装还需 Node.js 18.x 及以上(Homebrew 安装不需要 Node.js)。
给 AI 编码代理提供 iOS/macOS 构建与测试工具的 MCP 服务器兼 CLI
给 AI Agent 提供 iOS/macOS 项目构建工具的 MCP 服务器和命令行,让 Agent 能直接调用 xcodebuild 完成编译、打包等操作。
核心能力
- 以 MCP 服务器形式向 Cursor、Claude Code 等客户端暴露工具
- 同一包提供 CLI,可直接在终端构建模拟器应用
- 支持 build-for-testing 生成可移植测试产物再单独运行
- 按工作区自动启动守护进程处理日志捕获与调试等有状态操作
- 可安装 MCP/CLI 两种 agent skill 引导代理使用工具
容易踩的坑
- v2.7.1Release v2.7.1最新正式版2026-09-23 · 2026-09-23 20:18 UTC
Release v2.7.1
Changed
- Renamed the project from XcodeBuildMCP to MobileBuildMCP. The npm package, CLI binaries (
mobilebuildmcp,mobilebuildmcp-doctor), Homebrew formula,MOBILEBUILDMCP_*environment variables,mobilebuildmcp://resource URIs,mobilebuildmcp.output.*structured output schema IDs, the.mobilebuildmcp/config.yamlproject config directory, and the~/Library/Developer/MobileBuildMCPstate directory all use the new name. Thexcodebuildmcp.comdomain is retired: structured output schema$idURLs now usehttps://raw.githubusercontent.com/getsentry/MobileBuildMCP/main/schemas/structured-output/, documentation links point at the docs sources in thegetsentry/xcodebuildmcp.comrepository, and the MCP registry name isio.github.getsentry/mobilebuildmcp. - Dictionary-shaped MCP inputs now use client-compatible wire representations (#491). The
envandtestRunnerEnvinputs on build, launch, test, and session-default tools are arrays of{ "key": "...", "value": "..." }entries, whilexcode_ide_call_tool.argumentsis a JSON object string. MobileBuildMCP converts these values to their existing internal objects only after MCP input validation.
Option A — Homebrew (no Node.js required)
Install:
brew tap getsentry/xcodebuildmcp brew install mobilebuildmcpMCP config:
"MobileBuildMCP": { "command": "mobilebuildmcp", "args": ["mcp"] }Option B — npm / npx (Node.js 18+)
Install:
npm install -g mobilebuildmcp@latestMCP config:
"MobileBuildMCP": { "command": "npx", "args": ["-y", "mobilebuildmcp@latest", "mcp"] }📦 NPM Package: https://www.npmjs.com/package/mobilebuildmcp/v/2.7.1
- Renamed the project from XcodeBuildMCP to MobileBuildMCP. The npm package, CLI binaries (
- v2.7.0Release v2.7.02026-07-23 · 2026-07-23 14:07 UTC
查看更新说明
Release v2.7.0
New! Xcode 27 Device Hub simulator support
UI automation tools now work fully with Xcode 27 simulators through Device Hub, including simulator window launching and keyboard controls. XcodeBuildMCP targets the selected simulator directly and uses locale-independent menu actions, while maintaining backward compatibility with Simulator.app on earlier Xcode versions.
Breaking
Build and test structured results now use schema version 3
Build and test tools now return
schemaVersion: "3"so prepared-test paths can be included in structured results. This affects MCP and CLI JSON consumers that validatexcodebuildmcp.output.build-resultorxcodebuildmcp.output.test-resultagainst version 2; consumers that only display or pass through tool results are unaffected.If no action is taken, validators pinned to version 2 will reject new build and test results. Update them to accept the version 3 schemas, while retaining version 2 support when older XcodeBuildMCP releases remain in use.
Before:
https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.build-result/2.schema.json https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.test-result/2.schema.jsonAfter:
https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.build-result/3.schema.json https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.test-result/3.schema.jsonUnspecified build configurations now follow the scheme
Build, test, clean, and app-path commands now honor the scheme action's configuration when
configurationis omitted instead of always using Debug. This fixes incorrect build settings for schemes that use another configuration, but scripts or agents that relied on the implicit Debug selection must now request it explicitly.Before:
xcodebuildmcp simulator build --scheme MyApp --project-path ./MyApp.xcodeprojAfter:
xcodebuildmcp simulator build \ --scheme MyApp \ --project-path ./MyApp.xcodeproj \ --configuration DebugFor MCP calls, set
configuration: "Debug"(#443, #460 by @hujunfeng).Added
- Added
xcodebuildmcp purgeto inspect and clean workspace storage managed by XcodeBuildMCP. It defaults to the current workspace, supports reports and dry runs, and requires explicit opt-in before removing DerivedData. - Added reusable
extraArgssession defaults for build and test commands, so commonxcodebuildflags and build settings can be configured once in project config or the active session. Per-call values override matching defaults, andextraArgs: []clears them for one call (#463 by @jknlsn). See config.example.yaml. - Added reusable test preparation to simulator, device, and macOS workflows. Build tools can produce a portable
.xctestproductspackage, and test tools can run it—or an advanced.xctestrunfile—without rebuilding while still producing a fresh.xcresult(#450). See CLI examples.
Fixed
- Fixed MCP clients waiting 10–17 seconds for tools to become available, which could make short health checks report a failed connection (#461, #468 by @Pitchfork-and-Torch).
- Fixed simulator commands selecting the wrong platform when a configured simulator is unavailable, especially for projects that support both iOS and visionOS. Setup now ignores unavailable simulators and records the selected platform.
- Fixed simulator and project discovery failures caused by malformed simulator data, projects w
- Added
- v2.6.2Release v2.6.22026-06-02 · 2026-06-02 20:38 UTC
查看更新说明
Release v2.6.2
Fixed
- Fixed
xcodebuildmcp upgradeso update checks use the latest GitHub release as the canonical target instead of stale package-manager metadata, ensuring multi-version upgrades show release notes for the actual target version.
Option A — Homebrew (no Node.js required)
Install:
brew tap getsentry/xcodebuildmcp brew install xcodebuildmcpMCP config:
"XcodeBuildMCP": { "command": "xcodebuildmcp", "args": ["mcp"] }Option B — npm / npx (Node.js 18+)
Install:
npm install -g xcodebuildmcp@latestMCP config:
"XcodeBuildMCP": { "command": "npx", "args": ["-y", "xcodebuildmcp@latest", "mcp"] }📦 NPM Package: https://www.npmjs.com/package/xcodebuildmcp/v/2.6.2
- Fixed
- v2.6.1Release v2.6.12026-06-02 · 2026-06-02 20:15 UTC
查看更新说明
Release v2.6.1
Fixed
Option A — Homebrew (no Node.js required)
Install:
brew tap getsentry/xcodebuildmcp brew install xcodebuildmcpMCP config:
"XcodeBuildMCP": { "command": "xcodebuildmcp", "args": ["mcp"] }Option B — npm / npx (Node.js 18+)
Install:
npm install -g xcodebuildmcp@latestMCP config:
"XcodeBuildMCP": { "command": "npx", "args": ["-y", "xcodebuildmcp@latest", "mcp"] }📦 NPM Package: https://www.npmjs.com/package/xcodebuildmcp/v/2.6.1
- v2.6.0Release v2.6.02026-06-01 · 2026-06-01 20:58 UTC
查看更新说明
Release v2.6.0
New! Runtime UI automation
UI automation now hands your agent reusable context instead of just confirming an action ran. After a tap, swipe, type, wait, or batch, the result includes a compact snapshot of the foreground UI with stable element references and a screen hash, so the agent can pick the next control directly rather than taking another screenshot or re-running a full snapshot. Candidate controls are ranked from real accessibility data, and suggested next steps point at concrete element references instead of guessed coordinates.
In a deterministic Weather-app task, this cut wall-clock time by roughly 70%, token usage by roughly 68%, and total tool calls by roughly 76%.
New tools and options:
wait_for_uipolls the UI until a predicate is satisfied — existence, enabled state, focus, visible text, or settled layout.batchperforms a sequence of element-reference actions in one call, so agents can run several same-screen taps without a snapshot round-trip between each step.dragperforms element-reference drag gestures for expanding sheets and scrolling real list regions without coordinate guessing.snapshot_uinow returns stable element references and a screen hash. PasssinceScreenHash(MCP) /--since-screen-hash(CLI) to skip a full snapshot when the screen has not changed.type_textacceptsreplaceExistingto replace a field's current value instead of appending to it.
See Tools Reference.
Added
- Added follow-up
nextStepsto machine-readable results so agents can act on suggested next actions without scraping prose. MCPstructuredContentcarries MCP tool-call hints and CLI--output jsoncarries shell command lines. Result schemas that includenextStepsmove to schema version 2; version 1 schema files remain available for existing validators. See Output Formats. - Added an opt-in
XCODEBUILDMCP_HEADLESS_LAUNCHmode for automated runs that should not steal macOS focus: macOS apps launch in the background, the Simulator window is not brought to the foreground (the simulator runtime still boots), and keyboard-shortcut actions fail fast with a clear foreground-focus requirement. See Environment Variables.
Fixed
- Fixed structured output so MCP clients that validate tool results can load every structured-output tool again. Published schemas are now self-contained, resolving validation failures such as
PointerToNowherein JSON Schema 2020-12 validators that do not re-base references across embedded schemas (#419, #423 by @Subharup-31). - Clarified
debug_attach_simPID attach arguments so the schema documents thatpidmust be used withoutbundleIdorwaitFor, and invalidpid+waitFor: truecalls now fail validation before LLDB is invoked (#417). - Fixed simulator-name session defaults in the CLI so a name-only default resolves to a simulator ID for tools that take an ID, resolves before simulator lifecycle operations, and does not add conflicting simulator arguments to tools that already accept a name.
- Fixed CLI JSON output so simulator-name resolution failures return the structured error envelope instead of plain stderr, and a launch failure during resolution is no longer reported as a macOS launch failure.
- Fixed
type_textso characters AXe cannot type, such as accented or other international characters, fail with a clear recoverable error before the field is focused instead of a generic typing failure. - Fixed CLI numeric array flags so comma-separated values such as
--key-codes 23,18,14are parsed as numbers instead of failing validation.
Various other internal improvements to stability, performan
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
A Model Context Protocol (MCP) server and CLI that provides tools for agent use when working on iOS and macOS projects.
Installation
MobileBuildMCP ships as a single package with two modes: a CLI for direct terminal use and an MCP server for AI coding agents. Either install method gives you both.
Option A — Homebrew
brew tap getsentry/xcodebuildmcp
brew install mobilebuildmcp
Option B — npm (Node.js 18+)
npm install -g mobilebuildmcp@latest
Verify either install:
mobilebuildmcp --help
Connect your MCP client
Drop-in config snippets for Cursor, Claude Code, Codex, can be found in the official docs page MCP Clients. Most clients can also run the MCP server on demand via npx -y mobilebuildmcp@latest mcp without a global install.
Requirements
- macOS 14.5 or later
- Xcode 16.x or later
- Node.js 18.x or later (not required for Homebrew installation)
Skills
MobileBuildMCP now includes two optional agent skills:
-
MCP Skill: Primes the agent with instructions on how to use the MCP server's tools (optional when using the MCP server).
-
CLI Skill: Primes the agent with instructions on how to navigate the CLI (recommended when using the CLI).
To install with a global binary:
mobilebuildmcp init
Or install directly via npx without a global install:
npx -y mobilebuildmcp@latest init
For further information on installing skills, see Agent Skills.
Notes
- MobileBuildMCP requests xcodebuild to skip macro validation to avoid errors when building projects that use Swift Macros.
- Device tools require code signing to be configured in Xcode. See Device Code Signing.
Privacy
MobileBuildMCP uses Sentry for internal runtime error telemetry only. For details and opt-out instructions, see Privacy & Telemetry.
CLI
MobileBuildMCP provides a unified command-line interface. The mcp subcommand starts the MCP server, while all other commands provide direct terminal access to tools:
# 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"
Check for updates and upgrade in place:
mobilebuildmcp upgrade --check
mobilebuildmcp upgrade --yes
The CLI uses a per-workspace daemon for stateful operations (log capture, debugging, etc.) that auto-starts when needed. See the CLI guide for full documentation.
Documentation
- Installation: https://github.com/getsentry/xcodebuildmcp.com/blob/main/app/docs/_content/installation.mdx
- Setup: https://github.com/getsentry/xcodebuildmcp.com/blob/main/app/docs/_content/setup.mdx
- MCP clients: https://github.com/getsentry/xcodebuildmcp.com/blob/main/app/docs/_content/clients.mdx
- CLI usage: https://github.com/getsentry/xcodebuildmcp.com/blob/main/app/docs/_content/cli.mdx
- Configuration and options: https://github.com/getsentry/xcodebuildmcp.com/blob/main/app/docs/_content/configuration.mdx
- Tools reference: https://github.com/getsentry/xcodebuildmcp.com/blob/main/app/docs/_content/tools.mdx
- Troubleshooting: https://github.com/getsentry/xcodebuildmcp.com/blob/main/app/docs/_content/troubleshooting.mdx
- Privacy: https://github.com/getsentry/xcodebuildmcp.com/blob/main/app/docs/_content/privacy.mdx
- Skills: https://github.com/getsentry/xcodebuildmcp.com/blob/main/app/docs/_content/skills.mdx
- Contributing: https://github.com/getsentry/xcodebuildmcp.com/blob/main/app/docs/_content/contributing.mdx
Licence
This project is licensed under the MIT License - see the LICENSE file for details. For third-party licensing notices see the THIRD_PARTY_LICENSES file for details. For npm package attributions see the THIRD_PARTY_PACKAGE_LICENSES file for details.