by conorluddy
XCode CLI & Simulator MCP. Progressive disclosure of output. Minimises context & token use. Lets AI agents build, run sim & drive iOS apps without drowning in Xcode output. Now with Duo support.
# Add to your Claude Code skills
git clone https://github.com/conorluddy/xc-mcpxc-mcp is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by conorluddy. XCode CLI & Simulator MCP. Progressive disclosure of output. Minimises context & token use. Lets AI agents build, run sim & drive iOS apps without drowning in Xcode output. Now with Duo support. It has 103 GitHub stars.
xc-mcp's catalog security scan is still queued. You can run an instant dependency and prompt-injection check now with the "Scan for vulnerabilities" button above.
Clone the repository with "git clone https://github.com/conorluddy/xc-mcp" and add it to your Claude Code skills directory (see the Installation section above).
xc-mcp is primarily written in TypeScript. It is open-source under conorluddy on GitHub, so you can review or fork the full source.
Yes. AgentsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh xc-mcp against similar tools.
No comments yet. Be the first to share your thoughts!
Unlocks once the catalog security scan passes (runs nightly).
The deep catalog scan for this skill is still queued. Run an instant dependency check now instead.
An MCP server that lets AI agents build, run and drive iOS apps — without drowning in Xcode's output.
XC-MCP wraps xcodebuild, simctl and idb as 81 tools. Its job is not just to expose those
commands but to make their output fit in a model's context: summaries first, full detail on demand,
and the accessibility tree instead of screenshots wherever the app allows it.
Xcode tooling produces output at a scale no context window survives. Measured against a real app (Grapla, Xcode 27, iPhone 17 Pro simulator):
| Operation | Raw output | XC-MCP response | Reduction |
|---|---|---|---|
One incremental xcodebuild build |
1.67 MB · ~419,000 tokens | 1.1 KB · ~285 tokens | ~1,470× |
xcrun simctl list --json |
131 KB · ~32,800 tokens | 1.5 KB · ~370 tokens | ~90× |
One crash report (.ips) |
10.7 KB | 1.4 KB summary | ~7.5× |
A single raw build log would overflow a 200k-token context on its own. The full output is never thrown away: it is cached and returned as an MCP resource link, so an agent can drill into the exact errors it needs.
Claude Code:
claude mcp add xc-mcp -- npx -y xc-mcp
Codex CLI:
codex mcp add xc-mcp -- npx -y xc-mcp
or add it to ~/.codex/config.toml directly:
[mcp_servers.xc-mcp]
command = "npx"
args = ["-y", "xc-mcp"]
Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"xc-mcp": { "command": "npx", "args": ["-y", "xc-mcp"] }
}
}
Then ask your agent to build and run your app. rtfm({}) lists the tool categories.
| Requirement | Version | Needed for |
|---|---|---|
| macOS | 13+ | everything |
| Node.js | 20+ (CI tests 22 and 24) | running the server |
| Xcode + Command Line Tools | 15+ (26+ for iOS 26/27 simulators) | xcodebuild, simctl |
idb CLI + companion |
1.5.1+ | every idb-* tool: tapping, typing, accessibility |
xcode-select --install
# idb — required for all UI automation
brew tap facebook/fb
brew install facebook/fb/idb-companion facebook/fb/idb-cli
brew install idb-companionno longer works — it moved from Homebrew core to Meta'sfacebook/fbtap.
Run idb-doctor whenever UI automation misbehaves. It checks the CLI, the companion version,
the Xcode framework layout, stale companion registrations, CLI/companion version mismatches, and the axbridge guest needed by deep reads.
idb-companion must be 1.5.1 or newer. Xcode 27 moved SimulatorKit.framework, and older
companions fail silently: the accessibility tree reads correctly and every tap reports success,
while the simulator discards the events. idb-ui-tap, idb-ui-gesture and idb-ui-input detect
this and refuse to run rather than pretend.
brew upgrade facebook/fb/idb-companion
brew list --versions idb-companion # expect >= 1.5.1
Simulator.app — Xcode 27 replaced it with DeviceHub.app. simctl-boot with
openGui opens whichever this Xcode ships.idb call fails with Connection refused, a dead companion is still registered in
/tmp/idb/state. Run idb disconnect <udid>; idb-doctor detects this.Tools that produce large output return a summary plus an ID. The full output stays in a 30-minute
cache and is exposed two ways: an MCP resource at xcmcp://response/{id}, and the matching
*-get-details tool for clients without resource support.
xcodebuild-build({ projectPath: "./MyApp.xcodeproj", scheme: "MyApp" })
// → { buildId, success: false, errorCount: 3, warningCount: 1, durationMs: 18000 }
xcodebuild-get-details({ buildId, detailType: "errors-only" })
// → the three errors, not the 419k-token log
For UI automation, reading the accessibility tree is cheaper and faster than sending an image, and it gives exact coordinates instead of visual estimates. Measured on the same screen:
| Approach | Response | Latency |
|---|---|---|
idb-ui-find-element |
~450 tokens of JSON | ~270 ms |
screenshot (half size) |
~22.5 KB image | ~1,700 ms |
The first idb call in a session takes several seconds while the target cache warms.
This only works when the app is accessible — which is the point. An app VoiceOver can navigate is
an app an agent can navigate. accessibility-quality-check says which path to take;
accessibility-audit says what to fix.
idb-ui-find-element({ query: "Sign In" })
// → { centerX: 201, centerY: 572, visible: true }
idb-ui-tap({ x: 201, y: 572 })
Coordinates are not always tappable. The tree reports frames in scrolled-content space, so an
element can sit below the fold. Every match carries visible and, when off-screen, an
offscreenReason naming the gesture that brings it into view.
idb-semantic-action presses a uniquely identified control or replaces a field value with read-back verification. Use expect to guard a toggle's current value. Secure field values cannot be verified.idb-ui-find-element supports exact, type, identifier and index selection. workflow-tap-element uses accessibility presses for single matching controls.idb-ui-describe({ operation: "all", deep: true }) opts into axbridge for web content and alerts. This enables device accessibility automation mode, which idb does not restore. Deep web frames are unsuitable for coordinate taps.idb-ui-gesture adds scroll (content direction), refresh, label-based drag, pinch, long press, multi-tap, rotation and shake. Newer accessibility actions and gestures require idb CLI and companion 1.7+.app-state-capture({ outputDir: "/tmp/app-captures" }) creates a bundle of screenshot, accessibility tree, recent logs, device metadata and summary files. Individual artifact failures are reported.See the parity audit for capability mappings and verification limits.
Use simctl-duo with an explicit booted Duo UDID and operation: "state" to read
the hinge angle and enumerate displays. Set operation: "hinge" with pose: "closed",
"partial", "open", or an explicit angle in degrees. Use operation: "rotate"
with orientation: "portrait", "landscape", "portrait-upside-down", or
"landscape-flipped". Changes verify readback; failures include actionable guidance.
Pass the returned display ID as a string in display to screenshot or simctl-io.
Inactive displays can capture black. Explicit display capture omits unverified coordinate
mapping; idb inner-display touch routing is not supported by this integration.
The small bundled Objective-C helper compiles on first use with the selected Xcode
and is cached under ~/Library/Caches/xc-mcp/duo. No community CLI is required.
Mechanism research credit: hinge and
duoctl. XC-MCP implements its own focused helper.
These private interfaces are experimental. Replace the internal backend as supported
headless APIs become available and verified; folding and rotation may migrate separately.
An XCTest-only API does not replace this headless workflow.
Example MCP calls (replace <duo-udid> with a booted Duo UDID):
{"name":"simctl-duo","arguments":{"udid":"<duo-udid>","operation":"state"}}
{"name":"simctl-duo","arguments":{"udid":"<duo-udid>","operation":"hinge","pose":"open"}}
{"name":"simctl-duo","arguments":{"udid":"<duo-udid>","operation":"hinge","angle":127}}
{"name":"simctl-duo","arguments":{"udid":"<duo-udid>","operation":"rotate","orientation":"portrait"}}
{"name":"screenshot","arguments":{"udid":"<duo-udid>","display":"3","size":"full"}}
Use the display ID from your own state result; IDs above are examples. Supply exactly
one of pose or angle for hinge operations. partial means 90°. The response includes
hingeAngle, activeScreen, displayId, rotation, and the display inventory.
Verified on Xcode 27.1 / iOS 27.1. Rapid rotation can time out even when a paused
sequence succeeds; cover landscape also timed out in live checks. Read the returned
success and observed state before proceeding. The five-second polling budget excludes
initial readback and dispatch, so total request time can be longer. See the
live verification matrix.
Duo controls are available in default and --mini modes, and excluded by --build-only.
Every tool carries MCP annotations — readOnlyHint, destructiveHint, idempotentHint — so a
client can ask before running simctl-erase, idb-crash-delete or idb-clear-keychain, and run
simctl-list freely. Build, test, audit and crash tools also declare an outputSchema and return
validated structuredContent.
81 tools. TOOL_SIGNATURES.md indexes every tool with its annotations;
parameters come from the server itself via rtfm({ toolName: "..." }).
| Area | Tools |
|---|---|
| Build & test | xcodebuild-build, -test, -clean, -list, -version, -showsdks, -get-details, -inspect-scheme, -validate-capabilities |
| Simulators | simctl-list, -get-details, -suggest, -health-check, -boot, -shutdown, -create, -delete, -erase, -clone, -rename, -duo |