Summary
On an Android emulator, four tools — mobile_list_crashes, mobile_get_crash, mobile_start_screen_recording, mobile_stop_screen_recording — fail because mobile-mcp passes the adb device id to the bundled mobilecli, but mobilecli identifies the same emulator by its AVD name. The adb-based tools (screenshot, tap, elements, etc.) all work; only the mobilecli-backed tools break. Worse, mobile_start_screen_recording returns success but records nothing (silent failure).
Environment
|
|
| mobile-mcp |
0.0.59 |
| bundled mobilecli |
0.3.79 |
| Device |
Pixel 7 API 33 emulator, Android 13 |
| adb |
1.0.41 |
| Host |
macOS 26.5.1 (arm64), Node v25.9.0 |
Root cause: device-id mismatch between the adb path and the mobilecli path
mobile_list_available_devices returns the Android emulator with the adb id:
{ "id": "emulator-5554", "platform": "android", "type": "emulator", ... }
…but mobilecli knows the very same emulator by its AVD name:
$ mobilecli devices --platform android
{ "data": { "devices": [ { "id": "Pixel_7_API_33", "platform": "android", "type": "emulator", "model": "sdk_gphone64_arm64" } ] } }
So when a mobilecli-backed tool forwards the id the user got from list_available_devices, it fails:
$ mobilecli device crashes list --device emulator-5554
{ "status": "error", "error": "error finding device: device not found: emulator-5554" }
$ mobilecli device crashes list --device Pixel_7_API_33 # AVD name works
{ "status": "ok", "data": [ { "processName": "com.android.chrome:privileged_process0", ... } ] }
In lib/server.js, the adb-based Android tools come from AndroidRobot (adb ids), while these route to mobilecli:
mobile_list_crashes → mobilecli.crashesList(device)
mobile_get_crash → mobilecli.crashesGet(device, id)
mobile_start_screen_recording → mobilecli.spawnCommand(["screenrecord", "--device", device, "--output", outputPath, "--silent"])
lib/android.js has no screenrecord implementation, so recording has no adb fallback. There is no single id that works across all tools: adb-based tools require emulator-5554, mobilecli-based tools require Pixel_7_API_33.
Extra bug: start_screen_recording silently false-succeeds
spawnCommand launches the mobilecli screenrecord child, which immediately exits with the device not found error. But the handler still returns "Screen recording started…" and registers the recording; the child's error/exit handler then activeRecordings.delete(device). Result:
start_screen_recording -> "Screen recording started. Output will be saved to: /tmp/android_rec.mp4" (but no child is running)
stop_screen_recording -> "No active recording found for device emulator-5554..." (entry already deleted)
No screenrecord process ever ran on the device and no file is produced — yet start reported success.
Reproduction
- Boot an Android emulator;
mobile_list_available_devices → note the emulator-5554 id.
mobile_list_crashes({device: "emulator-5554"}) → device not found: emulator-5554.
mobile_start_screen_recording({device: "emulator-5554", output: "/tmp/r.mp4"}) → returns "started".
mobile_stop_screen_recording({device: "emulator-5554"}) → "No active recording found"; /tmp/r.mp4 does not exist.
Suggested fix
- Reconcile the device id before calling
mobilecli for Android — map the adb id (emulator-5554) to the mobilecli/AVD id (Pixel_7_API_33), or have list_available_devices expose a single id that every code path accepts.
- Don't let
start_screen_recording report success when the child fails to start — await/verify the mobilecli child is alive (and the device resolved) before returning, and surface the error.
Happy to test a patch — repro is consistent here.
Summary
On an Android emulator, four tools —
mobile_list_crashes,mobile_get_crash,mobile_start_screen_recording,mobile_stop_screen_recording— fail because mobile-mcp passes the adb device id to the bundledmobilecli, butmobilecliidentifies the same emulator by its AVD name. The adb-based tools (screenshot, tap, elements, etc.) all work; only themobilecli-backed tools break. Worse,mobile_start_screen_recordingreturns success but records nothing (silent failure).Environment
0.0.590.3.79Root cause: device-id mismatch between the adb path and the mobilecli path
mobile_list_available_devicesreturns the Android emulator with the adb id:{ "id": "emulator-5554", "platform": "android", "type": "emulator", ... }…but
mobilecliknows the very same emulator by its AVD name:So when a
mobilecli-backed tool forwards the id the user got fromlist_available_devices, it fails:In
lib/server.js, the adb-based Android tools come fromAndroidRobot(adb ids), while these route tomobilecli:mobile_list_crashes→mobilecli.crashesList(device)mobile_get_crash→mobilecli.crashesGet(device, id)mobile_start_screen_recording→mobilecli.spawnCommand(["screenrecord", "--device", device, "--output", outputPath, "--silent"])lib/android.jshas noscreenrecordimplementation, so recording has no adb fallback. There is no single id that works across all tools: adb-based tools requireemulator-5554, mobilecli-based tools requirePixel_7_API_33.Extra bug:
start_screen_recordingsilently false-succeedsspawnCommandlaunches themobilecli screenrecordchild, which immediately exits with thedevice not founderror. But the handler still returns"Screen recording started…"and registers the recording; the child's error/exit handler thenactiveRecordings.delete(device). Result:No
screenrecordprocess ever ran on the device and no file is produced — yetstartreported success.Reproduction
mobile_list_available_devices→ note theemulator-5554id.mobile_list_crashes({device: "emulator-5554"})→device not found: emulator-5554.mobile_start_screen_recording({device: "emulator-5554", output: "/tmp/r.mp4"})→ returns "started".mobile_stop_screen_recording({device: "emulator-5554"})→ "No active recording found";/tmp/r.mp4does not exist.Suggested fix
mobileclifor Android — map the adb id (emulator-5554) to the mobilecli/AVD id (Pixel_7_API_33), or havelist_available_devicesexpose a single id that every code path accepts.start_screen_recordingreport success when the child fails to start — await/verify themobileclichild is alive (and the device resolved) before returning, and surface the error.Happy to test a patch — repro is consistent here.