/ Каталог / Песочница / XcodeBuild
● Официальный getsentry ⚡ Сразу

XcodeBuild

автор getsentry · getsentry/XcodeBuildMCP

Close the loop on iOS/macOS AI coding — build, test, run on simulator, capture logs and screenshots, all from chat.

XcodeBuildMCP (by Sentry, ex-getsentry org member Cameron) wraps xcodebuild, xcrun simctl, and the simulator runtime. Lets an agent compile a project, run tests, boot a simulator, install the app, drive it, and read back logs or screenshots — the missing feedback loop for AI-authored iOS code.

Зачем использовать

Ключевые функции

Живое демо

Как выглядит на практике

xcodebuild.replay ▶ готово
0/0

Установка

Выберите клиент

~/Library/Application Support/Claude/claude_desktop_config.json  · Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "xcodebuild": {
      "command": "npx",
      "args": [
        "-y",
        "xcodebuildmcp@latest"
      ]
    }
  }
}

Откройте Claude Desktop → Settings → Developer → Edit Config. Перезапустите после сохранения.

~/.cursor/mcp.json · .cursor/mcp.json
{
  "mcpServers": {
    "xcodebuild": {
      "command": "npx",
      "args": [
        "-y",
        "xcodebuildmcp@latest"
      ]
    }
  }
}

Cursor использует ту же схему mcpServers, что и Claude Desktop. Конфиг проекта приоритетнее глобального.

VS Code → Cline → MCP Servers → Edit
{
  "mcpServers": {
    "xcodebuild": {
      "command": "npx",
      "args": [
        "-y",
        "xcodebuildmcp@latest"
      ]
    }
  }
}

Щёлкните значок MCP Servers на боковой панели Cline, затем "Edit Configuration".

~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "xcodebuild": {
      "command": "npx",
      "args": [
        "-y",
        "xcodebuildmcp@latest"
      ]
    }
  }
}

Тот же формат, что и Claude Desktop. Перезапустите Windsurf для применения.

~/.continue/config.json
{
  "mcpServers": [
    {
      "name": "xcodebuild",
      "command": "npx",
      "args": [
        "-y",
        "xcodebuildmcp@latest"
      ]
    }
  ]
}

Continue использует массив объектов серверов, а не map.

~/.config/zed/settings.json
{
  "context_servers": {
    "xcodebuild": {
      "command": {
        "path": "npx",
        "args": [
          "-y",
          "xcodebuildmcp@latest"
        ]
      }
    }
  }
}

Добавьте в context_servers. Zed перезагружается автоматически.

claude mcp add xcodebuild -- npx -y xcodebuildmcp@latest

Однострочная команда. Проверить: claude mcp list. Удалить: claude mcp remove.

Сценарии использования

Реальные сценарии: XcodeBuild

Verify AI-generated iOS code actually builds and runs on a simulator

👤 iOS devs using Claude for feature work, SwiftUI prototyping ⏱ ~15 min intermediate

Когда использовать: Claude just wrote or edited SwiftUI views. Before saying 'done', you want to compile, run on simulator, and screenshot.

Предварительные требования
  • Xcode installed — Xcode 15+ from the Mac App Store; confirm with xcodebuild -version
  • A bootable simulator — Xcode → Settings → Platforms → iOS Simulator downloaded
Поток
  1. Discover the project and build
    Find the Xcode project in /Users/me/Projects/MyApp. Build scheme 'MyApp' for iOS Simulator destination 'iPhone 16'. Report any errors or warnings.✓ Скопировано
    → Build succeeds, or specific errors with file:line
  2. Boot simulator, install, launch
    Boot an iPhone 16 simulator if not already booted. Install the built app and launch it. Take a screenshot after 3 seconds.✓ Скопировано
    → App running; screenshot captured
  3. Drive the feature
    Tap the 'Sign Up' button, type '[email protected]' in the email field, tap Submit. Screenshot after each step.✓ Скопировано
    → Sequence of screenshots showing the flow; or a clear tap-failed error

