Skip to content

Control a real USB-connected iPhone from Linux (no Mac, no paid developer account) and expose it to AI agents as MCP tools

9.1 KB
Raw Blame

Tools

The MCP server provides 18 tools, 24 with the developer tools. Coordinates are in points, matching the pixels of a full-screen screenshot (430×932 on an iPhone 15 Pro Max), so the agent can tap what it reads off a screenshot. Coordinates follow the screen orientation: after a rotation the same spot has different coordinates, so take a new screenshot. Screen sizes differ per device; an iPad mini 5 is 768×1024 in portrait.

Looking at the screen

Tool What it does
iphone_status Ready or not, native or WDA, locked or not, foreground app, screen size
iphone_screenshot Screenshot; with x, y, width, height it returns an enlarged region for small text and icons
iphone_list_elements Elements with text: type, text, center, size; filter by text or type. Structured output includes matched_count in the observed tree and truncated when limit omitted matches. These fields are also returned with action and batch then: "elements".
iphone_wait_for Wait for text to appear by default. With state: "disappeared", wait for a screen without a match. Edited values in input fields do not count. timeout defaults to 5 seconds, max 30
iphone_list_apps Installed apps; read-only, no then

With auto-unlock on, iphone_screenshot, iphone_list_elements and iphone_wait_for also unlock a locked phone first. They are marked read-only because they don't change what's on screen. iphone_status and iphone_list_apps don't unlock it.

Acting

Tool What it does
iphone_tap Tap coordinates; count taps the same point several times (double tap, entries that need quick repeated taps)
iphone_scroll_collect Scroll through a list, collect matching rows and optionally stop when text appears. Swipes in the middle of the screen; on an iPad split view (Settings, Mail) x picks the column to scroll, such as the sidebar. On pause or takeover, a connected caller receives the rows collected so far and the stop reason interrupted. The phone stays on the final viewport.
iphone_tap_element Tap by text; if the center is covered by a floating bar or the keyboard it taps a visible part, and if it's fully covered it doesn't tap. With scroll (down / up) it scrolls slowly and looks again when the element isn't on screen, until it is found, the list ends or max_scrolls (default 8) is reached
iphone_long_press Long press; seconds defaults to 1, max 10
iphone_swipe Swipe; returns once the list has stopped scrolling. seconds defaults to 0.3, max 10. hold holds still at the start for that many seconds before moving, to drag things that need a long press first (home-screen icons, reorderable rows); about 0.6 works
iphone_type_text Type into the focused field (Chinese supported), read it back and fix dropped characters; submit presses Return. With native control, replace: true replaces the text of a focused, readable field (empty text empties it) and verifies the whole value before pressing Return
iphone_press_button home, volume_up, volume_down, lock
iphone_launch_app / iphone_terminate_app Launch / quit an app by name (e.g. 设置) or bundle id
iphone_open_url Open a link or URL scheme
iphone_batch Run up to 20 steps in one call, stopping at the first error. When every step is a coordinate tap, one_gesture taps them in turn within one gesture, for pressing keys on one keyboard. If the MCP client cancels the call, the remaining steps don't run; with no device selected, it also stops with an error if the controlled device changes

Taps, long presses, swipes and text input report the delivery of the requested input in structuredContent.delivery. With not_sent you can reconsider the input and retry. With unknown, inspect the phone first because the input may already have taken effect. With sent, the input was dispatched. When using then, check readback separately.

Several devices

Only one device is controlled at a time; every other tool acts on it. With one device connected you can ignore these.

Tool What it does
iphone_list_devices Every iPhone/iPad on USB: name, model, iOS version, UDID; marks the one being controlled and whether it has an auto-unlock passcode
iphone_select_device Switch to another device (UDID or name), remembered across restarts; auto goes back to automatic choice. The new device is ready in seconds with native control, 10–60 s with WDA. Not possible when IPHONE_UDID is set

Details: Several devices.

Developer tools (opt-in)

Set IPHONE_CONTROL_DEV_TOOLS=1 for the MCP server to get six more tools. They are off by default, so agents that don't need them don't pay for their descriptions.

Tool What it does
iphone_app_logs Read the phone's log (default, Error and Fault levels; Debug and Info would slow the phone down), filtered by app or process, text and time. Recording starts with the first call: call it, reproduce the problem, call it again. The buffer is limited, and the result says how far back it reaches
iphone_crash_reports List crash reports, or read one
iphone_install_app Install a signed .ipa or .app (a path on the machine that runs the daemon)
iphone_uninstall_app Remove an app and its data. Takes only a bundle ID or the full display name (case-insensitive); anything else, or a name several apps share, is refused and the candidates are listed. Never the WebDriverAgent runner
iphone_web_targets List inspectable web pages and WebViews (Safari tabs, debug builds of hybrid apps); the app must be in the foreground
iphone_web_eval Run JavaScript in a page and get the result as JSON: faster, cheaper and more accurate than screenshots for web content

None of these tools unlock the phone. Read Security before turning them on.

See the screen after an action: then

The tools under Acting accept then: it waits for the screen to settle and returns it, saving a round trip.

Parameter Meaning
then elements (element list) or screenshot
then_filter Only elements containing this text (or of this type)
then_region Only an enlarged [x, y, width, height] region of the screenshot, e.g. a game board
then_settle How long to wait for the screen to settle, in seconds (default 1.5, max 10)

The result says how long it waited, whether the page is probably still loading, and whether a dialog is in the way. Even without then, it warns when a system alert covers the screen.

Native control and WDA

iOS 27 and later are controlled natively by default. The tools and their results are the same, so agents needn't care, with a few differences:

  • Rows off the screen aren't listed: scroll a long list to a row before finding or tapping it by text (WDA lists such rows but can't tap them).
  • Text is always pasted: iphone_type_text puts the text on the phone's pasteboard and pastes it; the daemon taps Allow Paste, reads the field back and restores the pasteboard at once.
  • Coarser elements: the accessibility service often makes one element of a whole row ("Wi-Fi, Derrors-5G"), so iphone_list_elements is shorter than with WDA; finding by contained text still works.

When WDA is down: the HID fallback

For devices on WDA only. When WDA can't be reached, screenshots, taps, swipes and buttons go through CoreDevice HID, with these limits:

  • It needs iOS 27 or later (that is, a device with ICTL_IOS_BACKEND=wda). Older iOS has no such path, and actions fail while WDA restarts.
  • Landscape: before each touch the screen is captured again to check its orientation, and the daemon also needs a matching orientation from WDA in the last 30 seconds. Without one, for example right after a daemon restart, the touch is refused rather than guessed. Screenshots and buttons still work. Don't flip the device to the other side during an outage; wait for WDA to recover first.
  • Screen size: while WDA is down, taps and swipes return an error if there is no record of this device's size. Wait for WDA to come up once, or set SCREEN_W/SCREEN_H.
  • No redo: if a request already reached WDA and the connection then dropped or the response was incomplete, it doesn't fall back to HID, because the action may have happened and redoing it would tap or type twice. The tool returns an error; the agent should take a screenshot first.

In an AI task: iphone_confirm

When the agent works in an AI task (one the control page gave it, or one task run started), its tool list has one more, iphone_confirm: before paying, deleting, sending a message or changing account or privacy settings it asks you with it and waits for your answer, on the control page or with iphone-control task approve/reject; when you reject, it stops and doesn't do the step. A task limited to some apps also stops and asks in any other app. While a task runs, other clients can look but not act on the phone.

All parameters: docs/tools.md in the repository.