You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<!--
Thanks for your contribution! Take a moment to answer these questions so
that reviewers have the information they need to properly understand
your changes:
* What is the current state of things and why does it need to change?
* What is the solution your changes offer and how does it work?
Are there any issues or other links reviewers should consult to
understand this pull request better? For instance:
* Fixes #12345
* See: #67890
-->
Copy file name to clipboardExpand all lines: README.md
+61-33Lines changed: 61 additions & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# @metamask/device-mcp
2
2
3
-
MCP server for mobile device interaction — iOS (IDB), Android (ADB), and remote devices (Appium/BrowserStack).
3
+
MCP server for mobile device interaction — iOS (simctl + IDB), Android (ADB), and remote devices (Appium/BrowserStack).
4
4
5
5
Provides device interaction tools for LLM agents to inspect UI state, interact with elements, capture evidence, and control app lifecycle. Works standalone for debugging or as part of the [self-healing test infrastructure](https://github.com/MetaMask/metamask-mobile) for MetaMask Mobile.
6
6
@@ -15,8 +15,8 @@ Provides device interaction tools for LLM agents to inspect UI state, interact w
-**iOS local**: Xcode Command Line Tools (for `xcrun simctl`) + [IDB](https://fbidb.io/) for UI interaction (`brew tap facebook/fb && brew install idb-companion && pip3 install fb-idb`)
19
+
-**Android local**: ADB (Android SDK platform-tools) — auto-discovered from `$ANDROID_HOME`, `$ANDROID_SDK_ROOT`, or `~/Library/Android/sdk`
20
20
-**Remote/BrowserStack**: No local tools needed — connects via Appium W3C WebDriver HTTP
21
21
22
22
## Installation
@@ -41,15 +41,32 @@ device-mcp
41
41
42
42
# Target a specific device
43
43
DEVICE_ID=<udid-or-serial> device-mcp
44
+
45
+
# Target a specific platform (useful in CI with one device per platform)
46
+
DEVICE_PLATFORM=ios device-mcp
47
+
DEVICE_PLATFORM=android device-mcp
44
48
```
45
49
46
50
### Backend Selection
47
51
48
52
The server selects a backend in this order:
49
53
50
54
1.**`.device-session` file** — if present in the working directory, connects via Appium (local or BrowserStack)
51
-
2.**`DEVICE_ID` env var** — format determines platform (UUID = iOS, serial = Android)
52
-
3.**Auto-detect** — checks for booted iOS simulator (IDB), then connected Android device (ADB)
55
+
2.**`DEVICE_ID` + `DEVICE_PLATFORM`** — direct connect, no auto-detection
56
+
3.**`DEVICE_ID` only** — platform inferred from format (UUID = iOS, serial/emulator-\* = Android)
57
+
4.**`DEVICE_PLATFORM` only** — auto-detect first device of that platform
58
+
5.**Nothing set, 1 device** — auto-connect
59
+
6.**Nothing set, multiple devices** — returns device list, agent asks user to pick via `device_select_device`
60
+
61
+
### Multi-Device Selection
62
+
63
+
When multiple devices are connected and no `DEVICE_ID` is set, the server enters an "awaiting selection" state. Any tool call returns the list of available devices. Use `device_list_devices` to enumerate them and `device_select_device` to choose one.
64
+
65
+
### Device Discovery
66
+
67
+
-**iOS simulators** are discovered via `xcrun simctl list devices booted --json` — no IDB needed for discovery
68
+
-**Android devices** are discovered via `adb devices` — the server probes `$ANDROID_HOME/platform-tools/adb`, `$ANDROID_SDK_ROOT/platform-tools/adb`, and `~/Library/Android/sdk/platform-tools/adb` when `adb` is not on `$PATH`
69
+
-**IDB** is resolved from `$PATH`, `/usr/local/bin`, `/opt/homebrew/bin`, and `~/Library/Python/*/bin` (pip user installs)
53
70
54
71
### BrowserStack / Appium
55
72
@@ -102,6 +119,13 @@ The `.device-session` file is typically written by the test runner when it creat
Copy file name to clipboardExpand all lines: SKILL.md
+49-1Lines changed: 49 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# @metamask/device-mcp — Agent Reference
2
2
3
-
You interact with a mobile device (iOS simulator, Android emulator, or BrowserStack remote device) through the `device-mcp` MCP server. It exposes 16 tools for inspecting UI state, interacting with elements, capturing evidence, and controlling app lifecycle.
3
+
You interact with a mobile device (iOS simulator, Android emulator, or BrowserStack remote device) through the `device-mcp` MCP server. It exposes 25 tools for device management, inspecting UI state, interacting with elements, capturing evidence, and controlling app lifecycle.
4
4
5
5
## When to Use This
6
6
@@ -10,6 +10,17 @@ You interact with a mobile device (iOS simulator, Android emulator, or BrowserSt
10
10
-**Verifying UI changes** — check that a screen looks right after a code change
11
11
-**Self-healing test recovery** — find alternative paths when an element is missing
12
12
13
+
## Getting Started — Device Selection
14
+
15
+
When multiple devices are connected, the server won't auto-pick one. Use the device management tools first:
16
+
17
+
```
18
+
device_list_devices # See all connected simulators/emulators/devices
19
+
device_select_device # Pick the one you want to use
20
+
```
21
+
22
+
If only one device is connected, it's auto-selected. If `DEVICE_ID` is set, this step is skipped.
23
+
13
24
## Core Loop
14
25
15
26
```
@@ -29,6 +40,30 @@ device_snapshot # 3. See the result — NEVER assume screen state
29
40
30
41
## Tools
31
42
43
+
### device_list_devices (read-only)
44
+
45
+
List all connected devices and simulators/emulators. Returns platform and device ID for each.
46
+
47
+
**When:** Multiple devices are connected and you need to pick one. Checking what's available before starting.
48
+
49
+
**Output format:**
50
+
51
+
```
52
+
Platform Device ID
53
+
ios FACF3006-1FF8-482A-B6EF-58995E1DF1CB
54
+
android emulator-5554
55
+
```
56
+
57
+
### device_select_device
58
+
59
+
Select a device to use for this session. Call `device_list_devices` first to see available devices.
iOS simulators are discovered via `xcrun simctl` (ships with Xcode). ADB is auto-discovered from `$ANDROID_HOME`, `$ANDROID_SDK_ROOT`, or `~/Library/Android/sdk`. IDB is auto-discovered from `$PATH`, `/usr/local/bin`, `/opt/homebrew/bin`, or `~/Library/Python/*/bin`.
347
+
348
+
No `PATH` configuration is needed in the MCP client — tools are found automatically.
349
+
302
350
### Remote (BrowserStack/Appium)
303
351
304
352
Create a `.device-session` file — see the README for the full schema. The test runner typically writes this when starting the Appium session.
0 commit comments