Итог: Before/after screenshots that prove the feature works, committed alongside the code.

Подводные камни
  • Tapping by coordinate is fragile across device sizes — Prefer accessibility-label based taps when the MCP supports them; use coordinates only as fallback
  • Simulator build uses a different architecture than a real device — For architecture-sensitive code, also build for a physical device at least once before merging
Сочетать с: filesystem · github

Run your Xcode unit and UI tests from chat and triage failures

👤 iOS devs who want fast test feedback without switching to Xcode ⏱ ~10 min beginner

Когда использовать: You've made a change, want to run ⌘U equivalent, and have Claude parse failures.

Поток
  1. Run tests
    Run all tests for scheme 'MyApp' on destination 'iPhone 16'. Show me any failures with file, line, and expectation.✓ Скопировано
    → Pass count plus failure list with locations
  2. Focus on one failure
    For the first failure, read the source file and tell me whether the test is wrong or the code is wrong. Be specific.✓ Скопировано
    → Clear diagnosis, not 'it could be either'
  3. Fix and rerun
    Apply the fix. Re-run only the failing test to confirm green.✓ Скопировано
    → Green rerun

Итог: Tests back to green with a focused rerun, not a whole-suite rerun.

Подводные камни
  • xcodebuild test is slow on cold caches — Use -only-testing: flag to narrow; the MCP exposes this via test-by-identifier
Сочетать с: github

Diagnose a cryptic Xcode build error

👤 iOS devs who hit a 'linker error / missing framework / signing' wall ⏱ ~20 min intermediate

Когда использовать: xcodebuild fails and the error output is 4000 lines of noise.

Поток
  1. Build and capture the raw failure
    Build scheme 'MyApp' and return only the lines containing 'error:' or 'warning:', plus 3 lines of context around each.✓ Скопировано
    → Focused error list without noise
  2. Explain the first error
    Explain the first error in human terms. What's Xcode actually complaining about, and what are the top 3 causes?✓ Скопировано
    → Plain-English diagnosis with likely causes
  3. Apply fix and rebuild
    Apply the most likely fix (check Info.plist/entitlements/Package.swift as needed), rebuild, and confirm the error is gone.✓ Скопировано
    → Clean build

Итог: Unstuck from the build wall without a 2-hour Stack Overflow rabbit hole.

Подводные камни
  • Some errors are DerivedData staleness — When all else fails: clean DerivedData via the MCP's clean tool, then rebuild
Сочетать с: filesystem

Capture an app crash on simulator and find the root cause

👤 iOS devs hunting a reproducible crash ⏱ ~20 min advanced

Когда использовать: Your app crashes on a specific flow in simulator, and you want Claude to read the crash log.

Поток
  1. Reproduce with log capture
    Launch MyApp on iPhone 16 simulator. Start log capture. Perform this flow: open Settings, tap 'Clear Cache'. Stop log capture when the app dies.✓ Скопировано
    → Crash reproduced, logs saved
  2. Parse the crash
    Find the crash in the captured logs. Symbolicate if needed. Tell me the failing thread, the top 5 stack frames, and the likely line in our code.✓ Скопировано
    → Symbolicated stack trace pointing at a specific source file
  3. Propose the fix
    Based on the stack trace and the surrounding code, what's the minimum change to fix it? Apply it.✓ Скопировано
    → Targeted fix, not a big refactor

Итог: A fixed crash with symbolicated evidence you can paste into the PR.

Подводные камни
  • Release-config crashes don't symbolicate without dSYMs — Use Debug configuration for repro; separately test Release to confirm fix
Сочетать с: sentry · github

Комбинации

Сочетайте с другими MCP — эффект x10

xcodebuild + filesystem

Edit Swift → build → screenshot → iterate, entirely in one chat

