|
| 1 | +# XcodeBuild MCP |
| 2 | + |
| 3 | +A Model Context Protocol (MCP) server that provides Xcode-related tools for integration with AI assistants and other MCP clients. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +This project implements an MCP server that exposes Xcode operations as tools that can be invoked by MCP clients. It allows AI assistants or other tools to interact with Xcode projects programmatically through a standardised interface. |
| 8 | + |
| 9 | +## Features |
| 10 | + |
| 11 | +The XcodeBuildMCP server provides the following tools: |
| 12 | + |
| 13 | +### Build tools |
| 14 | +- **build**: Builds the project using xcodebuild with support for workspaces, projects, schemes, and various platforms (iOS, macOS, watchOS, tvOS, visionOS and their simulator variants). |
| 15 | +- **showBuildSettings**: Shows build settings for the project using xcodebuild. |
| 16 | +- **getAppPath**: Extracts the app bundle path from build settings, making it easier to find the built app for installation or launching. |
| 17 | +- **listSchemes**: Lists all available schemes in an Xcode project or workspace. |
| 18 | +- **clean**: Cleans build products using xcodebuild's native clean action. |
| 19 | + |
| 20 | +### Simulator tools |
| 21 | +- **listSimulators**: Lists available iOS simulators with their UUIDs. |
| 22 | +- **bootSimulator**: Boots an iOS simulator using a specified UUID. |
| 23 | +- **openSimulator**: Opens the iOS Simulator app to view the simulator UI. |
| 24 | +- **installAppInSimulator**: Installs an app in an iOS simulator. |
| 25 | +- **launchAppInSimulator**: Launches an app in an iOS simulator using its bundle ID. |
| 26 | + |
| 27 | +### macOS tools |
| 28 | + |
| 29 | +- **launchMacOSApp**: Launches a macOS app using the open command. |
| 30 | + |
| 31 | +### Bundle ID tools |
| 32 | +- **getBundleId**: Extracts the bundle identifier from an app bundle (.app). |
| 33 | +- **getiOSBundleId**: Extracts the bundle identifier from an iOS app bundle. |
| 34 | +- **getMacOSBundleId**: Extracts the bundle identifier from a macOS app bundle. |
| 35 | + |
| 36 | +## Getting started |
| 37 | + |
| 38 | +### Prerequisites |
| 39 | + |
| 40 | +- Node.js (v16 or later) |
| 41 | +- npm |
| 42 | +- Xcode command-line tools |
| 43 | + |
| 44 | +### Installation |
| 45 | + |
| 46 | +1. Clone the repository |
| 47 | +2. Install dependencies: |
| 48 | + ``` |
| 49 | + npm install |
| 50 | + ``` |
| 51 | +3. Build the project: |
| 52 | + ``` |
| 53 | + npm run build |
| 54 | + ``` |
| 55 | +4. Optionally start the server: |
| 56 | + ``` |
| 57 | + node build/index.js |
| 58 | + ``` |
| 59 | + |
| 60 | +> [!NOTE] |
| 61 | +> You don't need to run the server manually as MCP clients will do this for you. |
| 62 | +
|
| 63 | +## Adding to Windsurf/Cursor/Clude Desktop etc. |
| 64 | + |
| 65 | +Create a new custom server configuration and add the following; changing the path to the actual path you cloned the repo to. |
| 66 | + |
| 67 | +```json |
| 68 | +{ |
| 69 | + "mcpServers": { |
| 70 | + "XcodeBuildMCP": { |
| 71 | + "command": "node", |
| 72 | + "args": [ |
| 73 | + "/path_to/XcodeBuildMCP/build/index.js" |
| 74 | + ] |
| 75 | + } |
| 76 | + } |
| 77 | +} |
| 78 | +``` |
| 79 | + |
| 80 | +## Debugging |
| 81 | + |
| 82 | +You can use MCP Inspector via: |
| 83 | + |
| 84 | +```bash |
| 85 | +npx @modelcontextprotocol/inspector node build/index.js |
| 86 | +``` |
| 87 | + |
| 88 | +## Licence |
| 89 | + |
| 90 | +This project is licensed under the MIT License - see the LICENSE file for details. |
0 commit comments