Drives a physical iPhone to operate iOS apps without APIs, export on-phone data, and perform taps/typing/scrolling. Replays saved per-app flows and supports XCTest, HTTP agent, or MCP server.
Ships in iPhone Use. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
The iphone-use daemon drives a
physical iPhone through its own XCTest device runner. This runner replaced
WebDriverAgent in v0.14.0; it does not use iPhone Mirroring. The HTTP interface
is WebDriverAgent-compatible (its /wda/... routes). It never touches the Mac's screen or
cursor. Use the HTTP API below or the bundled MCP server (phone_* tools); the
loop is the same. Details live in the reference: curl -s -H "$AUTH" "$HOST/agent/reference" serves the copy that matches the running daemon
(sections below are named by heading; also
docs/agent-reference.md).
HOST="${IPHONE_USE_URL:-http://127.0.0.1:44321}"
AUTH="Authorization: Bearer $IPHONE_USE_TOKEN" # daemon password or IPHONE_USE_AGENT_TOKEN
MUTATION="X-Phone-Control: 1" # required on every state-changing POST
OWNER="X-Phone-Owner: <your-session-name>" # MCP sends this for you
curl -s -H "$AUTH" "$HOST/agent/status" # probe first; on failure follow recovery below
Probe. If the user names a phone or multiple phones are installed, first
use phone_instances, then pass that instance on every MCP read/action.
Omitted instance reports only the configured daemon, never all phones.
GET /agent/status / phone_status. Screen reads and UI input
require drivable:true; otherwise pause those operations and follow the recovery steps below.
Paired metadata reads (phone_home_layout, phone_apps) and cached capability
discovery do not require a running Runner. Use them without reconnecting or
opening Home, and respect any private-hold refusal. A phone released
after the last task comes back by itself: the next MCP phone tool
(phone_elements, phone_tap, phone_run_steps, …) reconnects, waits, and
answers phone_not_ready with what to do when a person must act (enter the
passcode on the phone). Reconnect by hand once (phone_reconnect, with
wait_secs to block until drivable or a blocker / POST /agent/mode {"mode":"agent"}) only when the user's current task needs the phone and no
tool brought it back, never for a health check: each runner launch can make
the operator type the passcode. If owner is another
session, do not drive. → reference: Phone states and recovery
Look for a saved flow first. Entering an app — a launch_app response,
or the first /agent/elements read in a newly entered app — carries a
registry block listing the saved flows for it. If one does the task, run
it with phone_flow_run: one call instead of dozens, no screenshots.
phone_flow_list / iphone-use-mcp flow list --app <bundle> shows them
all. Check risk and compat before running. → reference: Flows
"$HOME/Applications/iPhoneUse.app/Contents/MacOS/iphone-use-mcp" flow run system/spotlight-search --input query=Health
No flow? Hand a clear goal to Jev. phone_jev_run /
iphone-use-mcp jev run --goal "…" [--app <bundle>] runs a fast on-phone
agent (TypeSafe's Jev picks each step, ~1–2 s/step, no model turns) and
returns done / blocked with its step history. Confirm goals that send,
pay or delete with the user first; check the end screen yourself.
Otherwise act in batches, not taps. Every call costs you a full turn;
the phone takes ~0.5 s. Open the app with launch_app, read
GET /agent/elements once, then send everything you can already see how to
do as ONE batch (POST /agent/actions / phone_run_steps, up to 24 steps,
wait_for after each screen change) with observe:true (MCP default): the
reply carries the screen the batch ended on, so you decide the next batch
without another read. If you will think between batches for more than a
minute, phone_hold keeps the runner from being released. Single taps (element + snapshot, unique label,
locator) are for exploring a screen you have not read yet; after three in a
row the daemon says so (batch_hint).
Verify each step against your postcondition: MCP act tools observe by
default (HTTP: ?return=delta) and return the settled change in the same
call; the settled screen is captured too, and phone_screenshot returns it
instantly — look only when the text is not enough. ok:true means
the action was sent, not that it achieved anything.
→ reference: Reading results
Offer to save it. When a response carries flow_suggestion, or you
finish a multi-step task that no flow covered, ask the user whether to
keep it as a flow. Only if they agree: get the draft
(phone_flow_draft(save_as=…) / flow draft --out … /
GET /agent/flow/draft), fix its todo list, validate it, and run the file
once. Publishing opens a public PR, so ask again before
phone_flow_publish(confirm=true). → reference: Saving a flow
When the task is done, release the phone: phone_release_owner /
POST /agent/owner {"release":true}. That also stops the device runner right
away, so the phone leaves automation mode until the next task needs it. If a response carried agent_focus, the
phone is on Do Not Disturb for your session: tell the user, and releasing turns
it off again.
Only recover a phone for an unfinished task that authorizes its use. For a health check, report status and stop. Run host commands on the daemon's Mac, not an unrelated remote MCP client.
target_configured:false with recovery_owner:unconfigured is an unselected
target, not proof that connected
phones are offline. phone_instances lists installed daemon instances,
not paired phones. Inspect xcrun devicectl list devices and run
iphone-use doctor yourself. Match the user's named phone; if several
targets are plausible, ask which one. Never select by list order.IPU_RUNNER_UDID=<UDID> iphone-use setup (add
--instance NAME for a named instance). Do not change another instance,
use --force, clear a private hold, or take over another owner.
recovery_owner:external means recovery belongs on the owning host; do not
configure or restart a local runner for it. With an
already configured phone, follow setup_blocked_on, next_step and
recovery; reconnect once only when the task needs it, recovery_owner is
daemon, and no blocker, handoff, or reconnect is in progress.trust, distinguish computer pairing from certificate approval:
the person confirms Trust This Computer on the phone if that prompt
appears. For an untrusted Apple Development certificate in setup_message,
the person uses iPhone Settings > General > VPN &
Device Management > the matching Apple Development certificate > Trust.
This is separate from Trust This Computer. If there is no certificate
or prompt, inspect doctor output and runner logs; do not assume a popup
exists or retry trust by restarting the runner.needs_passcode_on_phone blocker does not confirm a currently visible
prompt. Wait for the person, then check phone_status; drivable:true
is current readiness, not a guarantee that iOS will never ask again.| What | HTTP /agent/input type | MCP | Flow / batch step kind |
|---|---|---|---|
| Find an app's bundle id | GET /agent/apps?query=微信 | phone_apps | — |
| Open an app | launch_app bundle (or name for built-ins, or app: any app's exact name, or a loose name matching exactly one installed app — resolved says which; refused with candidates if ambiguous) | phone_run_steps step | launch_app (bundle or app) |
| Read home pages, Dock and folders | GET /agent/home-layout?page=0 (omit page for all) | phone_home_layout (page?) | — |
| Read this client's task timing | GET /agent/metrics?owner=<current-owner> | phone_metrics (limit?) | — |
| Read the screen | GET /agent/elements | phone_elements | wait_for (application, present, absent; on canvas/game screens ocr_present / ocr_absent, up to 60 s) |
| Tap an element | tap + element + snapshot | phone_tap_element | tap_locator (durable) |
| Tap a unique label | tap + label | phone_tap_label | tap_label |
| Tap by locator | tap_locator + locator | phone_run_steps step | tap_locator |
| Tap a point | tap + x,y | phone_tap | tap |
| Type | text (up to 20000 scalars; optional budget_ms 6000..15000 requires inputContinuation; use a returned continue_token alone, once; uncertain delivery requires inspecting the original field, never replaying the whole text) | phone_type | type (input names a runtime value) |
| Key | key return… | phone_key | key |
| Home / Spotlight / Lock / Photos capture / physical volume | shortcut (home, spotlight, lock, save_screenshot, volume_up, volume_down) | phone_shortcut | shortcut |
| Scroll | scroll dy (80 ≈ 15% of a screen, 400 ≈ 75%) | phone_scroll (x, y, dx, dy required) | scroll (x, y, dx, dy required in MCP batches) |
| System alert | alert button / action | phone_run_steps step | alert |
| App asks you to log in | POST /agent/login (iphone-use auth login --bwu) | phone_login | — |
| Switch / slider | perform toggle / adjust | phone_run_steps perform step (element + snapshot) | — |
save_screenshot requests a new image in Photos; its acknowledgement is not independent save verification. Complete an existing system preview without taking another capture.
Volume shortcuts require a physical device and an explicitly capable Runner. Acknowledgement confirms a button request, not the audible volume level. Never repeat an uncertain volume action.
For a drag that needs an edge hover, a drag step can use
points: [{x, y, dwell_ms}, …] instead of x1/y1/x2/y2. Use 2–16 points from
the current screen. The same finger stays down through each dwell;
duration_ms is travel time per segment and total hold/travel/dwell <= 10s.
Flow drafts retain the full path. Verify the end screen before the next action.
All actions, including swipe, drag, picker, set_value and the scroll variants, are listed in the reference: Actions catalogue.
HTTP /agent/input supplies defaults for omitted scroll anchors and dx.
MCP phone_scroll and phone_run_steps scroll steps require all four fields.
Choose normalized x/y inside the intended scroll area on the current screen.
For a center anchor verified from that screen, the MCP batch shape is:
{"steps":[{"kind":"scroll","x":0.5,"y":0.5,"dx":0.0,"dy":80.0}]}
curl -s -H "$AUTH" -H "$MUTATION" -H "$OWNER" -X POST "$HOST/agent/input" \
-d '{"type":"launch_app","bundle":"com.apple.Health"}' # response may carry `registry`
curl -s -m 40 -H "$AUTH" "$HOST/agent/elements" # give it ≥40s
curl -s -H "$AUTH" -H "$MUTATION" -H "$OWNER" -X POST "$HOST/agent/input?return=delta" \
-d '{"type":"tap","element":3,"snapshot":"<from that read>"}'
curl -s -H "$AUTH" -H "$MUTATION" -H "$OWNER" -X POST "$HOST/agent/actions" -d '{"steps":[
{"kind":"action","action":{"type":"tap_locator","locator":{"label":"资料","kind":"Button"}}},
{"kind":"wait_for","expect":{"present":[{"label":"导出所有健康数据"}]},"timeout_ms":8000}]}'
| Don't | Do instead |
|---|---|
| Tap coordinates guessed from a screenshot | Read phone_elements, tap by element + snapshot or by label |
| Take a screenshot after every step | observe:true / ?return=delta returns the change |
| One tap per call when the next steps are visible | One phone_run_steps / /agent/actions batch with wait_for |
sleep a fixed number of seconds | wait_for with present / absent / application (ocr_present when the screen is a canvas) |
Type a password with phone_type | It is refused (secure_field_use_set_value): use set_value with the field's element and snapshot (it types the value in itself when a web view ignores the write; 409 value_not_applied means the field stayed empty), or phone_login |
| Search in the system file picker (Files / document picker) | Its search field takes focus in another process, so typing is refused (no_focused_field); open folders with element taps instead |
| Several phone tools in parallel in one turn | One action at a time per phone: parallel calls run in no fixed order and their observe results overlap; put several actions in one batch |
A wait_for longer than 30 s or a pause longer than 3 s | Both are refused before anything is sent. wait_for timeout_ms is at most 30000 (60000 for ocr_*); pause / after_ms at most 3000; all waits in one batch add up to at most 60000. Split a longer wait into several batches |
| Tap a system alert's button | The alert action (button or action) |
| Tap a switch or slider | perform toggle / adjust |
Resend after outcome_unknown or retry_safe:false | Read the screen first; the phone may already have acted |
Repeat an action that came back no_progress | Re-read the screen, then a different control or a wait_for |
| Reconnect to check health | phone_status; reconnect only when the task needs the phone |
| Type without checking focus | Confirm the foreground app and focused field, then type |
| Repeat a label that was not found | Use the did you mean label the error offers, or re-read |
Task metrics: iphone-use metrics / GET /agent/metrics count HTTP calls, not
model turns. To count one task exactly, wrap it in phone_run_start /
phone_run_end (HTTP: POST /agent/run). GET /agent/elements?scope=app
(or interactive, focused, changed&since=…) returns a smaller view of the
same read; ?image=auto adds a screenshot only when the tree is unusable.
MCP screen text includes at most 200 rows and 32 KiB of row text. When it
reports omitted rows, narrow phone_elements with query/limit; an omitted
target is not proven absent and a truncated list is not proven complete.
Use the displayed #N with its snapshot: it is the original full-tree index.
To inspect off-screen/not-drawn rows beyond the five-label summary, call
phone_elements with include_hidden: true (combine with query/limit
to stay within the text budget). These rows are marked hidden; scroll them
into view and read again before acting.
→ reference: Task metrics, runs and advice
Home-screen organization: use phone_home_layout before opening folders or
swiping through pages. It reads persisted pages, Dock, folder contents and widget
stacks without moving any icon. Page/row/col indexes are zero-based. Pages include hidden/Focus-filtered pages,
so page indexes are not the visible page-control numbers. Positions
are derived from icon order and grid metrics; unknown sizes make positions null
and positions_complete:false. They are not pixel coordinates or permission to
restore a layout. Re-read after a drop, then use live elements for gestures.
{
"version": 1,
"name": "New note",
"app": "com.apple.mobilenotes",
"risk": "navigation",
"locale": "zh-CN",
"inputs": { "body": { "type": "string", "description": "note text" } },
"steps": [
{ "kind": "launch_app", "bundle": "com.apple.mobilenotes" },
{ "kind": "wait_for", "expect": { "application": "备忘录" }, "timeout_ms": 15000 },
{ "kind": "tap_locator", "locator": { "label": "新建备忘录", "kind": "Button" } },
{ "kind": "type", "input": "body" }
]
}
The full field list, compat values, and publish and report steps are in reference: Flows.
retry_safe:false or outcome_unknown means do not replay. The phone may
already have acted. Read the screen first; never resend text, send, pay or
delete blindly. The same applies to a failed flow. A fresh launch can return
app_launch_interrupted after the terminate request was acknowledged; inspect
app_lifecycle and current status before continuing, never replay the whole
fresh launch. launch_attempted records an attempt, not verified delivery;
a missing field does not mean false.risk: side_effect and destructive taps need the user's explicit OK on
the exact target and inputs (confirm=true / --confirm). Never operate
payment or 2FA screens unattended.\n in typed text is Return: send one line
unless the user wants breaks. → reference: Chat apps: multi-line messagesalert action. Taps on alert buttons ACK but often
do nothing. Switches need perform toggle. Verify the new
value either way.X-Phone-Owner. On 409 phone_owned, wait;
never take over unless the user says the other session is abandoned. Release
your lease when done.phone_login / iphone-use auth login --bwu. It
fills the user's own vault entry inside the daemon. Never ask for, type or
repeat a password or code yourself; never sign up, change a password or pay.
Face ID, a PIN, a code or a login phone_login cannot finish: stop, take
phone_hold(secs, private=true) so nothing reads the screen meanwhile, ask the
user with the host's question tool (plain text if there is none or it is
unavailable right now) and wait, then clear the hold and re-read the screen. → reference:
When the person has to sign inA file the task needs on the Mac comes over by AirDrop and lands in
~/Downloads (reference: Getting files from the phone to the Mac).
If the screen changes under you (app_changed, a banner, a person using the
phone), stop and re-read before continuing the old plan. If the skill
disagrees with the live API, it is probably stale; see
reference: Upgrade. If something in iphone-use itself is broken or
confusing, offer to file an issue (reference: Filing issues).
For a simultaneous hold use phone_run_steps with
{"kind":"multi_longpress","points":[{"x":0.3,"y":0.5},{"x":0.5,"y":0.5},{"x":0.7,"y":0.5}],"duration_ms":1500}.
The 2–5 distinct normalized points determine the finger count. Duration is
1–10000 ms (default 1000). HTTP action bodies use type:"multi_longpress";
saved flows use kind. Never send fingers:3 with ordinary longpress.
App-specific gesture recognition requires real-device verification.
To zoom a photo cropper or map, pinch: {"kind":"pinch","x":0.5,"y":0.5,"scale":0.7}
(scale <1 zooms out, >1 zooms in; 0.2–5; optional angle, spread, duration_ms
100–2000). Repeat the step for more zoom. HTTP uses type:"pinch".
Jev retries only one observation on HTTP 504 runner_source_timeout, after
the server's 1–60 second retry_after_secs. It never replays the preceding
action. If post-action observation recovery fails, inspect status:"blocked",
history, and last_successful_action, then read before acting again.
Use phone_instances for a read-only local instance inventory. Pass instance
(e.g. i13, default) on each other phone_* call to address that daemon.
Keep it consistent across reads and actions; omitted instance preserves the
MCP server's startup configuration. No target is changed and no unavailable
instance falls back to another phone. Do not read tokens or hand-write HTTP just
to switch instances. Discovery never reconnects; ordinary ownership, privacy,
lock and phone-ended/human-handoff rules still apply. Runtime selection supports
installed local LaunchAgents; simulator-only records remain separate.
When a task needs the complete value of one non-secure field, use
phone_read_value with its fresh identifier or exact label. Check the returned
completeness and UTF-16 limit. A truncated preview is not a full value; secure or
unsupported fields require a permitted alternative. Ownership/privacy changes
withhold results. This read does not focus, unlock, or claim control.
When an export needs an explicit file, check iphone-use files --help. With
Runner Files enabled, use the source app's native Save to Files UI, finish the
save into the Runner inbox, then receive that exact filename:
iphone-use files receive --device '<selected-udid>' --bundle '<installed-runner>.xctrunner' \
--instance '<selected-instance>' --owner '<your-existing-lease-owner>' \
--filename '<exact-saved-name>' --destination '<absolute-mac-folder>'
Use your own lease, the selected instance and verified bundle ID. This command
does not acquire someone else's control or establish that a source writer has
finished. Its current checks require a wired connection but do not lock the
transport. Confirm committed:true; retain the transfer ID and digest. After
interruption, use iphone-use files result with the same device, bundle,
instance, state directory and transfer ID. An unknown outcome requires
inspection before another receive. files stop requests receiver cancellation.
The receiver remains a candidate with documented checkpoint and upgrade gaps.
phone_subtree(element, snapshot) reads a unique native element's descendants.
Read complete/coverage; its local row positions are read-only and cannot be
used as action refs. Use locators or fresh phone_elements refs for input.
Older runners explicitly refuse this operation.
action_evidence separates delivery from postcondition verification. A native
ACK is not application success; even verified element values do not establish
saving or submission. Errors carry recovery.action.next_step and
retry_allowed. Never replay partial or uncertain requests.
For delayed loaders use expect.absent_after_present:true with absent or
ocr_absent: every target must appear during this wait before absence counts.
A loader never observed causes timeout; ordinary absence checks omit the flag.
phone_run_start(trace=true) enables a redacted, owner-scoped timeline for this
run. Read it with phone_run_trace(run_id) and close with phone_run_end.
It is bounded memory, lost on restart, and contains no input values, labels,
URLs or screenshots. It supports inspection, never automatic action replay.
Native per-element enabled/editable/frame checks require an updated runner.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
2 skills in this plugin
/iphone-use:iphone-usefrom iPhone Use
npx claudepluginhub leeguooooo/iphone-use --plugin iphone-useOther plugins' skills for the same job