iOS MCP routing (Argent vs XcodeBuildMCP)
Decide the primary tool by task class. Prefer one owner per phase. Combine
only at clean handoff points (usually: XcodeBuildMCP builds → Argent verifies).
0. Availability check (once per session)
- XcodeBuildMCP — MCP tools present (
XcodeBuildMCP__*) and/or command -v xcodebuildmcp.
- Argent — MCP tools present (
argent__*) and/or command -v argent.
- If only one is available, use it within its strengths; do not invent the missing one.
- If neither is available, fall back to shell (
xcodebuild, xcrun simctl, adb) and say so.
Load this skill before defaulting to either stack for Apple platform work.
1. One-line rule
| Need |
Primary |
| Compile, scheme/test, LLDB, coverage, project/schemes, macOS, physical iOS device build |
XcodeBuildMCP |
| Drive UI, QA, screenshots/diff, permissions, flows, multi-platform (Android/Chromium/TV), RN runtime inspect, native perf traces |
Argent |
| "Change code → build → prove the UI" |
Both (XcodeBuildMCP then Argent) |
2. Decision tree
What is the bottleneck / goal?
│
├─ Does it need a successful Xcode/SwiftPM build or XCTest run?
│ └─ YES → XcodeBuildMCP (session defaults → build / test / build_run_sim)
│
├─ Is the app already installed and the task is "use / verify the product"?
│ └─ YES → Argent (list-devices → launch-app → describe → interact)
│
├─ Compile/link/signing failure?
│ └─ XcodeBuildMCP only (fix build; do not start Argent UI loops)
│
├─ Runtime crash / wrong UI / flow / visual regression?
│ └─ Prefer Argent for interaction + evidence
│ (optional: XcodeBuildMCP log capture / LLDB if you need native stack)
│
├─ Android, Chromium/Electron, Fire TV / Apple TV remote, RN Metro inspect?
│ └─ Argent only (XcodeBuildMCP does not own these)
│
└─ Physical iOS device install/run/test, or macOS app?
└─ XcodeBuildMCP (Argent iOS path is simulator-first)
3. Capability map (what each owns)
XcodeBuildMCP — build system + Apple toolchain
Owns:
- Project discovery:
discover_projs, list_schemes, show_build_settings
- Session defaults:
session_show_defaults / session_set_defaults (required before first build/run/test)
- Simulator:
build, build_run_sim, test_sim, install_app_sim, launch_app_sim, stop_app_sim, boot_sim, open_sim, list_sims
- Clean / app path / bundle id extraction
- Physical device and macOS build/run/test
- SwiftPM build/test/run
- LLDB: attach, breakpoints, stack, variables, continue/detach
- Code coverage from xcresult
- Sim management extras: erase, location, appearance, status bar, video record
- Built-in UI automation via elementRef (
snapshot_ui → tap / type_text / swipe / wait_for_ui / batch)
Does not own (or is weak for):
- Android / Chromium / Vega
- Permission grant/deny/reset without Settings UI
- Screenshot pixel-diff workflows, record/replay flows
- React Native Metro component tree / JS eval
- Native Instruments/Perfetto-style profiling pipelines Argent provides
- Cross-app system AX for arbitrary foreground content as rich as Argent
describe (Argent is preferred for agent QA loops)
Mandatory session habit: before first build/run/test call, session_show_defaults. If project/scheme/simulator missing, set them. Prefer build_run_sim over separate build+install+launch unless you need a compile-only check.
Argent — device runtime, interaction, QA
Owns:
- Multi-platform device inventory:
list-devices (iOS sim, Android emu/device, Chromium CDP, Vega)
- Boot/launch/restart/reinstall:
boot-device, launch-app, restart-app, reinstall-app
- Discovery:
describe (AX/DOM), native-describe-screen (iOS UIKit), RN debugger-component-tree
- Interaction: gestures, keyboard (incl. secret placeholders), hardware buttons, deep links (
open-url)
- Waiting:
await-ui-element, await-screen-idle
- Evidence:
screenshot, screenshot-diff
- Setup:
settings-permissions
- Automation reuse: flow record/execute (
.argent/flows/)
- Profiling: native profiler (+ RN profiler when RN)
- TV:
tv-remote + focus-oriented describe
Does not own:
- Xcode scheme builds, clean, XCTest orchestration, coverage reports
- LLDB source-level debugging of native binaries
- Guaranteed physical-iOS parity (treat Argent iOS as simulator-first)
- Replacing
pnpm ios:prepare / XcodeGen / Fastlane release pipelines
Mandatory interaction habit: never guess tap coordinates from a screenshot alone — always discover (describe / native / RN tree) first. Prefer launch-app over home-screen icon taps.
Overlap zone (pick one primary)
Both can: boot a sim, launch an installed app, screenshot, basic tap/type.
| Overlap task |
Prefer |
Why |
| Build + install + first launch after code change |
XcodeBuildMCP build_run_sim |
Compiles; Argent cannot build |
| Re-launch already installed app for QA |
Argent launch-app / restart-app |
Faster; native-devtools prep on iOS |
| UI exploration / multi-step QA |
Argent |
Richer discovery, waits, diffs, flows, multi-platform |
| Quick elementRef taps right after an XcodeBuildMCP run |
XcodeBuildMCP UI tools OK for short checks |
Same stack; avoid thrashing |
| Long QA, visual regression, permissions, RN/Android |
Argent |
Specialty tools |
| XCTest / unit/UI test targets |
XcodeBuildMCP test_sim / device test |
Real test runner |
| Manual agent "click through the app" |
Argent |
Designed agent loop |
Do not interleave Argent gestures and XcodeBuildMCP snapshot_ui/tap on the same screen without a deliberate refresh — elementRefs and coordinate spaces are stack-specific. Finish one automation style, then switch only at a stable boundary (e.g. after navigation settle).
4. When to combine in one session
Pattern A — implement → build → UI verify (most common)
- Edit code.
- XcodeBuildMCP:
session_show_defaults → fix defaults → build_run_sim (or build if install not needed).
- On build failure: stay on XcodeBuildMCP until green. Do not open Argent yet.
- On success: note simulator UDID/name and bundle id from defaults /
get_app_bundle_id.
- Argent:
list-devices → same UDID → describe / interact / screenshot / optional screenshot-diff.
- If UI wrong → fix code → return to step 2 (rebuild). If only JS/web content in a hybrid shell and no native rebuild needed, relaunch/reload as the project requires, then Argent again.
Pattern B — compile-only gate, then manual QA later
- XcodeBuildMCP
build (simulator, no launch).
- Later Argent session for QA against an already-installed build (or reinstall via Argent
reinstall-app using get_sim_app_path / known .app path).
Pattern C — crash / native bug
- Reproduce with Argent (or XcodeBuildMCP UI) to get to the crash.
- Attach XcodeBuildMCP LLDB (
debug_attach_sim, breakpoints, stack, variables).
- After fix: XcodeBuildMCP rebuild; Argent re-verify the flow.
Pattern D — test suite + exploratory QA
- XcodeBuildMCP
test_sim for automated tests / coverage.
- Argent for scenarios tests do not cover (permissions matrix, visual diff, multi-step product flows).
Pattern E — hybrid monorepo (native host + web/miniapps)
- Native host changes → XcodeBuildMCP build/run.
- In-app UX / miniapp surface → Argent
describe + screenshots (WKWebView content may be sparse in AX; use screenshot + careful discovery).
- Pure web package work → not these tools (web browser tooling / project web scripts).
5. Shared identifiers (handoff contract)
When combining tools, pass these explicitly between phases:
| Token |
Source |
Consumers |
| Simulator UDID |
XcodeBuildMCP defaults / list_sims; Argent list-devices |
All launch/interact tools |
| Scheme + configuration |
XcodeBuildMCP defaults |
Rebuilds |
| Bundle ID |
project / get_app_bundle_id / session bundleId |
Argent launch-app, permissions, reinstall |
.app path |
XcodeBuildMCP get_sim_app_path |
Argent reinstall-app after clean install needs |
| Log file path |
XcodeBuildMCP launch/build_run responses |
Crash diagnosis |
Prefer one booted simulator for the whole session. If XcodeBuildMCP boots sim A and Argent boots sim B, launches and UI state diverge.
6. Anti-patterns
- Argent for compile errors — it will not fix or surface xcodebuild diagnostics; use XcodeBuildMCP.
- XcodeBuildMCP as the only tool for multi-step product QA when Argent is available — weaker flows, no screenshot-diff/permissions/Android.
- Building with raw
xcodebuild/simctl when XcodeBuildMCP is connected — prefer MCP session defaults (skill: xcodebuildmcp-cli).
- Tapping from screenshots with either stack when a discovery API exists.
- Starting Argent UI work before the new binary is installed after native code changes — rebuild first.
- Assuming the repo is React Native because Argent has RN skills — detect project type; native-only hosts skip Metro/debugger-component-tree.
- Mixing elementRef taps and Argent coordinate taps mid-flow without re-discovering.
- Physical device QA defaulting to Argent — use XcodeBuildMCP device workflow unless Argent explicitly supports the target in this environment.
7. Suggested skill handoff
After choosing the primary tool, load the specialized skill (do not re-encode their full procedures here):
| Situation |
Next skill |
| XcodeBuildMCP usage / CLI discovery |
xcodebuildmcp-cli |
| Argent iOS sim boot |
argent-ios-simulator-setup |
| Argent taps/gestures/screenshots |
argent-device-interact |
| Agent QA loops |
argent-test-ui-flow |
| Visual regression |
argent-screenshot-diff |
| Permissions without Settings UI |
argent-settings-permissions |
| Record/replay |
argent-create-flow |
| Native perf |
argent-native-profiler |
| RN (only if project is RN) |
argent-react-native-app-workflow, argent-metro-debugger |
| Android / TV |
argent-android-emulator-setup, argent-tv-interact |
8. Quick recipes
"Build the iOS app"
XcodeBuildMCP only → defaults → build or build_run_sim.
"Is the new button on screen / does the menu work?"
If binary current: Argent only.
If you just changed native UI code: XcodeBuildMCP build_run_sim, then Argent QA.
"XCTest failed"
XcodeBuildMCP test_sim (and logs/coverage). Use Argent only if you need to reproduce a manual path the test does not cover.
"Need Android or webview Electron too"
Argent. XcodeBuildMCP is out of scope.
"LLDB breakpoint in Swift"
XcodeBuildMCP debugging workflow. Argent does not replace LLDB.
9. Exit criteria
Before acting, state (internally or briefly to the user when ambiguous):
- Primary tool for this step: Argent | XcodeBuildMCP | both (ordered).
- Why (one sentence from the decision tree).
- Handoff tokens if both: UDID, bundle id, scheme.
- Specialized skill loaded next.
If the user already named a tool, honor that unless it is impossible (e.g. "Argent build my scheme" → explain and use XcodeBuildMCP for build).
References
- Capability detail and edge cases:
references/capability-matrix.md
1---2name: ios-mcp-routing3description: Route Apple/iOS agent work between Argent MCP and XcodeBuildMCP (and when to combine both in one session). Use when choosing tooling for build, compile, test, run, install, launch, simulator control, UI automation, screenshots, QA, LLDB debug, logs, permissions, profiling, physical device, macOS, Android, Chromium, TV, or when both MCP servers are available and the agent might pick the wrong one. Triggers: "which tool", "Argent or XcodeBuild", "XcodeBuildMCP", build then verify UI, fix compile error then QA, run on simulator, XCTest, snapshot_ui vs describe. Slash: /ios-mcp-routing4---5
6# iOS MCP routing (Argent vs XcodeBuildMCP)
7
8Decide the **primary** tool by task class. Prefer one owner per phase. Combine
9only at clean handoff points (usually: **XcodeBuildMCP builds → Argent verifies**).
10
11## 0. Availability check (once per session)
12
131. **XcodeBuildMCP** — MCP tools present (`XcodeBuildMCP__*`) and/or `command -v xcodebuildmcp`.
142. **Argent** — MCP tools present (`argent__*`) and/or `command -v argent`.
153. If only one is available, use it within its strengths; do not invent the missing one.
164. If neither is available, fall back to shell (`xcodebuild`, `xcrun simctl`, `adb`) and say so.
17
18Load this skill before defaulting to either stack for Apple platform work.
19
20## 1. One-line rule
21
22| Need | Primary |
23| --- | --- |
24| Compile, scheme/test, LLDB, coverage, project/schemes, macOS, physical iOS device build | **XcodeBuildMCP** |
25| Drive UI, QA, screenshots/diff, permissions, flows, multi-platform (Android/Chromium/TV), RN runtime inspect, native perf traces | **Argent** |
26| "Change code → build → prove the UI" | **Both** (XcodeBuildMCP then Argent) |
27
28## 2. Decision tree
29
30```
31What is the bottleneck / goal?
32│
33├─ Does it need a successful Xcode/SwiftPM build or XCTest run?
34│ └─ YES → XcodeBuildMCP (session defaults → build / test / build_run_sim)
35│
36├─ Is the app already installed and the task is "use / verify the product"?
37│ └─ YES → Argent (list-devices → launch-app → describe → interact)
38│
39├─ Compile/link/signing failure?
40│ └─ XcodeBuildMCP only (fix build; do not start Argent UI loops)
41│
42├─ Runtime crash / wrong UI / flow / visual regression?
43│ └─ Prefer Argent for interaction + evidence
44│ (optional: XcodeBuildMCP log capture / LLDB if you need native stack)
45│
46├─ Android, Chromium/Electron, Fire TV / Apple TV remote, RN Metro inspect?
47│ └─ Argent only (XcodeBuildMCP does not own these)
48│
49└─ Physical iOS device install/run/test, or macOS app?
50 └─ XcodeBuildMCP (Argent iOS path is simulator-first)
51```
52
53## 3. Capability map (what each owns)
54
55### XcodeBuildMCP — build system + Apple toolchain
56
57**Owns:**
58
59- Project discovery: `discover_projs`, `list_schemes`, `show_build_settings`
60- Session defaults: `session_show_defaults` / `session_set_defaults` (required before first build/run/test)
61- Simulator: `build`, `build_run_sim`, `test_sim`, `install_app_sim`, `launch_app_sim`, `stop_app_sim`, `boot_sim`, `open_sim`, `list_sims`
62- Clean / app path / bundle id extraction
63- Physical device and macOS build/run/test
64- SwiftPM build/test/run
65- LLDB: attach, breakpoints, stack, variables, continue/detach
66- Code coverage from xcresult
67- Sim management extras: erase, location, appearance, status bar, video record
68- Built-in UI automation via **elementRef** (`snapshot_ui` → `tap` / `type_text` / `swipe` / `wait_for_ui` / `batch`)
69
70**Does not own (or is weak for):**
71
72- Android / Chromium / Vega
73- Permission grant/deny/reset without Settings UI
74- Screenshot pixel-diff workflows, record/replay flows
75- React Native Metro component tree / JS eval
76- Native Instruments/Perfetto-style profiling pipelines Argent provides
77- Cross-app system AX for arbitrary foreground content as rich as Argent `describe` (Argent is preferred for agent QA loops)
78
79**Mandatory session habit:** before first build/run/test call, `session_show_defaults`. If project/scheme/simulator missing, set them. Prefer `build_run_sim` over separate build+install+launch unless you need a compile-only check.
80
81### Argent — device runtime, interaction, QA
82
83**Owns:**
84
85- Multi-platform device inventory: `list-devices` (iOS sim, Android emu/device, Chromium CDP, Vega)
86- Boot/launch/restart/reinstall: `boot-device`, `launch-app`, `restart-app`, `reinstall-app`
87- Discovery: `describe` (AX/DOM), `native-describe-screen` (iOS UIKit), RN `debugger-component-tree`
88- Interaction: gestures, keyboard (incl. secret placeholders), hardware buttons, deep links (`open-url`)
89- Waiting: `await-ui-element`, `await-screen-idle`
90- Evidence: `screenshot`, `screenshot-diff`
91- Setup: `settings-permissions`
92- Automation reuse: flow record/execute (`.argent/flows/`)
93- Profiling: native profiler (+ RN profiler when RN)
94- TV: `tv-remote` + focus-oriented `describe`
95
96**Does not own:**
97
98- Xcode scheme builds, clean, XCTest orchestration, coverage reports
99- LLDB source-level debugging of native binaries
100- Guaranteed physical-iOS parity (treat Argent iOS as **simulator-first**)
101- Replacing `pnpm ios:prepare` / XcodeGen / Fastlane release pipelines
102
103**Mandatory interaction habit:** never guess tap coordinates from a screenshot alone — always discover (`describe` / native / RN tree) first. Prefer `launch-app` over home-screen icon taps.
104
105### Overlap zone (pick one primary)
106
107Both can: boot a sim, launch an installed app, screenshot, basic tap/type.
108
109| Overlap task | Prefer | Why |
110| --- | --- | --- |
111| Build + install + first launch after code change | **XcodeBuildMCP** `build_run_sim` | Compiles; Argent cannot build |
112| Re-launch already installed app for QA | **Argent** `launch-app` / `restart-app` | Faster; native-devtools prep on iOS |
113| UI exploration / multi-step QA | **Argent** | Richer discovery, waits, diffs, flows, multi-platform |
114| Quick elementRef taps right after an XcodeBuildMCP run | **XcodeBuildMCP** UI tools OK for short checks | Same stack; avoid thrashing |
115| Long QA, visual regression, permissions, RN/Android | **Argent** | Specialty tools |
116| XCTest / unit/UI test targets | **XcodeBuildMCP** `test_sim` / device test | Real test runner |
117| Manual agent "click through the app" | **Argent** | Designed agent loop |
118
119**Do not** interleave Argent gestures and XcodeBuildMCP `snapshot_ui`/`tap` on the same screen without a deliberate refresh — elementRefs and coordinate spaces are stack-specific. Finish one automation style, then switch only at a stable boundary (e.g. after navigation settle).
120
121## 4. When to combine in one session
122
123### Pattern A — implement → build → UI verify (most common)
124
1251. Edit code.
1262. **XcodeBuildMCP:** `session_show_defaults` → fix defaults → `build_run_sim` (or `build` if install not needed).
1273. On build failure: stay on XcodeBuildMCP until green. Do not open Argent yet.
1284. On success: note **simulator UDID/name** and **bundle id** from defaults / `get_app_bundle_id`.
1295. **Argent:** `list-devices` → same UDID → `describe` / interact / `screenshot` / optional `screenshot-diff`.
1306. If UI wrong → fix code → return to step 2 (rebuild). If only JS/web content in a hybrid shell and no native rebuild needed, relaunch/reload as the project requires, then Argent again.
131
132### Pattern B — compile-only gate, then manual QA later
133
1341. XcodeBuildMCP `build` (simulator, no launch).
1352. Later Argent session for QA against an already-installed build (or reinstall via Argent `reinstall-app` using `get_sim_app_path` / known `.app` path).
136
137### Pattern C — crash / native bug
138
1391. Reproduce with Argent (or XcodeBuildMCP UI) to get to the crash.
1402. Attach **XcodeBuildMCP** LLDB (`debug_attach_sim`, breakpoints, stack, variables).
1413. After fix: XcodeBuildMCP rebuild; Argent re-verify the flow.
142
143### Pattern D — test suite + exploratory QA
144
1451. XcodeBuildMCP `test_sim` for automated tests / coverage.
1462. Argent for scenarios tests do not cover (permissions matrix, visual diff, multi-step product flows).
147
148### Pattern E — hybrid monorepo (native host + web/miniapps)
149
1501. Native host changes → XcodeBuildMCP build/run.
1512. In-app UX / miniapp surface → Argent `describe` + screenshots (WKWebView content may be sparse in AX; use screenshot + careful discovery).
1523. Pure web package work → not these tools (web browser tooling / project web scripts).
153
154## 5. Shared identifiers (handoff contract)
155
156When combining tools, pass these explicitly between phases:
157
158| Token | Source | Consumers |
159| --- | --- | --- |
160| Simulator UDID | XcodeBuildMCP defaults / `list_sims`; Argent `list-devices` | All launch/interact tools |
161| Scheme + configuration | XcodeBuildMCP defaults | Rebuilds |
162| Bundle ID | project / `get_app_bundle_id` / session `bundleId` | Argent `launch-app`, permissions, reinstall |
163| `.app` path | XcodeBuildMCP `get_sim_app_path` | Argent `reinstall-app` after clean install needs |
164| Log file path | XcodeBuildMCP launch/build_run responses | Crash diagnosis |
165
166**Prefer one booted simulator for the whole session.** If XcodeBuildMCP boots sim A and Argent boots sim B, launches and UI state diverge.
167
168## 6. Anti-patterns
169
1701. **Argent for compile errors** — it will not fix or surface xcodebuild diagnostics; use XcodeBuildMCP.
1712. **XcodeBuildMCP as the only tool for multi-step product QA** when Argent is available — weaker flows, no screenshot-diff/permissions/Android.
1723. **Building with raw `xcodebuild`/`simctl` when XcodeBuildMCP is connected** — prefer MCP session defaults (skill: `xcodebuildmcp-cli`).
1734. **Tapping from screenshots with either stack** when a discovery API exists.
1745. **Starting Argent UI work before the new binary is installed** after native code changes — rebuild first.
1756. **Assuming the repo is React Native** because Argent has RN skills — detect project type; native-only hosts skip Metro/debugger-component-tree.
1767. **Mixing elementRef taps and Argent coordinate taps** mid-flow without re-discovering.
1778. **Physical device QA defaulting to Argent** — use XcodeBuildMCP device workflow unless Argent explicitly supports the target in this environment.
178
179## 7. Suggested skill handoff
180
181After choosing the primary tool, load the specialized skill (do not re-encode their full procedures here):
182
183| Situation | Next skill |
184| --- | --- |
185| XcodeBuildMCP usage / CLI discovery | `xcodebuildmcp-cli` |
186| Argent iOS sim boot | `argent-ios-simulator-setup` |
187| Argent taps/gestures/screenshots | `argent-device-interact` |
188| Agent QA loops | `argent-test-ui-flow` |
189| Visual regression | `argent-screenshot-diff` |
190| Permissions without Settings UI | `argent-settings-permissions` |
191| Record/replay | `argent-create-flow` |
192| Native perf | `argent-native-profiler` |
193| RN (only if project is RN) | `argent-react-native-app-workflow`, `argent-metro-debugger` |
194| Android / TV | `argent-android-emulator-setup`, `argent-tv-interact` |
195
196## 8. Quick recipes
197
198### "Build the iOS app"
199
200XcodeBuildMCP only → defaults → `build` or `build_run_sim`.
201
202### "Is the new button on screen / does the menu work?"
203
204If binary current: Argent only.
205If you just changed native UI code: XcodeBuildMCP `build_run_sim`, then Argent QA.
206
207### "XCTest failed"
208
209XcodeBuildMCP `test_sim` (and logs/coverage). Use Argent only if you need to reproduce a manual path the test does not cover.
210
211### "Need Android or webview Electron too"
212
213Argent. XcodeBuildMCP is out of scope.
214
215### "LLDB breakpoint in Swift"
216
217XcodeBuildMCP debugging workflow. Argent does not replace LLDB.
218
219## 9. Exit criteria
220
221Before acting, state (internally or briefly to the user when ambiguous):
222
2231. **Primary tool** for this step: Argent | XcodeBuildMCP | both (ordered).
2242. **Why** (one sentence from the decision tree).
2253. **Handoff tokens** if both: UDID, bundle id, scheme.
2264. **Specialized skill** loaded next.
227
228If the user already named a tool, honor that unless it is impossible (e.g. "Argent build my scheme" → explain and use XcodeBuildMCP for build).
229
230## References
231
232- Capability detail and edge cases: `references/capability-matrix.md`