Skip to content

Commit 639f6c7

Browse files
committed
Link to full Readme
1 parent 4791de7 commit 639f6c7

File tree

2 files changed

+318
-318
lines changed

2 files changed

+318
-318
lines changed

README-ext.md

Lines changed: 316 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,316 @@
1+
<img src="banner.png" alt="XcodeBuild MCP" width="600"/>
2+
3+
A Model Context Protocol (MCP) server that provides Xcode-related tools for integration with AI assistants and other MCP clients.
4+
5+
## Table of contents
6+
7+
- [Overview](#overview)
8+
- [Why?](#why)
9+
- [Features](#features)
10+
- [Xcode project management](#xcode-project-management)
11+
- [Swift Package Manager](#swift-package-manager)
12+
- [Simulator management](#simulator-management)
13+
- [Device management](#device-management)
14+
- [App utilities](#app-utilities)
15+
- [MCP Resources](#mcp-resources)
16+
- [Getting started](#getting-started)
17+
- [Prerequisites](#prerequisites)
18+
- [One click install](#one-click-install)
19+
- [Manual installation](#manual-installation)
20+
- [Specific client installation instructions](#specific-client-installation-instructions)
21+
- [OpenAI Codex CLI](#openai-codex-cli)
22+
- [Claude Code CLI](#claude-code-cli)
23+
- [Incremental build support](#incremental-build-support)
24+
- [Workflow Selection](#workflow-selection)
25+
- [Session-aware opt-out](#session-aware-opt-out)
26+
- [Code Signing for Device Deployment](#code-signing-for-device-deployment)
27+
- [Troubleshooting](#troubleshooting)
28+
- [Doctor Tool](#doctor-tool)
29+
- [Privacy](#privacy)
30+
- [What is sent to Sentry?](#what-is-sent-to-sentry)
31+
- [Opting Out of Sentry](#opting-out-of-sentry)
32+
- [Demos](#demos)
33+
- [Autonomously fixing build errors in Cursor](#autonomously-fixing-build-errors-in-cursor)
34+
- [Utilising the new UI automation and screen capture features](#utilising-the-new-ui-automation-and-screen-capture-features)
35+
- [Building and running iOS app in Claude Desktop](#building-and-running-ios-app-in-claude-desktop)
36+
- [Contributing](#contributing)
37+
38+
## Overview
39+
40+
XcodeBuildMCP is a Model Context Protocol (MCP) server that exposes Xcode operations as tools and resources for AI assistants and other MCP clients. Built with a modern plugin architecture, it provides a comprehensive set of self-contained tools organized into workflow-based directories, plus MCP resources for efficient data access, enabling programmatic interaction with Xcode projects, simulators, devices, and Swift packages through a standardized interface.
41+
42+
![xcodebuildmcp2](https://github.com/user-attachments/assets/8961d5db-f7ed-4e60-bbb8-48bfd0bc1353)
43+
<caption>Using Cursor to build, install, and launch an app on the iOS simulator while capturing logs at run-time.</caption>
44+
45+
## Why?
46+
47+
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.
48+
49+
This ensures a reliable and efficient development process, allowing agents to seamlessly leverage Xcode's capabilities while reducing the risk of configuration errors.
50+
51+
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.
52+
53+
## Features
54+
55+
The XcodeBuildMCP server provides the following tool capabilities:
56+
57+
### Xcode project management
58+
- **Discover Projects**: Xcode projects and workspaces discovery
59+
- **Build Operations**: Platform-specific build tools for macOS, iOS simulator, and iOS device targets
60+
- **Project Information**: Tools to list schemes and show build settings for Xcode projects and workspaces
61+
- **Clean Operations**: Clean build products using xcodebuild's native clean action
62+
- **Incremental build support**: Lightning fast builds using incremental build support (experimental, opt-in required)
63+
- **Project Scaffolding**: Create new iOS and macOS projects from modern templates with workspace + SPM package architecture, customizable bundle identifiers, deployment targets, and device families
64+
65+
### Swift Package Manager
66+
- **Build Packages**: Build Swift packages with configuration and architecture options
67+
- **Run Tests**: Execute Swift package test suites with filtering and parallel execution
68+
- **Run Executables**: Execute package binaries with timeout handling and background execution support
69+
- **Process Management**: List and stop long-running executables started with Swift Package tools
70+
- **Clean Artifacts**: Remove build artifacts and derived data for fresh builds
71+
72+
### Simulator management
73+
- **Simulator Control**: List, boot, and open simulators
74+
- **App Lifecycle**: Complete app management - install, launch, and stop apps on simulators
75+
- **Log Capture**: Capture run-time logs from a simulator
76+
- **UI Automation**: Interact with simulator UI elements
77+
- **Screenshot**: Capture screenshots from a simulator
78+
- **Video Capture**: Start/stop simulator video capture to MP4 (AXe v1.1.0+)
79+
80+
### Device management
81+
- **Device Discovery**: List connected physical Apple devices over USB or Wi-Fi
82+
- **App Lifecycle**: Complete app management - build, install, launch, and stop apps on physical devices
83+
- **Testing**: Run test suites on physical devices with detailed results and cross-platform support
84+
- **Log Capture**: Capture console output from apps running on physical Apple devices
85+
- **Wireless Connectivity**: Support for devices connected over Wi-Fi networks
86+
87+
### App utilities
88+
- **Bundle ID Extraction**: Extract bundle identifiers from app bundles across all Apple platforms
89+
- **App Lifecycle Management**: Complete app lifecycle control across all platforms
90+
- Launch apps on simulators, physical devices, and macOS
91+
- Stop running apps with process ID or bundle ID management
92+
- Process monitoring and control for comprehensive app management
93+
94+
### MCP Resources
95+
96+
For clients that support MCP resources XcodeBuildMCP provides efficient URI-based data access:
97+
98+
- **Simulators Resource** (`xcodebuildmcp://simulators`): Direct access to available iOS simulators with UUIDs and states
99+
- **Devices Resource** (`xcodebuildmcp://devices`): Direct access to connected physical Apple devices with UDIDs and states
100+
- **Doctor Resource** (`xcodebuildmcp://doctor`): Direct access to environment information such as Xcode version, macOS version, and Node.js version
101+
102+
## Getting started
103+
104+
### Prerequisites
105+
106+
- macOS 14.5 or later
107+
- Xcode 16.x or later
108+
- Node 18.x or later
109+
110+
> Video capture requires the bundled AXe binary (v1.1.0+). Run `npm run bundle:axe` once locally before using `record_sim_video`. This is not required for unit tests.
111+
112+
Configure your MCP client
113+
114+
#### One click install
115+
116+
If you're using Curor or VS Code you can use one the below quick install links to install XcodeBuildMCP.
117+
118+
[![Install MCP Server](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en/install-mcp?name=XcodeBuildMCP&config=eyJ0eXBlIjoic3RkaW8iLCJjb21tYW5kIjoibnB4IC15IHhjb2RlYnVpbGRtY3BAbGF0ZXN0IiwiZW52Ijp7IklOQ1JFTUVOVEFMX0JVSUxEU19FTkFCTEVEIjoiZmFsc2UiLCJYQ09ERUJVSUxETUNQX1NFTlRSWV9ESVNBQkxFRCI6ImZhbHNlIn19)
119+
120+
[<img src="https://img.shields.io/badge/VS_Code-VS_Code?style=flat-square&label=Install%20Server&color=0098FF" alt="Install in VS Code">](https://insiders.vscode.dev/redirect/mcp/install?name=XcodeBuildMCP&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22xcodebuildmcp%40latest%22%5D%7D)
121+
122+
[<img alt="Install in VS Code Insiders" src="https://img.shields.io/badge/VS_Code_Insiders-VS_Code_Insiders?style=flat-square&label=Install%20Server&color=24bfa5">](https://insiders.vscode.dev/redirect/mcp/install?name=XcodeBuildMCP&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22xcodebuildmcp%40latest%22%5D%7D&quality=insiders)
123+
124+
#### Manual installation
125+
126+
Most MCP clients (Cursor, VS Code, Windsurf, Claude Desktop etc) have standardised on the following JSON configuration format, just add the the following to your client's JSON configuration's `mcpServers` object:
127+
128+
```json
129+
"XcodeBuildMCP": {
130+
"command": "npx",
131+
"args": [
132+
"-y",
133+
"xcodebuildmcp@latest"
134+
]
135+
}
136+
```
137+
138+
#### Specific client installation instructions
139+
140+
##### OpenAI Codex CLI
141+
142+
Codex uses a toml configuration file to configure MCP servers. To configure XcodeBuildMCP with [OpenAI's Codex CLI](https://github.com/openai/codex), add the following configuration to your Codex CLI config file:
143+
144+
```toml
145+
[mcp_servers.XcodeBuildMCP]
146+
command = "npx"
147+
args = ["-y", "xcodebuildmcp@latest"]
148+
env = { "INCREMENTAL_BUILDS_ENABLED" = "false", "XCODEBUILDMCP_SENTRY_DISABLED" = "false" }
149+
```
150+
151+
If you see tool calls timing out in Codex (for example, `timed out awaiting tools/call after 60s`), increase the Codex tool timeout in your config:
152+
153+
```toml
154+
tool_timeout_sec = 600
155+
```
156+
157+
For more information see [OpenAI Codex MCP Server Configuration](https://github.com/openai/codex/blob/main/docs/config.md#connecting-to-mcp-servers) documentation.
158+
159+
##### Claude Code CLI
160+
161+
To use XcodeBuildMCP with [Claude Code](https://code.anthropic.com), you can add it via the command line:
162+
163+
```bash
164+
# Add XcodeBuildMCP server to Claude Code
165+
claude mcp add XcodeBuildMCP npx xcodebuildmcp@latest
166+
167+
# Or with environment variables
168+
claude mcp add XcodeBuildMCP npx xcodebuildmcp@latest -e INCREMENTAL_BUILDS_ENABLED=false -e XCODEBUILDMCP_SENTRY_DISABLED=false
169+
```
170+
171+
> [!IMPORTANT]
172+
> Please note that XcodeBuildMCP will request xcodebuild to skip macro validation. This is to avoid errors when building projects that use Swift Macros.
173+
174+
## Incremental build support
175+
176+
XcodeBuildMCP includes experimental support for incremental builds. This feature is disabled by default and can be enabled by setting the `INCREMENTAL_BUILDS_ENABLED` environment variable to `true`:
177+
178+
To enable incremental builds, set the `INCREMENTAL_BUILDS_ENABLED` environment variable to `true`:
179+
180+
Example MCP configuration:
181+
```json
182+
"XcodeBuildMCP": {
183+
...
184+
"env": {
185+
"INCREMENTAL_BUILDS_ENABLED": "true"
186+
}
187+
}
188+
```
189+
190+
> [!IMPORTANT]
191+
> Please note that incremental builds support is currently highly experimental and your mileage may vary. Please report any issues you encounter to the [issue tracker](https://github.com/cameroncooke/XcodeBuildMCP/issues).
192+
193+
## Workflow Selection
194+
195+
By default, XcodeBuildMCP loads all tools at startup. If you want a smaller tool surface for a specific workflow, set `XCODEBUILDMCP_ENABLED_WORKFLOWS` to a comma-separated list of workflow directory names. The `session-management` workflow is always auto-included since other tools depend on it.
196+
197+
Example MCP client configuration:
198+
```json
199+
"XcodeBuildMCP": {
200+
...
201+
"env": {
202+
"XCODEBUILDMCP_ENABLED_WORKFLOWS": "simulator,device,project-discovery"
203+
}
204+
}
205+
```
206+
207+
**Available Workflows:**
208+
- `device` (7 tools) - iOS Device Development
209+
- `simulator` (12 tools) - iOS Simulator Development
210+
- `simulator-management` (5 tools) - Simulator Management
211+
- `swift-package` (6 tools) - Swift Package Manager
212+
- `project-discovery` (5 tools) - Project Discovery
213+
- `macos` (6 tools) - macOS Development
214+
- `ui-testing` (11 tools) - UI Testing & Automation
215+
- `logging` (4 tools) - Log Capture & Management
216+
- `project-scaffolding` (2 tools) - Project Scaffolding
217+
- `utilities` (1 tool) - Project Utilities
218+
- `doctor` (1 tool) - System Doctor
219+
220+
## Session-aware opt-out
221+
222+
By default, XcodeBuildMCP uses a session-aware mode: the LLM (or client) sets shared defaults once (simulator, device, project/workspace, scheme, etc.), and all tools reuse them—similar to choosing a scheme and simulator in Xcode’s UI so you don’t repeat them on every action. This cuts context bloat not just in each call payload, but also in the tool schemas themselves (those parameters don’t have to be described on every tool).
223+
224+
If you prefer the older, explicit style where each tool requires its own parameters, set `XCODEBUILDMCP_DISABLE_SESSION_DEFAULTS=true`. This restores the legacy schemas with per-call parameters while still honoring any session defaults you choose to set.
225+
226+
Example MCP client configuration:
227+
```json
228+
"XcodeBuildMCP": {
229+
...
230+
"env": {
231+
"XCODEBUILDMCP_DISABLE_SESSION_DEFAULTS": "true"
232+
}
233+
}
234+
```
235+
236+
Leave this unset for the streamlined session-aware experience; enable it to force explicit parameters on each tool call.
237+
238+
## Code Signing for Device Deployment
239+
240+
For device deployment features to work, code signing must be properly configured in Xcode **before** using XcodeBuildMCP device tools:
241+
242+
1. Open your project in Xcode
243+
2. Select your project target
244+
3. Go to "Signing & Capabilities" tab
245+
4. Configure "Automatically manage signing" and select your development team
246+
5. Ensure a valid provisioning profile is selected
247+
248+
> **Note**: XcodeBuildMCP cannot configure code signing automatically. This initial setup must be done once in Xcode, after which the MCP device tools can build, install, and test apps on physical devices.
249+
250+
## Troubleshooting
251+
252+
If you encounter issues with XcodeBuildMCP, the doctor tool can help identify the problem by providing detailed information about your environment and dependencies.
253+
254+
### Doctor Tool
255+
256+
The doctor tool is a standalone utility that checks your system configuration and reports on the status of all dependencies required by XcodeBuildMCP. It's particularly useful when reporting issues.
257+
258+
```bash
259+
# Run the doctor tool using npx
260+
npx --package xcodebuildmcp@latest xcodebuildmcp-doctor
261+
```
262+
263+
The doctor tool will output comprehensive information about:
264+
265+
- System and Node.js environment
266+
- Xcode installation and configuration
267+
- Required dependencies (xcodebuild, AXe, etc.)
268+
- Environment variables affecting XcodeBuildMCP
269+
- Feature availability status
270+
271+
When reporting issues on GitHub, please include the full output from the doctor tool to help with troubleshooting.
272+
273+
## Privacy
274+
275+
This project uses [Sentry](https://sentry.io/) for error monitoring and diagnostics. Sentry helps us track issues, crashes, and unexpected errors to improve the reliability and stability of XcodeBuildMCP.
276+
277+
### What is sent to Sentry?
278+
- Only error-level logs and diagnostic information are sent to Sentry by default.
279+
- Error logs may include details such as error messages, stack traces, and (in some cases) file paths or project names. You can review the sources in this repository to see exactly what is logged.
280+
281+
### Opting Out of Sentry
282+
- If you do not wish to send error logs to Sentry, you can opt out by setting the environment variable `XCODEBUILDMCP_SENTRY_DISABLED=true`.
283+
284+
Example MCP client configuration:
285+
```json
286+
"XcodeBuildMCP": {
287+
...
288+
"env": {
289+
"XCODEBUILDMCP_SENTRY_DISABLED": "true"
290+
}
291+
}
292+
```
293+
294+
## Demos
295+
296+
### Autonomously fixing build errors in Cursor
297+
![xcodebuildmcp3](https://github.com/user-attachments/assets/173e6450-8743-4379-a76c-de2dd2b678a3)
298+
299+
### Utilising the new UI automation and screen capture features
300+
301+
![xcodebuildmcp4](https://github.com/user-attachments/assets/17300a18-f47a-428a-aad3-dc094859c1b2)
302+
303+
### Building and running iOS app in Claude Desktop
304+
https://github.com/user-attachments/assets/e3c08d75-8be6-4857-b4d0-9350b26ef086
305+
306+
## Contributing
307+
308+
[![TypeScript](https://img.shields.io/badge/TypeScript-5.x-blue.svg)](https://www.typescriptlang.org/) [![Node.js](https://img.shields.io/badge/node->=18.x-brightgreen.svg)](https://nodejs.org/)
309+
310+
Contributions are welcome! Here's how you can help improve XcodeBuildMCP.
311+
312+
See our documentation for development:
313+
- [CONTRIBUTING](docs/CONTRIBUTING.md) - Contribution guidelines and development setup
314+
- [CODE_QUALITY](docs/CODE_QUALITY.md) - Code quality standards, linting, and architectural rules
315+
- [TESTING](docs/TESTING.md) - Testing principles and patterns
316+
- [ARCHITECTURE](docs/ARCHITECTURE.md) - System architecture and design principles

0 commit comments

Comments
 (0)