Skip to content

Commit 48f24c5

Browse files
committed
Beta version of simulator control!
1 parent 67a6c3f commit 48f24c5

9 files changed

Lines changed: 979 additions & 22 deletions

File tree

.eslintrc.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ export default {
1919
'prettier/prettier': 'error',
2020
'@typescript-eslint/explicit-function-return-type': 'warn',
2121
'@typescript-eslint/no-explicit-any': 'warn',
22-
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
2322
'no-console': ['warn', { allow: ['warn', 'error'] }],
2423
},
2524
};

README.md

Lines changed: 52 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,31 @@ A Model Context Protocol (MCP) server that provides Xcode-related tools for inte
44

55
## Table of contents
66

7+
- [Table of contents](#table-of-contents)
78
- [Overview](#overview)
89
- [Why?](#why)
910
- [Features](#features)
11+
* [Xcode project management](#xcode-project-management)
12+
* [Simulator management](#simulator-management)
13+
* [App utilities](#app-utilities)
1014
- [Getting started](#getting-started)
11-
- [Prerequisites](#prerequisites)
12-
- [One-line setup with mise](#one-line-setup-with-mise)
13-
- [Configure MCP clients](#configure-mcp-clients)
15+
* [Prerequisites](#prerequisites)
16+
* [One-line setup with mise](#one-line-setup-with-mise)
17+
* [Configure MCP clients](#configure-mcp-clients)
18+
* [Enabling UI Automation (beta)](#enabling-ui-automation-beta)
1419
- [Demos](#demos)
15-
- [Autonomously fixing build errors in Cursor](#autonomously-fixing-build-errors-in-cursor)
16-
- [Building and running iOS app in Claude Code](#building-and-running-ios-app-in-claude-code)
20+
* [Autonomously fixing build errors in Cursor](#autonomously-fixing-build-errors-in-cursor)
21+
* [Building and running iOS app in Claude Code](#building-and-running-ios-app-in-claude-code)
1722
- [Contributing](#contributing)
18-
- [Local development setup](#local-development-setup)
19-
- [Prerequisites](#prerequisites-2)
20-
- [Installation](#installation)
21-
- [Configure your MCP client](#configure-your-mcp-client-1)
22-
- [Debugging](#debugging)
23-
- [Making changes](#making-changes)
24-
- [Testing](#testing)
25-
- [Submitting](#submitting)
23+
* [Local development setup](#local-development-setup)
24+
+ [Prerequisites](#prerequisites-1)
25+
- [Optional: Enabling UI Automation](#optional-enabling-ui-automation)
26+
+ [Installation](#installation)
27+
+ [Configure your MCP client](#configure-your-mcp-client)
28+
+ [Debugging](#debugging)
29+
* [Making changes](#making-changes)
30+
* [Testing](#testing)
31+
* [Submitting](#submitting)
2632
- [Licence](#licence)
2733

2834

@@ -55,6 +61,8 @@ The XcodeBuildMCP server provides the following tool capabilities:
5561
- **Simulator Control**: List, boot, and open iOS simulators
5662
- **App Deployment**: Install and launch apps on iOS simulators
5763
- **Log Capture**: Capture run-time logs from a simulator
64+
- **UI Automation**: Interact with simulator UI elements (beta)
65+
- **Screenshot**: Capture screenshots from a simulator (beta)
5866

5967
### App utilities
6068
- **Bundle ID Extraction**: Extract bundle identifiers from iOS and macOS app bundles
@@ -107,6 +115,21 @@ Configure your MCP client (Windsurf, Cursor, Claude Desktop, etc.) to use the Xc
107115
> [!IMPORTANT]
108116
> Please note that XcodeBuildMCP will request xcodebuild to skip macro validation. This is to avoid errors when building projects that use Swift Macros.
109117
118+
### Enabling UI Automation (beta)
119+
120+
For UI automation features (tap, swipe, screenshot, etc.), you'll need to install Facebook's idb_companion:
121+
122+
```bash
123+
brew tap facebook/fb
124+
brew install idb-companion
125+
```
126+
127+
> [!IMPORTANT]
128+
> Please note that UI automation features are currently in beta so there might be some rough edges. If you encounter any issues, please report them in the [issue tracker](https://github.com/cameroncooke/XcodeBuildMCP/issues).
129+
130+
> [!NOTE]
131+
> Displaying images in tool reponses and embedding them in chat context may not be supported by all MCP Clients, it's currently known to be supported in Cursor.
132+
110133
## Demos
111134

112135
### Autonomously fixing build errors in Cursor
@@ -130,6 +153,22 @@ In addition to the prerequisites mentioned in the [Getting started](#getting-sta
130153
- Node.js (v16 or later)
131154
- npm
132155

156+
##### Optional: Enabling UI Automation
157+
158+
When running locally, you'll need to install Facebook's idb tools:
159+
160+
```bash
161+
# Install idb_companion (required for UI automation)
162+
brew tap facebook/fb
163+
brew install idb-companion
164+
```
165+
166+
Install fb-idb Python package:
167+
168+
```bash
169+
pip install fb-idb==1.1.7
170+
```
171+
133172
#### Installation
134173

135174
1. Clone the repository

example_projects/iOS/MCPTest/ContentView.swift

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,21 @@ import SwiftUI
99
import OSLog
1010

1111
struct ContentView: View {
12+
@State private var text = "Hello, world!"
13+
1214
var body: some View {
1315
VStack {
1416
Image(systemName: "globe")
1517
.imageScale(.large)
1618
.foregroundStyle(.tint)
17-
Text("Hello, world!")
19+
Text(text)
1820

1921
Button("Log something") {
20-
Logger.myApp.debug("Oh this is structured logging")
21-
debugPrint("I'm just plain old std out :-(")
22+
let message = ProcessInfo.processInfo.environment.map { "\($0.key): \($0.value)" }.joined(separator: "\n")
23+
Logger.myApp.debug("Environment: \(message)")
24+
debugPrint("Button was pressed")
25+
26+
text = "You just pressed the button!"
2227
}
2328
}
2429
.padding()

mise.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[tools]
2+
node = "16"
3+
python = "3.11"
4+
5+
[env]
6+
XCODEBUILDMCP_RUNNING_UNDER_MISE = "true"

src/index.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,13 @@ import {
7979
registerStopAndGetSimulatorLogTool,
8080
} from './tools/log.js';
8181

82+
// Import idb tools
83+
import { registerIdbTools } from './tools/idb.js';
84+
85+
// Import idb setup utility
86+
import { setupIdb } from './utils/idb-setup.js';
8287
import { version } from './version.js';
88+
8389
/**
8490
* Main function to start the server
8591
*/
@@ -143,6 +149,10 @@ async function main(): Promise<void> {
143149
registerStartSimulatorLogCaptureTool(server);
144150
registerStopAndGetSimulatorLogTool(server);
145151

152+
// Register idb tools for iOS simulator UI automation
153+
setupIdb();
154+
registerIdbTools(server);
155+
146156
// Start the server
147157
await startServer(server);
148158

0 commit comments

Comments
 (0)