device-mcp

v0.10.0
@metamask/device-mcp Checked 6 hours ago Published 3 days ago

MCP server for mobile device interaction — iOS (IDB), Android (ADB), and Appium/BrowserStack

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

device_snapshot Device Snapshot

Capture the current UI hierarchy from the device. Returns all visible elements with their types, labels, identifiers, values, frames, and enabled state. Call this FIRST to see what is on screen before interacting.

device_screenshot Screenshot

Capture a screenshot of the current device screen. Returns base64-encoded PNG data. Optionally saves to a file path.

ParameterTypeDescription
outputPathstringFile path to save the screenshot (optional)

device_info Device Info

Get information about the connected device: platform, name, OS version, device ID.

device_tap_element Tap Element

Find an element in the UI hierarchy by query and tap its center. Specify at least one of: label, identifier, text, type. Call device_snapshot first to see available elements.

ParameterTypeDescription
identifierstringAccessibility identifier (iOS) or resource-id (Android)
labelstringAccessibility label (iOS) or content-description (Android)
textstringVisible text content
typestringElement type/class name

device_tap_coordinates Tap Coordinates

Tap at exact screen coordinates. Use as a last resort when an element cannot be found by label/identifier/text. Get coordinates from device_snapshot frame data.

ParameterTypeDescription
x *numberX coordinate in pixels
y *numberY coordinate in pixels

device_type Type Text

Type text into the currently focused input field. Tap an input element first to focus it, then call this. The field is cleared before typing on all backends. An empty string only clears the field.

ParameterTypeDescription
text *stringText to type

device_swipe Swipe

Swipe on the device screen. Use natural scrolling: swipe "up" to scroll down. Optionally specify start coordinates and distance. Coordinates are logical points, not screenshot pixels. The gesture runs with a fixed 0.3s duration; command completion does not verify that content moved — confirm with a screenshot or snapshot.

ParameterTypeDescription
direction *stringSwipe direction
distancenumberSwipe distance in pixels (default: 500)
startXnumberStart X coordinate
startYnumberStart Y coordinate

device_long_press Long Press

Long press an element. Used for context menus, drag initiation, and other long-press interactions. Default duration is 1000ms.

ParameterTypeDescription
durationMsnumberPress duration in ms (default: 1000)
identifierstringIdentifier/resource-id
labelstringAccessibility label
textstringText content
typestringElement type

device_wait_for Wait For Element

Poll the UI hierarchy until an element matching the query appears (and, when it appears during the wait, stops moving). Useful for waiting on transitions, loading states, or navigation.

ParameterTypeDescription
identifierstringIdentifier/resource-id to match
labelstringAccessibility label to match
textstringText content to match
timeoutMsnumberMax wait time in ms (default: 10000)
typestringElement type to match

device_app_state App State

Get the current state of an app by bundle ID. Returns whether the app is running, installed, or not found.

ParameterTypeDescription
bundleId *stringApp bundle ID (e.g. io.metamask or io.metamask.debug)

device_open_app Open App

Launch or bring to foreground an app by bundle ID. iOS: bundle ID (e.g. io.metamask). Android: package name (e.g. io.metamask).

ParameterTypeDescription
bundleId *stringApp bundle ID or package name

device_close_app Close App

Force-stop an app by bundle ID. The app process is terminated.

ParameterTypeDescription
bundleId *stringApp bundle ID or package name

device_press_button Press Button

Press a device button. "enter" sends the Return key and can submit a form. iOS has no back button: "back" fails with UNSUPPORTED_ON_IOS; tap the screen's back control instead.

ParameterTypeDescription
button *stringButton to press

device_dismiss_keyboard Dismiss Keyboard

Hide the on-screen keyboard. Call after typing to reveal elements that may be obscured by the keyboard. On iOS this presses Return when a keyboard is shown (which can submit a single-field form) and does nothing otherwise. On Android it does nothing when no keyboard is shown, and fails when the keyboard is still shown after ESCAPE and BACK.

device_dismiss_alert Dismiss Alert

Accept or dismiss a system alert or permission dialog. Use accept=true for "Allow"/"OK", accept=false for "Deny"/"Cancel". Check device_snapshot first to confirm an alert is present.

ParameterTypeDescription
accept *booleantrue to accept (Allow/OK), false to dismiss (Deny/Cancel)

device_logs Device Logs

Capture recent device logs. iOS: system log via IDB. Android: logcat. Optionally filter by text pattern.

ParameterTypeDescription
durationSecondsnumberHow many seconds of logs to retrieve (default: 30)
filterstringText pattern to filter log entries

device_scroll_to_element Scroll To Element

Swipe until an element matching the query is inside the viewport (being in the UI tree is not enough), and report how many swipes it took. Fails when the element is not in view after maxAttempts swipes or the screen stops moving. Specify at least one of: label, identifier, text, type.

ParameterTypeDescription
directionstringFinger direction: "up" reveals content below, "down" content above. Default "auto": from where the element is, searching downward first when it is not in the UI tree yet.
identifierstringIdentifier/resource-id to match
labelstringAccessibility label to match
maxAttemptsnumberMaximum number of swipes (default: 10)
textstringText content to match
typestringElement type to match