Edit ContentView.swift to add a dark-mode toggle. Build MyApp for iPhone 16, run it, take a screenshot in both light and dark mode.✓ Скопировано
xcodebuild + github

Fix an issue, verify on simulator, open PR with a screenshot

Issue #42 says the login button is misaligned in landscape. Reproduce on iPad simulator, fix the SwiftUI layout, attach before/after screenshots to the PR.✓ Скопировано
xcodebuild + sentry

Reproduce a Sentry-reported crash on simulator with identical conditions

Sentry crash iOS-113 happened on iOS 18.1 with user locale fr-FR. Boot a matching simulator, reproduce, and fix.✓ Скопировано

Инструменты

Что предоставляет этот MCP

ИнструментВходные данныеКогда вызыватьСтоимость
discover_projects directory: str Find what to build in a repo without path-typing free
build_project project: str, scheme: str, destination: str, configuration?: 'Debug'|'Release' Build an .xcodeproj or .xcworkspace for a destination free
build_spm_package path: str Build a Swift Package (no .xcodeproj) free
test_project project, scheme, destination, only_testing?: str[] Run the test suite; use only_testing to narrow free
list_simulators none See what simulators exist and which are booted free
boot_simulator simulator_id or name: str Bring a simulator up before installing apps free
install_app simulator_id: str, app_path: str Install the built .app on a booted simulator free
launch_app simulator_id: str, bundle_id: str Start the installed app free
tap_at / type_text / send_url simulator params Drive the UI free
screenshot simulator_id: str, path?: str Capture visual state free
start_log_capture / stop_log_capture simulator_id Capture console/system logs for a session free
clean project, scheme? Blow away DerivedData for that project when builds go weird free

Стоимость и лимиты

Во что обходится

Квота API
None — everything runs locally via xcodebuild/simctl
Токенов на вызов
Build logs can be huge. Prefer filtering to errors/warnings rather than full log dumps
Деньги
Free (requires a Mac with Xcode, which is its own cost)
Совет
Run incremental builds, not clean builds, by default. Only clean when DerivedData gets weird.

Безопасность

Права, секреты, радиус поражения

Хранение учётных данных: No credentials at the MCP layer. Code signing credentials live in your Mac's Keychain as usual.
Исходящий трафик: None from the MCP. xcodebuild may fetch dependencies (SPM, CocoaPods) from their usual sources.
Никогда не давайте: don't let the agent alter codesign identities or provisioning profiles without confirmation

Устранение неполадок

Частые ошибки и исправления

xcodebuild: command not found

Xcode Command Line Tools missing or not selected. Run xcode-select --install then sudo xcode-select -s /Applications/Xcode.app/Contents/Developer.

Проверить: xcodebuild -version
No such destination 'iPhone 16'

Simulator with that name isn't downloaded for the active Xcode. Open Xcode → Settings → Platforms → download iOS runtime. Or use list_simulators and pick an existing one.

Проверить: xcrun simctl list devices
Build succeeds but app won't launch — 'NSException'

Check app logs via start_log_capture right before launching. Often Info.plist missing key, or entitlements mismatch.

Tests hang on a SwiftUI preview

SwiftUI previews can deadlock xcodebuild test in rare cases. Disable preview helpers in test schemes, or run with -disable-concurrent-testing.

Альтернативы

XcodeBuild в сравнении

АльтернативаКогда использоватьКомпромисс
Direct shell MCP running xcodebuildYou want max flexibility and accept the security tradeoff of a raw shell MCPNo ergonomics; Claude has to know every xcodebuild flag
JetBrains MCP (AppCode is EOL)You're in JetBrains IDE — doesn't apply to iOS anymoreNot an iOS alternative today
Fastlane via shellYou need signed builds and TestFlight uploads, not just simulator verificationMuch heavier; out of scope for inner-loop dev

Ещё

Ресурсы

📖 Читать официальный README на GitHub

🐙 Открытые задачи

🔍 Все 400+ MCP-серверов и Skills