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.

v2.7.1发布于 2026-09-23 20:18 UTC6,557star +9 / 7 天328fork同步于 2026-11-10 05:33 UTC

怎么上手

由 README 提炼,执行前请确认
brew tap getsentry/xcodebuildmcp && brew install mobilebuildmcp
npm install -g mobilebuildmcp@latest
硬件要求按 README 说明

README 未说明显存或 GPU 要求;需 macOS 14.5 及以上、Xcode 16.x 及以上,npm 安装还需 Node.js 18.x 及以上(Homebrew 安装不需要 Node.js)。

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

给 AI 编码代理提供 iOS/macOS 构建与测试工具的 MCP 服务器兼 CLI

给 AI Agent 提供 iOS/macOS 项目构建工具的 MCP 服务器和命令行,让 Agent 能直接调用 xcodebuild 完成编译、打包等操作。

核心能力

  • 以 MCP 服务器形式向 Cursor、Claude Code 等客户端暴露工具
  • 同一包提供 CLI,可直接在终端构建模拟器应用
  • 支持 build-for-testing 生成可移植测试产物再单独运行
  • 按工作区自动启动守护进程处理日志捕获与调试等有状态操作
  • 可安装 MCP/CLI 两种 agent skill 引导代理使用工具

容易踩的坑

设备相关工具需要先在 Xcode 中配置好代码签名;使用 npm 方式需 Node.js 18+,Homebrew 方式则不需要;MCP 客户端可改用 npx -y mobilebuildmcp@latest mcp 免全局安装启动。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本v2.7.1
  1. 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.yaml project config directory, and the ~/Library/Developer/MobileBuildMCP state directory all use the new name. The xcodebuildmcp.com domain is retired: structured output schema $id URLs now use https://raw.githubusercontent.com/getsentry/MobileBuildMCP/main/schemas/structured-output/, documentation links point at the docs sources in the getsentry/xcodebuildmcp.com repository, and the MCP registry name is io.github.getsentry/mobilebuildmcp.
    • Dictionary-shaped MCP inputs now use client-compatible wire representations (#491). The env and testRunnerEnv inputs on build, launch, test, and session-default tools are arrays of { "key": "...", "value": "..." } entries, while xcode_ide_call_tool.arguments is 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 mobilebuildmcp
    

    MCP config:

    "MobileBuildMCP": {
      "command": "mobilebuildmcp",
      "args": ["mcp"]
    }
    

    Option B — npm / npx (Node.js 18+)

    Install:

    npm install -g mobilebuildmcp@latest
    

    MCP config:

    "MobileBuildMCP": {
      "command": "npx",
      "args": ["-y", "mobilebuildmcp@latest", "mcp"]
    }
    

    📦 NPM Package: https://www.npmjs.com/package/mobilebuildmcp/v/2.7.1

  2. 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 validate xcodebuildmcp.output.build-result or xcodebuildmcp.output.test-result against 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.json
    

    After:

    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.json
    
    Unspecified build configurations now follow the scheme

    Build, test, clean, and app-path commands now honor the scheme action's configuration when configuration is 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.xcodeproj
    

    After:

    xcodebuildmcp simulator build \
      --scheme MyApp \
      --project-path ./MyApp.xcodeproj \
      --configuration Debug
    

    For MCP calls, set configuration: "Debug" (#443, #460 by @hujunfeng).

    Added

    • Added xcodebuildmcp purge to 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 extraArgs session defaults for build and test commands, so common xcodebuild flags and build settings can be configured once in project config or the active session. Per-call values override matching defaults, and extraArgs: [] 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 .xctestproducts package, and test tools can run it—or an advanced .xctestrun file—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
  3. v2.6.2Release v2.6.22026-06-02 · 2026-06-02 20:38 UTC
    查看更新说明

    Release v2.6.2

    Fixed

    • Fixed xcodebuildmcp upgrade so 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 xcodebuildmcp
    

    MCP config:

    "XcodeBuildMCP": {
      "command": "xcodebuildmcp",
      "args": ["mcp"]
    }
    

    Option B — npm / npx (Node.js 18+)

    Install:

    npm install -g xcodebuildmcp@latest
    

    MCP config:

    "XcodeBuildMCP": {
      "command": "npx",
      "args": ["-y", "xcodebuildmcp@latest", "mcp"]
    }
    

    📦 NPM Package: https://www.npmjs.com/package/xcodebuildmcp/v/2.6.2

  4. v2.6.1Release v2.6.12026-06-02 · 2026-06-02 20:15 UTC
    查看更新说明

    Release v2.6.1

    Fixed

    • Fixed tab bar item discovery so agents can switch UITabBar items (#439, #441).

    Option A — Homebrew (no Node.js required)

    Install:

    brew tap getsentry/xcodebuildmcp
    brew install xcodebuildmcp
    

    MCP config:

    "XcodeBuildMCP": {
      "command": "xcodebuildmcp",
      "args": ["mcp"]
    }
    

    Option B — npm / npx (Node.js 18+)

    Install:

    npm install -g xcodebuildmcp@latest
    

    MCP config:

    "XcodeBuildMCP": {
      "command": "npx",
      "args": ["-y", "xcodebuildmcp@latest", "mcp"]
    }
    

    📦 NPM Package: https://www.npmjs.com/package/xcodebuildmcp/v/2.6.1

  5. 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_ui polls the UI until a predicate is satisfied — existence, enabled state, focus, visible text, or settled layout.
    • batch performs 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.
    • drag performs element-reference drag gestures for expanding sheets and scrolling real list regions without coordinate guessing.
    • snapshot_ui now returns stable element references and a screen hash. Pass sinceScreenHash (MCP) / --since-screen-hash (CLI) to skip a full snapshot when the screen has not changed.
    • type_text accepts replaceExisting to replace a field's current value instead of appending to it.

    See Tools Reference.

    Added

    • Added follow-up nextSteps to machine-readable results so agents can act on suggested next actions without scraping prose. MCP structuredContent carries MCP tool-call hints and CLI --output json carries shell command lines. Result schemas that include nextSteps move to schema version 2; version 1 schema files remain available for existing validators. See Output Formats.
    • Added an opt-in XCODEBUILDMCP_HEADLESS_LAUNCH mode 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 PointerToNowhere in JSON Schema 2020-12 validators that do not re-base references across embedded schemas (#419, #423 by @Subharup-31).
    • Clarified debug_attach_sim PID attach arguments so the schema documents that pid must be used without bundleId or waitFor, and invalid pid + waitFor: true calls 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_text so 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,14 are parsed as numbers instead of failing validation.

    Various other internal improvements to stability, performan

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    A Model Context Protocol (MCP) server and CLI that provides tools for agent use when working on iOS and macOS projects.

    CI npm version License: MIT Node.js Xcode 16 macOS MCP Ask DeepWiki AgentAudit Security pkg.pr.new

    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

    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.