device_get_alert_text Get Alert Text

Get the text content of the currently displayed system alert or dialog. Call this before device_dismiss_alert to understand what the alert says.

device_get_window_size Get Window Size

Get the width and height of the device screen in pixels (Android) or points (iOS).

device_context Context

List or switch between app contexts (NATIVE_APP, WEBVIEW, etc.). Use action=list to see available contexts, action=switch to change. On Android (adb), WEBVIEW appears when a debuggable in-app WebView is open; use webview_cdp to drive its DOM. On iOS, WebView contexts require the Appium backend.

ParameterTypeDescription
action *stringAction: list available contexts or switch to one
contextstringContext name to switch to (required for action=switch)

device_clipboard Clipboard

Read or write the device clipboard. Use action=get to read clipboard text, action=set to write. On Android (adb), only action=set is supported; reading requires the Appium backend.

ParameterTypeDescription
action *stringAction: get clipboard content or set it
textstringText to set on the clipboard (required for action=set)

device_screen_recording Screen Recording

Start or stop recording the device screen as an MP4 video. Call with action=start to begin, action=stop to end and save. Returns the file path on stop.

ParameterTypeDescription
action *stringAction: start or stop recording
outputPathstringFile path to save the recording (optional, for start)

device_generate_locators Generate Locators

Generate ranked locator suggestions for all interactive elements on the current screen. Each element gets a prioritized list: identifier (testID/resource-id) > label > text > type. Use this after healing to find the correct selector for updating test source code.

device_get_element_text Get Element Text

Find an element in the UI hierarchy by query and return its text content (label or value). Specify at least one of: label, identifier, text, type. Call device_snapshot first to see available elements.

ParameterTypeDescription
identifierstringAccessibility identifier (iOS) or resource-id (Android)
labelstringAccessibility label (iOS) or content-description (Android)
textstringVisible text content
typestringElement type/class name

device_list_devices List Devices

List all connected devices and simulators/emulators.

device_select_device Select Device

Select a device to use for this session. Call device_list_devices first to see available devices.

ParameterTypeDescription
deviceId *stringDevice ID to select (UDID for iOS, serial for Android)

hermes_cdp Hermes CDP

Speak raw Chrome DevTools Protocol (CDP) to the React Native Hermes JS runtime of a running app via Metro’s inspector proxy (iOS and Android). Requires a DEBUG build with Metro running; release builds expose no inspector. Blocked methods (for safety): Runtime.terminateExecution, Inspector.detached. Node 20 must be launched with NODE_OPTIONS="--experimental-websocket" (Node 22+ works out of the box). Example: method "Runtime.evaluate" with params {"expression":"1+1","returnByValue":true} — the raw response nests the value at result.result.value.

ParameterTypeDescription
method *stringThe CDP method to invoke, e.g. "Runtime.evaluate".
appIdstringOverride the expected app bundle identifier.
metroPortnumberOverride the Metro inspector proxy port for this call.
originstringOverride the debugger WebSocket HTTP(S) Origin to match a custom Metro server base URL (default: http://127.0.0.1:<metroPort>).
paramsobjectOptional CDP method parameters.
timeoutMsintegerTimeout in milliseconds applied to each phase independently: discovery, socket open, identity probe, and the CDP call (default 30000, floored to 1000, max 120000).

hermes_targets Hermes Targets

List and diagnose the debuggable React Native Hermes targets that Metro’s inspector proxy currently exposes (iOS and Android). Reports each candidate (id / title / appId / logicalDeviceId / nativePageReloads / wsUrl) plus which target would be chosen or why it is ambiguous. Use it to confirm Metro is running and your app is registered. Requires a DEBUG build with Metro running.

ParameterTypeDescription
allbooleanBypass the appId filter and list ALL candidates (diagnostics).
appIdstringOverride the expected app bundle identifier.
metroPortnumberOverride the Metro inspector proxy port for this call.

webview_cdp WebView CDP

Speak raw Chrome DevTools Protocol (CDP) to a debuggable in-app Android WebView — the web page inside the app’s in-app browser. Unlike hermes_cdp (React Native JS engine, no DOM), this targets the Chromium page and exposes the full Chrome surface (Runtime, DOM, Page, Network, Input). Android only; the app must call WebView.setWebContentsDebuggingEnabled(true). Blocked methods (for safety): Browser.close, Target.closeTarget, Target.disposeBrowserContext, Browser.crashGpuProcess. Node 20 must be launched with NODE_OPTIONS="--experimental-websocket" (Node 22+ works out of the box). Example: m…

ParameterTypeDescription
method *stringThe CDP method to invoke, e.g. "Runtime.evaluate".
paramsobjectOptional CDP method parameters.
timeoutMsintegerTimeout in milliseconds for discovery and each CDP round-trip (default 30000, floored to 1000, max 120000).
urlFilterstringSelect the WebView page whose URL contains this substring when several WebView pages are open.