iPhone MCP
v1.3.0See and control a real iPhone over USB or Wi-Fi: screenshots, UI tree, taps, swipes, typing, apps.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
iphone_status
Report the iPhone connection and state: which iPhone this server controls (name, model, UDID) and its iOS version, connection route (USB or Wi-Fi), screen size in points, whether it is locked, whether keep-awake is on, and the foreground app. Use it first in a session and whenever an action fails, to decide whether to call iphone_start_agent (no connection) or ask the user to unlock (locked). With several iPhones there is one server per iPhone; the UDID tells which one this is. Reads only; changes nothing on the phone.
iphone_start_agent
Start WebDriverAgent on the iPhone and connect to it – required before any other iphone_* action. Call it when iphone_status or another tool reports no connection. It is safe to call again: if the agent already runs it just reports the connection. Starting takes 10–90 s, works over cable or Wi-Fi and needs the iPhone unlocked; if it is locked, the result says so and the user must unlock it. Returns the connection route on success or a concrete reason on failure.
iphone_stop_agent
Stop WebDriverAgent on the iPhone and close the connection. Use it when the session is finished, so the automation port on the phone is no longer open. Afterwards every other iphone_* tool fails until iphone_start_agent is called again. Leaves apps and data untouched.
iphone_list_devices
List the iPhones this computer can reach: name, model, iOS version, UDID, route (cable / Wi-Fi), whether `iphone-mcp setup` was run for it, and which one this server controls right now. Use it before iphone_select_device, or when iphone_status shows a different iPhone than expected. Reads only; changes nothing.
iphone_select_device
Switch this server to another iPhone; every following iphone_* call acts on that one. Use it when several iPhones are connected and the user names another one. The iPhone must have been set up with `iphone-mcp setup`. Not allowed when an admin pinned the server to one iPhone (IPHONE_MCP_UDID) or while this server still runs WebDriverAgent on the current iPhone – call iphone_stop_agent first. After switching, call iphone_start_agent if the new iPhone has no agent running.
| Parameter | Type | Description |
|---|---|---|
udid * | string | UDID of the iPhone to control, as shown by iphone_list_devices. |
iphone_keep_awake
Turn the no-auto-lock behaviour on or off for this session. It is on by default. While on, an invisible touch just outside the screen is sent every 10 s, which iOS counts as activity; no settings are changed and it ends with the session. Turn it off if the user wants the phone to lock. It cannot unlock a phone that is already locked – use iphone_lock for that.
| Parameter | Type | Description |
|---|---|---|
enabled * | boolean | true keeps the screen from auto-locking during this session (default); false lets it lock normally. |
iphone_screenshot
Capture the current iPhone screen as a JPEG image scaled to iOS points, plus its size. Because the image is in points, any pixel position in it can be passed unchanged to iphone_tap or iphone_swipe. Use it to see visual content (images, colours, layout, games). To find buttons or read text, iphone_ui_tree is cheaper and gives exact positions. Reads only; adds a note if the phone is locked.
| Parameter | Type | Description |
|---|---|---|
quality | integer | JPEG quality from 20 to 95; lower is smaller and cheaper. |
iphone_ui_tree
List the visible UI elements of the current screen as text, one per line: [Type] "label" value=… @(center x,center y) width×height, indented by nesting, all in iOS points. Prefer this over iphone_screenshot to find buttons, fields and text and to read values: it is cheaper and positions are exact. Pass the center point to iphone_tap, or use iphone_tap_text with the label. Reads only; adds a note if the phone is locked.
| Parameter | Type | Description |
|---|---|---|
max_lines | integer | Maximum number of elements to return (10–1000); the rest is cut off with a count. |
iphone_wait_for
Wait until an element with the given text appears on screen (or disappears with gone=true). Use it after an action that triggers loading, navigation or an animation, instead of guessing a delay or taking repeated screenshots. Polls about twice a second and returns as soon as the condition holds, with the element's position, or reports a timeout. Reads only.
| Parameter | Type | Description |
|---|---|---|
text * | string | Text to wait for, matched case-insensitively against element labels, names and values. |
exact | boolean | true requires the whole label to equal the text instead of containing it. |
gone | boolean | false waits until the text appears; true waits until it disappears (e.g. a spinner or 'Loading'). |
timeout | number | Maximum seconds to wait (1–60). |
iphone_tap
Touch the screen at a coordinate: single tap, double tap or long press. Use it when you know the position – from iphone_ui_tree (center point) or iphone_screenshot (pixel = point). To hit an element by its visible text, iphone_tap_text is more robust. The touch acts on whatever is at that point, like a finger would; it does not wait for the app to finish reacting, so look again (or call iphone_wait_for) before the next step.
| Parameter | Type | Description |
|---|---|---|
x * | number | Horizontal position in iOS points, from the left edge (0) to the screen width shown by iphone_status / iphone_screenshot. |
y * | number | Vertical position in iOS points, from the top edge (0) to the screen height shown by iphone_status / iphone_screenshot. |
gesture | string | 'tap' = single tap (buttons, links, fields); 'double' = double tap (zoom, select a word); 'long' = touch and hold (context menus, moving icons). |
hold_seconds | number | How long to hold for gesture='long' (0.3–10 s). |
iphone_tap_text
Find a visible element by its text and tap, double-tap or long-press its center. Prefer this over iphone_tap for buttons, cells and links with a label: it does not depend on layout or screen size. If nothing matches, it says so and taps nothing; with several matches it reports how many there are so you can pick another with `index`. Like a finger tap, the effect depends on the element.
| Parameter | Type | Description |
|---|---|---|
text * | string | Visible text of the element to tap, matched case-insensitively against its label, name and value. |
exact | boolean | true requires the whole label to equal the text instead of containing it. |
gesture | string | 'tap' = single tap; 'double' = double tap; 'long' = touch and hold, e.g. for the context menu of a message, photo, link or app icon. |
hold_seconds | number | How long to hold for gesture='long' (0.3–10 s). |
index | integer | Which match to tap when several elements match, 0 = topmost on screen. |
iphone_swipe
Drag one finger from a start point to an end point, or open an iOS system panel. Use coordinates for precise drags: sliders, reordering, swiping a cell to reveal actions, a sheet. Use `system` to read or act on notifications or toggles in Control Center. To switch apps use iphone_launch_app (iOS ignores synthesized swipes from the bottom edge, so there is no app switcher). For plain scrolling of a list or page, iphone_scroll is simpler. Coordinate swipes starting at the very bottom or top edge trigger iOS system gestures too.
| Parameter | Type | Description |
|---|---|---|
duration_ms | integer | Duration of the movement in milliseconds (50–5000); short is a flick, long is a drag. |
system | Instead of coordinates, do the edge swipe that opens an iOS panel: 'notification_center' (notifications, from the top left) or 'control_center' (toggles, from the top right). Close a panel with iphone… | |
x1 | Start x in iOS points (not needed with system). | |
x2 | End x in iOS points (not needed with system). | |
y1 | Start y in iOS points (not needed with system). | |
y2 | End y in iOS points (not needed with system). |
iphone_scroll
Scroll the content in the middle of the screen in a direction. Use it to reach items outside the visible area of lists, pages and carousels, then call iphone_ui_tree again. It starts in the screen center, so it never triggers system edge gestures; for exact drags use iphone_swipe.
| Parameter | Type | Description |
|---|---|---|
direction * | string | Where to move the view: 'down' reveals content further down (finger moves up), 'right' reveals content to the right. |
amount | number | Distance as a share of the screen size, 0.1–0.9. |
iphone_pinch
Two-finger gesture: pinch to zoom in or out and/or rotate, e.g. in Maps, Photos or a web page. Use it only where content is zoomable or rotatable; elsewhere it usually has no effect. Single-finger gestures are covered by iphone_tap, iphone_swipe and iphone_scroll.
| Parameter | Type | Description |
|---|---|---|
rotation | number | Turn the two fingers by this many degrees during the gesture, positive = clockwise (-180–180), e.g. to rotate a map or photo. |
scale | number | Zoom factor: above 1 zooms in (fingers apart, e.g. 2.0), below 1 zooms out (fingers together, e.g. 0.5), 1 keeps the distance (rotate only). Range 0.2–5. |
x | Center x in iOS points; default is the screen center. | |
y | Center y in iOS points; default is the screen center. |
iphone_drag
Touch and hold an item, move it and drop it: rearrange home-screen icons, reorder list rows, drag text, files or photos, move a slider precisely. Unlike iphone_swipe, the finger first rests on the start point, so iOS picks the item up instead of scrolling. Look again afterwards: whether the item moved depends on the app.
| Parameter | Type | Description |
|---|---|---|
x1 * | number | Start x in iOS points (where the finger touches and holds). |
x2 * | number | End x in iOS points (where the item is dropped). |
y1 * | number | Start y in iOS points. |
y2 * | number | End y in iOS points. |
duration_ms | integer | Duration of the movement in milliseconds (100–10000). |
hold_seconds | number | How long to hold before moving (0.1–5 s); iOS needs about 0.5 s to pick an item up. |
iphone_type
Type text into the text field that currently has keyboard focus, or replace or clear its content. Tap the field first (iphone_tap_text or iphone_tap) so the keyboard is open; without a focused field the call fails. By default text is appended at the cursor; replace=true empties the field first. Never use it for passwords or passcodes – ask the user to enter those.
| Parameter | Type | Description |
|---|---|---|
text * | string | Text to type, exactly as it should appear. Use \n for a line break. |
replace | boolean | true clears the focused field first, so the text replaces its content; with text '' it only clears the field. |
submit | boolean | true presses Return after typing (send a search, confirm a form). |
iphone_press_button
Press a hardware button of the iPhone. iPhones have no back button: to go back inside an app, tap its back button (often top left, see iphone_ui_tree). To leave an app or close an open system panel use 'home'; to quit an app completely use iphone_close_app; to lock the screen use iphone_lock. Notifications and Control Center open with iphone_swipe(system=…).
| Parameter | Type | Description |
|---|---|---|
button * | string | 'home' returns to the home screen (leaves the current app running in the background); 'volumeUp' / 'volumeDown' change the volume by one step. |
iphone_lock
Lock the iPhone, or wake and unlock it. 'unlock' completes on phones without a passcode, or when the owner turned on auto-unlock in a terminal (then iphone-mcp enters the stored passcode itself, once). Otherwise it wakes the screen and reports that the user must unlock – never try to enter a passcode yourself. Use iphone_status to see the current lock state and iphone_keep_awake to prevent auto-lock.
| Parameter | Type | Description |
|---|---|---|
action * | string | 'lock' turns the screen off and locks; 'unlock' wakes the screen and swipes to unlock. |
iphone_alert
Read or answer the alert or permission dialog on screen (location, notifications, camera, tracking, 'Open in app?', error messages). Read first, then accept or dismiss – or tap one named button. Permission dialogs change privacy settings: ask the user before allowing access to location, contacts, photos, camera or microphone. If no alert is shown it says so and taps nothing.
| Parameter | Type | Description |
|---|---|---|
action | string | 'read' returns the alert's text and buttons without touching it; 'accept' taps the confirming button (e.g. 'Allow', 'OK'); 'dismiss' taps the cancelling one (e.g. 'Don't Allow', 'Cancel'). |
button | Exact label of the button to tap instead of the default one, as listed by action='read'. |
iphone_set_clipboard
Put text on the iPhone's clipboard, so it can be pasted (long-press a field → Paste). Faster than iphone_type for long text and keeps formatting such as line breaks. It replaces what the user had copied. iOS only lets the automation agent write the clipboard while it is in front, so the screen switches to it for about a second and then back to the app that was open. Reading the clipboard is deliberately not offered: it often holds passwords or private text.
| Parameter | Type | Description |
|---|---|---|
text * | string | Text to put on the iPhone's clipboard (up to 100,000 characters). |
iphone_list_apps
List the apps installed on the iPhone as 'Name — bundle ID' lines, sorted by name. Use it to find the exact bundle ID or name for iphone_launch_app / iphone_close_app when a name is ambiguous or not found. Needs the cable or Wi-Fi sync; otherwise it lists the built-in Apple apps it knows. Reads only.
| Parameter | Type | Description |
|---|---|---|
filter | Only list apps whose name or bundle ID contains this text (case-insensitive). |
iphone_launch_app
Open an app, or bring it to the front if it is already running (its state is kept). Faster and more reliable than finding and tapping its icon on the home screen. To start an app fresh, call iphone_close_app first. To open a specific page or link inside an app, use iphone_open_url. Device settings (Wi-Fi, brightness, appearance, …) are changed in the Settings app ('settings'), or quickly via iphone_swipe(system='control_center'); ask the user before changing account or security settings.
| Parameter | Type | Description |
|---|---|---|
app * | string | App name as shown on the home screen (e.g. 'Settings', 'Einstellungen', 'Safari') or bundle ID (e.g. 'com.apple.Preferences'). |
iphone_close_app
Force-quit an app, like swiping it away in the app switcher. Use it to reset an app to a fresh start or to stop something running. Unsaved input in that app (for example a half-written message) can be lost, so prefer iphone_press_button('home') to just leave it.
| Parameter | Type | Description |
|---|---|---|
app * | string | App name as shown on the home screen (e.g. 'Settings', 'Einstellungen', 'Safari') or bundle ID (e.g. 'com.apple.Preferences'). |
iphone_open_url
Open a web page in Safari or a deep link in the app that handles it. Use it to jump straight to a page or screen instead of navigating by taps. Links with tel:, sms:, mailto: or payment schemes start real actions or drafts on the phone – ask the user first. iOS may show a confirmation dialog; check with iphone_ui_tree afterwards.
| Parameter | Type | Description |
|---|---|---|
url * | string | Web URL (https://…) or deep link with an app scheme (e.g. maps://?q=Berlin, mailto:…, or an app's own scheme). |
iphone_batch
Run a known sequence of actions in one call, e.g. open an app, tap through a menu, type and submit, then look once at the end. Each step is a normal iphone_* tool call with the same arguments and the same admin policy checks, so nothing is possible here that is not possible step by step. Use iphone_wait_for steps to wait for a screen instead of fixed pauses. The batch stops at the first failed step (unless it is optional or stop_on_error is false), when the iPhone gets locked, or after 300 s, and reports every step's result. Use it only for steps you are sure of; when…
| Parameter | Type | Description |
|---|---|---|
steps * | array | 1–50 steps run in order, each one tool call. |
finish | string | What to return after the last step: nothing more, the UI tree, or a screenshot. |
stop_on_error | boolean | true stops at the first failed step that is not marked optional. |