xcode-autopilot
Builds and fixes Xcode projects end-to-end: runs xcodebuild (or Tuist install/generate), returns structured compile errors enriched with enclosing scope, related definitions and call sites, applies line-verified patches with backup and automatic rollback when errors increase, resolves SPM dependencies, cleans caches (DerivedData, ModuleCache, SPM, Index), lists schemes, and can build, launch in a simulator and capture a screenshot for visual verification.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@xcode-autopilot build my app and fix any compile errors"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
XcodeAutoPilot
An MCP server that gives Claude Code the ability to build, analyze, and fix Xcode errors — autonomously.
Claude Code handles all reasoning. XcodeAutoPilot handles build execution, context extraction, and safe file patching.
How It Works
Claude Code
↕ MCP (stdio)
XcodeAutoPilot
↕ child_process
xcodebuild / tuist
↕
Your Xcode Projectautopilot_buildrunsxcodebuildand returns structured errors with smart source contextClaude Code analyzes the errors — seeing the enclosing function scope, related definitions, and call sites
autopilot_apply_fixesapplies the fixes with line-level verification and automatic backupRepeat until 0 errors
If a fix makes things worse, it automatically rolls back.
Related MCP server: MCP Xcode
Requirements
Minimum | |
macOS | 13.0 Ventura |
Xcode | 14.0 |
Node.js | 18.0 |
Claude Code | latest |
Installation
Option 1 — Homebrew (recommended)
brew tap leejh08/xcode-autopilot
brew install xcode-autopilotOption 2 — Clone
git clone https://github.com/leejh08/XcodeAutoPilot.git
cd XcodeAutoPilot
npm install && npm run buildVerify Xcode CLI tools are installed:
xcodebuild -version
# If missing: xcode-select --installRegister with Claude Code
Add to .mcp.json in your project root (or ~/Library/Application Support/Claude/claude_desktop_config.json):
Homebrew install:
{
"mcpServers": {
"xcode-autopilot": {
"command": "xcode-autopilot"
}
}
}Clone install:
{
"mcpServers": {
"xcode-autopilot": {
"command": "node",
"args": ["/absolute/path/to/XcodeAutoPilot/dist/index.js"]
}
}
}Restart Claude Code after saving.
MCP Tools
Tool | Description |
| Run xcodebuild — returns structured errors with smart context (enclosing scope + related definitions and call sites) |
| Apply fixes safely — line-verified, backed up before patching, auto-rollback if errors increase |
| Build and run the app in a simulator, capture a screenshot, and return it as an image for AI visual analysis |
| Build Tuist projects end-to-end — auto-detects version and runs |
| Resolve SPM dependencies and return structured errors |
| Selectively clear DerivedData, ModuleCache, SPM cache, or Index store |
| List all available build schemes |
| Run |
| Return fix session history |
XAP Keyword Triggers
Install the XAP hook to trigger workflows with a single word in any prompt:
bash scripts/install-xap.sh
# Restart Claude CodeKeyword | Alias | What it does |
|
| Build → analyze → fix loop (up to 5 iterations) |
|
| Focused error analysis + fix |
|
| Cache clean → verify build |
|
| SPM resolve → cache clean → verify build |
|
| Build → launch in simulator → screenshot → AI visual verification |
|
| Run tests → analyze failures → fix loop (up to 5 iterations) |
License
MIT
Available Tools
10 toolsautopilot_apply_fixesA
Apply a list of fixes to source files safely. Each fix specifies a file path, line number, the original line content (for verification), and the replacement. Files are backed up before modification and scope-checked against the project path.
Inputs: fixes (required), project_path (required).
autopilot_buildA
Run xcodebuild and return structured errors and warnings WITH source code context (±50 lines around each error). Use this to get all the information needed to generate fixes. After calling this tool, analyze the errors and call autopilot_apply_fixes with your fixes.
Inputs: scheme (required), project_path (required), destination, configuration, +1 more.
autopilot_cache_cleanA
Selectively clear Xcode caches that xcodebuild clean does not cover. Use 'project' to remove DerivedData for this project, 'module_cache' for ModuleCache.noindex, 'spm' for SPM fetch cache and SourcePackages, 'index' for the Index store, or 'all' for everything.
Inputs: scope (required), project_path (required).
autopilot_cleanA
Run xcodebuild clean to remove derived data for the project.
Inputs: scheme (required), project_path (required).
autopilot_historyA
Return the history of all autopilot_apply_fixes sessions in the current server session.
Inputs: no named parameters.
autopilot_list_schemesB
List all available build schemes in the Xcode project.
Inputs: project_path (required).
autopilot_resolve_spmA
Run xcodebuild -resolvePackageDependencies and return structured SPM errors (version conflicts, clone failures, Swift version mismatches). Use this when a build fails due to missing or unresolvable packages.
Inputs: scheme (required), project_path (required).
autopilot_screenshotB
Build the app, run it in an iOS simulator, and capture a screenshot. Returns the screenshot as an image so Claude can visually inspect the UI. Also saves the PNG to /.xap/screenshots/ and opens it in macOS Preview.
Inputs: scheme (required), bundle_id (required), project_path (required), os_version, +4 more.
autopilot_testA
Run xcodebuild test and return structured test failures with source context. Each failure includes the failing test method source and the related implementation code. Use this to detect failing tests, then call autopilot_apply_fixes to fix them, and repeat.
Inputs: scheme (required), project_path (required), test_plan, destination, +2 more.
autopilot_tuist_buildA
Build a Tuist-managed Xcode project. Automatically detects Tuist version and runs the correct commands: v4+ uses 'tuist install' + 'tuist generate', v3.x uses 'tuist fetch' + 'tuist generate'. Then runs xcodebuild and returns structured errors with source context, same format as autopilot_build. Use skip_install or skip_generate to skip steps already completed.
Inputs: scheme (required), project_directory (required), destination, skip_install, +4 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 10 tools
Most tools target a distinct action (build, test, screenshot, list_schemes, resolve_spm, apply_fixes) and descriptions make the intended call sequence explicit. The main overlap is autopilot_clean vs autopilot_cache_clean, since cache_clean with 'project' removes the same DerivedData that clean does. autopilot_build vs autopilot_tuist_build is also a near-duplicate, though the 'Tuist-managed' qualifier mitigates confusion.
Every tool uses the same autopilot_ prefix with a snake_case verb_noun or verb_noun_noun pattern (autopilot_clean, autopilot_apply_fixes, autopilot_list_schemes). No camelCase or mixed verb styles. Highly predictable and easy to scan.
Ten tools is a sensible scope for a build-fix-test automation loop, and each maps to a real step in that loop. However, autopilot_clean is largely subsumed by autopilot_cache_clean('all') and autopilot_tuist_build duplicates autopilot_build for a subset of projects, so there is mild redundancy.
The core lifecycle is covered end-to-end: build, test, resolve packages, apply fixes, verify via screenshot, and clean up caches, plus history for traceability. Gaps exist around simulator/device selection for test and screenshot, project/target introspection, and reverting or undoing applied fix sessions, but these are workable omissions.
Maintenance
Related MCP Connectors
Cloud iPhones and Macs with Xcode for AI agents: build, run and test iOS apps, use the screen.
Build, test and cache insights for Xcode, Gradle and Bazel projects, for coding agents.
Cloud iPhone Simulators for AI agents: build the Xcode project, read the screen, tap by label, test.
The cloud Mac alone, with Xcode, for AI agents: run commands, build and test, use the screen.
Related MCP Servers
- AlicenseAqualityBmaintenanceEnable Claude Code, Cursor, or your favorite LLM to interact with Xcode, building your projects the same way you do, and seeing the same errors. Greatly increases productivity when working on iOS, iPadOS, macOS, visionOS, tvOS projects & Swift packages - or any time you might use Xcode.29225 PyPI5MIT
- AlicenseBqualityDmaintenanceEnables AI assistants to build, test, run, and manage Apple platform projects (iOS, macOS, tvOS, watchOS, visionOS) directly through Xcode. Provides comprehensive control over Xcode projects, Swift packages, simulators, and development workflows without leaving your editor.53MIT
- AlicenseNot gradedqualityBmaintenanceConnects AI coding clients like OpenCode, Codex, and Claude Code to Xcode and Apple development tools, enabling builds, tests, simulator and device management, profiling, asset handling, and more through natural language.95 npm1MIT
- AlicenseAqualityBmaintenanceEnables AI coding agents to review Swift code, scaffold new iOS apps, and build, test, and preview them in the Xcode Simulator using local Apple guides and source references.3642MIT