XcodeBuildMCP

XcodeBuildMCP avatar

by cameroncooke

xcodemcpBrowser Automation

A Model Context Protocol (MCP) server that provides Xcode-related tools for integration with AI assistants and other MCP clients.

What is XcodeBuildMCP

A Model Context Protocol (MCP) server that provides Xcode-related tools for integration with AI assistants and other MCP clients.

Overview

This project implements an MCP server that exposes Xcode operations as tools that can be invoked by AI agents via the MCP protocol. It enables programmatic interaction with Xcode projects through a standardised interface, optimised for agent-driven development workflows.

https://github.com/user-attachments/assets/2da9d49c-b1d6-47c1-9f1e-ffdf71d8a09a

Why?

The XcodeBuild MCP tool exists primarily to streamline and standardise interaction between AI agents and Xcode projects. By providing dedicated tools for common Xcode operations, it removes reliance on manual or potentially incorrect command-line invocations.

This ensures a reliable and efficient development process, allowing agents to seamlessly leverage Xcode's capabilities while reducing the risk of configuration errors.

Critically, this MCP enables AI agents to independently validate code changes by building projects, inspecting errors, and iterating autonomously. In contrast to user-driven tools like Sweetpad, XcodeBuild MCP empowers agents to automate these workflows effectively.

Features

The XcodeBuildMCP server provides the following tool capabilities:

Xcode project management

  • Build Operations: Platform-specific build tools for macOS, iOS simulator, and iOS device targets
  • Project Information: Tools to list schemes and show build settings for Xcode projects and workspaces
  • Clean Operations: Clean build products using xcodebuild's native clean action

Simulator management

  • Simulator Control: List, boot, and open iOS simulators
  • App Deployment: Install and launch apps on iOS simulators

App utilities

  • Bundle ID Extraction: Extract bundle identifiers from iOS and macOS app bundles
  • App Launching: Launch built applications on both simulators and macOS

Getting started

Prerequisites

  • Node.js (v16 or later)
  • npm
  • Xcode command-line tools

Installation

  1. Clone the repository
  2. Install dependencies:
    npm install
    
  3. Build the project:
    npm run build
    
  4. Optionally start the server:
    node build/index.js
    

[!NOTE] You don't need to run the server manually as MCP clients will do this for you.

Adding to Windsurf/Cursor/Clude Desktop etc.

Create a new custom server configuration and add the following; changing the path to the actual path you cloned the repo to.

{
  "mcpServers": {
    "XcodeBuildMCP": {
      "command": "node",
      "args": [
        "/path_to/XcodeBuildMCP/build/index.js"
      ]
    }
  }
}

Debugging

You can use MCP Inspector via:

npx @modelcontextprotocol/inspector node build/index.js

Demos

Building and running iOS app in Cursor

https://github.com/user-attachments/assets/b9d334b5-7f28-47fc-9d66-28061bc701b4

Building and running iOS app in Claude Code

https://github.com/user-attachments/assets/e3c08d75-8be6-4857-b4d0-9350b26ef086

Licence

This project is licensed under the MIT License - see the LICENSE file for details.

Leave a Comment

Comments section will be available soon. Stay tuned!

Frequently Asked Questions

What is MCP?

MCP (Model Context Protocol) is an open protocol that standardizes how applications provide context to LLMs. Think of MCP like a USB-C port for AI applications, providing a standardized way to connect AI models to different data sources and tools.

What are MCP Servers?

MCP Servers are lightweight programs that expose specific capabilities through the standardized Model Context Protocol. They act as bridges between LLMs like Claude and various data sources or services, allowing secure access to files, databases, APIs, and other resources.

How do MCP Servers work?

MCP Servers follow a client-server architecture where a host application (like Claude Desktop) connects to multiple servers. Each server provides specific functionality through standardized endpoints and protocols, enabling Claude to access data and perform actions through the standardized protocol.

Are MCP Servers secure?

Yes, MCP Servers are designed with security in mind. They run locally with explicit configuration and permissions, require user approval for actions, and include built-in security features to prevent unauthorized access and ensure data privacy.