XcodeBuild MCP server

Enables building, running, and debugging iOS and macOS applications through Xcode with tools for project discovery, simulator management, app deployment, and UI automation testing.
Back to servers
Setup instructions
Provider
Cameron Cooke
Release date
May 14, 2025
Language
TypeScript
Stats
2.7K stars

XcodeBuildMCP is a Model Context Protocol (MCP) server that provides a suite of tools for integrating Xcode operations with AI assistants. It enables programmatic interaction with Xcode projects, simulators, devices, and Swift packages through a standardized interface, making it easier for AI assistants to help with iOS and macOS development tasks.

Installation and Setup

Prerequisites

  • macOS 14.5 or later
  • Xcode 16.x or later
  • Node.js 18.x or later

Installing XcodeBuildMCP

General Installation

Most MCP clients (Cursor, VS Code, Windsurf, Claude Desktop, etc.) use the following JSON configuration format. Add this to your client's JSON configuration in the mcpServers object:

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

Client-Specific Instructions

OpenAI Codex CLI

Add this to your Codex CLI config file:

[mcp_servers.XcodeBuildMCP]
command = "npx"
args = ["-y", "xcodebuildmcp@latest"]
env = { "INCREMENTAL_BUILDS_ENABLED" = "false", "XCODEBUILDMCP_SENTRY_DISABLED" = "false" }

Claude Code CLI

Install via command line:

# Add XcodeBuildMCP server to Claude Code
claude mcp add XcodeBuildMCP npx xcodebuildmcp@latest

# Or with environment variables
claude mcp add XcodeBuildMCP npx xcodebuildmcp@latest -e INCREMENTAL_BUILDS_ENABLED=false -e XCODEBUILDMCP_SENTRY_DISABLED=false

Smithery (for Claude Desktop)

Install automatically using Smithery:

npx -y @smithery/cli install @cameroncooke/XcodeBuildMCP --client claude

Feature Overview

Xcode Project Management

XcodeBuildMCP provides tools for:

  • Discovering Xcode projects and workspaces
  • Building for macOS, iOS simulator, and iOS device targets
  • Listing schemes and showing build settings
  • Cleaning build products
  • Creating new iOS and macOS projects from templates

Swift Package Manager Support

  • Building Swift packages with configuration options
  • Running test suites with filtering options
  • Executing package binaries
  • Managing long-running processes
  • Cleaning build artifacts

Simulator Management

  • Listing, booting, and opening simulators
  • Installing, launching, and stopping apps
  • Capturing logs from running apps
  • Interacting with simulator UI elements
  • Taking screenshots
  • Recording video (requires AXe v1.1.0+)

Physical Device Support

  • Discovering connected Apple devices (USB or Wi-Fi)
  • Building, installing, launching, and stopping apps
  • Running test suites on physical devices
  • Capturing console output from running apps

Advanced Configuration

Enabling Incremental Builds

For faster builds, you can enable experimental incremental build support by setting an environment variable:

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

Dynamic Tools Support

To optimize context window usage in AI assistants, you can enable dynamic tool loading:

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

This mode starts with minimal tools and loads additional tools as needed, based on the context of your development tasks.

Selective Workflow Loading

If you want to reduce context usage but your client doesn't support MCP sampling, you can selectively load specific workflows:

"XcodeBuildMCP": {
  "command": "npx",
  "args": ["-y", "xcodebuildmcp@latest"],
  "env": {
    "XCODEBUILDMCP_ENABLED_WORKFLOWS": "simulator,device,project-discovery"
  }
}

Available workflows include: device, simulator, simulator-management, swift-package, project-discovery, macos, ui-testing, logging, project-scaffolding, utilities, doctor, and discovery.

Code Signing for Device Deployment

For device deployment to work, you must configure code signing in Xcode before using XcodeBuildMCP:

  1. Open your project in Xcode
  2. Select your project target
  3. Go to "Signing & Capabilities" tab
  4. Enable "Automatically manage signing" and select your development team
  5. Ensure a valid provisioning profile is selected

Troubleshooting

If you encounter issues, use the built-in doctor tool to diagnose problems:

npx --package xcodebuildmcp@latest xcodebuildmcp-doctor

This tool will check your system configuration and report on all dependencies required by XcodeBuildMCP.

Privacy Settings

XcodeBuildMCP uses Sentry for error monitoring. If you prefer not to send error logs, opt out by setting:

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

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

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

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

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

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

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

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later