Skip to main content
Glama

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 Project
  1. autopilot_build runs xcodebuild and returns structured errors with smart source context

  2. Claude Code analyzes the errors — seeing the enclosing function scope, related definitions, and call sites

  3. autopilot_apply_fixes applies the fixes with line-level verification and automatic backup

  4. Repeat 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

brew tap leejh08/xcode-autopilot
brew install xcode-autopilot

Option 2 — Clone

git clone https://github.com/leejh08/XcodeAutoPilot.git
cd XcodeAutoPilot
npm install && npm run build

Verify Xcode CLI tools are installed:

xcodebuild -version
# If missing: xcode-select --install

Register 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

autopilot_build

Run xcodebuild — returns structured errors with smart context (enclosing scope + related definitions and call sites)

autopilot_apply_fixes

Apply fixes safely — line-verified, backed up before patching, auto-rollback if errors increase

autopilot_screenshot

Build and run the app in a simulator, capture a screenshot, and return it as an image for AI visual analysis

autopilot_tuist_build

Build Tuist projects end-to-end — auto-detects version and runs install → generate → xcodebuild

autopilot_resolve_spm

Resolve SPM dependencies and return structured errors

autopilot_cache_clean

Selectively clear DerivedData, ModuleCache, SPM cache, or Index store

autopilot_list_schemes

List all available build schemes

autopilot_clean

Run xcodebuild clean

autopilot_history

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 Code

Keyword

Alias

What it does

xbuild

xap build

Build → analyze → fix loop (up to 5 iterations)

xfix

xap fix

Focused error analysis + fix

xclean

xap clean

Cache clean → verify build

xspm

xap spm

SPM resolve → cache clean → verify build

xshot

xap shot

Build → launch in simulator → screenshot → AI visual verification

xtest

xap test

Run tests → analyze failures → fix loop (up to 5 iterations)


License

MIT

Available Tools

10 tools
autopilot_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

    A3.7/5.0

    Scored across 10 tools

    Disambiguation4/5

    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.

    Naming Consistency5/5

    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.

    Tool Count4/5

    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.

    Completeness4/5

    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

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      B
      maintenance
      Enable 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.
      29
      225 PyPI
      5
      MIT
    • A
      license
      B
      quality
      D
      maintenance
      Enables 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.
      5
      3
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Connects 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 npm
      1
      MIT