Skip to main content
Glama
Mobile Device Farm MCP

Mobile Device Farm MCP

Mobile Device Farm MCP πŸšœπŸ“±

CI NPM Version

A Model Context Protocol (MCP) server that gives AI agents direct control over Android devices (via ADB) and iOS Simulators (via simctl). Perform automated testing, bug reproduction, and performance profiling directly from your AI agent.


πŸš€ Quick Start (via npx)

The easiest way to start the server is using npx. No installation required:

npx -y mobile-device-farm-mcp

Add it to your Claude Desktop configuration:

{
  "mcpServers": {
    "device-farm": {
      "command": "npx",
      "args": ["-y", "mobile-device-farm-mcp"]
    }
  }
}

Related MCP server: scrcpy-mcp

πŸ› οΈ Tools & Capabilities

The server provides a comprehensive suite of tools categorized by platform.

🌍 Common Tools (Cross-Platform)

  • list_devices(platform): See all connected Android devices and booted iOS Simulators.

  • test_performance(packageName, durationSec, platform): Measure average/max CPU and Memory usage over time.

  • open_deep_link(url, deviceId, platform): Open a URL or Deep Link on the target device.

  • record_video(deviceId, durationSec, platform): Record a short video of the screen (up to 60s).

  • analyze_logs(deviceId, mode): Fetch and filter logs by crash, anr, or network.

πŸ€– Android Tools (ADB)

  • adb_screenshot(deviceId): Capture the screen as a base64 image.

  • adb_get_ui_hierarchy(deviceId): Get the raw XML structure of the current screen (essential for finding element coordinates).

  • adb_tap(x, y) / adb_swipe(x1, y1, x2, y2): Simulate touch interactions.

  • adb_input_text(text): Type text into the focused field.

  • adb_key_event(keycode): Send hardware keys (HOME, BACK, ENTER).

  • adb_install(apkPath) / adb_clear_app_data(packageName): Manage app lifecycle.

  • adb_grant_permissions(packageName, permissions): Bypass system permission dialogs.

  • adb_push(localPath, remotePath) / adb_pull(remotePath, localPath): File management.

  • adb_wifi(enabled): Toggle WiFi to test offline behavior.

🍎 iOS Tools (Simulators)

  • ios_screenshot(deviceId): Capture Simulator screen.

  • ios_launch(bundleId) / ios_terminate(bundleId): Start or force-quit apps.

  • ios_install(appPath) / ios_uninstall(bundleId): Install/Remove apps.

  • ios_add_media(localPath): Add photos or videos to the Simulator library.

  • ios_push_notification(bundleId, payload): Send a test push notification (APNs JSON).


🧠 AI Agent Workflows (Examples)

πŸ•΅οΈ Example 1: Finding a Button via UI Hierarchy

Instead of guessing coordinates, the agent can use the UI hierarchy:

  1. Agent calls: adb_get_ui_hierarchy()

  2. Result: <node text="Submit" bounds="[450,1200][630,1300]" ... />

  3. Agent calls: adb_tap({ x: 540, y: 1250 }) (clicks the center of the bounds).

πŸ’₯ Example 2: Reproducing a Crash

  1. Agent calls: adb_clear_app_data({ packageName: "com.myapp" })

  2. Agent calls: record_video({ durationSec: 15 })

  3. Agent performs interactions...

  4. Agent calls: analyze_logs({ mode: "crash" }) to get the stack trace.


πŸ’¬ Prompting Examples

Once the server is connected, you can talk to your AI agent like a human mobile engineer:

  • Smoke Test: "Install the latest APK from the 'builds' folder, launch it, and take a screenshot to make sure it doesn't crash on start."

  • Bug Hunt: "Check the Android logs for any FATAL EXCEPTIONS related to the package 'com.example.app' in the last 500 lines."

  • Deep Linking: "Open the deep link 'myapp://settings/profile' on the iOS simulator and tell me if the Profile page is displayed."

  • Performance: "Run a 30-second performance test on 'com.android.chrome' and give me a summary of its average CPU and Memory usage."

  • UI Inspection: "I need to click the 'Login' button but I don't know the coordinates. Inspect the UI hierarchy and find it for me."


🧠 Mobile Tester Skill

To teach your AI agent how to effectively use these tools for complex testing (like smoke tests and chaos engineering), load the Mobile Tester Skill.

How to use:

  1. Gemini CLI: Run gemini skill add skills/mobile-tester.md.

  2. Other Agents: Copy the content of skills/mobile-tester.md into your agent's system prompt.


πŸ”§ Prerequisites

  • Android: adb must be installed and authorized (adb devices).

  • iOS: macOS with Xcode and Command Line Tools installed (xcode-select --install). Simulators must be booted to be detected.

πŸ“ License

MIT

Available Tools

32 tools
adb_clear_app_dataB

Clear app data and cache (reset to fresh install state).

Inputs: packageName (required), deviceId.

adb_force_stopC

Force stop an application (kill process).

Inputs: packageName (required), deviceId.

adb_get_ui_hierarchyB

Get the current UI hierarchy (XML) to inspect elements and find coordinates.

Inputs: deviceId.

adb_grant_permissionsC

Grant runtime permissions to an app.

Inputs: packageName (required), permissions (required), deviceId.

adb_input_textC

Input text into the currently focused field (ADB).

Inputs: text (required), deviceId.

adb_installC

Install an APK on an Android device.

Inputs: apkPath (required), deviceId.

adb_key_eventC

Send a key event (e.g., HOME, BACK, ENTER) to the device.

Inputs: keycode (required), deviceId.

adb_logcatC

Get recent logs from an Android device (last N lines).

Inputs: lines, filter, deviceId.

adb_network_statusB

Check if the device has internet connectivity (pings Google DNS).

Inputs: deviceId.

adb_pullC

Pull a file from an Android device.

Inputs: localPath (required), remotePath (required), deviceId.

adb_pushC

Push a file to an Android device.

Inputs: localPath (required), remotePath (required), deviceId.

adb_revoke_permissionsC

Revoke runtime permissions from an app.

Inputs: packageName (required), permissions (required), deviceId.

adb_screenshotC

Capture a screenshot from an Android device (returns base64 PNG).

Inputs: deviceId.

adb_shellC

Run a raw ADB shell command (use carefully).

Inputs: command (required), deviceId.

adb_swipeC

Simulate a swipe gesture on Android screen.

Inputs: x1 (required), x2 (required), y1 (required), y2 (required), +2 more.

adb_tapC

Simulate a tap on Android screen coordinates.

Inputs: x (required), y (required), deviceId.

adb_wifiC

Enable or disable WiFi on the device.

Inputs: enabled (required), deviceId.

analyze_logsC

Get logs filtered by mode (crash, anr, network).

Inputs: mode, lines, deviceId.

get_app_vitalsC

Get performance stats (CPU, Memory) and check for recent crashes/ANRs.

Inputs: packageName (required), deviceId.

get_device_infoB

Get Android device details (Battery, Resolution, SDK, Model).

Inputs: deviceId.

ios_add_mediaB

Add photos or videos to the Simulator photo library.

Inputs: deviceId (required), localPath (required).

ios_installB

Install an .app bundle on an iOS Simulator.

Inputs: appPath (required), deviceId (required).

ios_launchB

Launch an installed app on iOS Simulator.

Inputs: bundleId (required), deviceId (required).

ios_push_notificationC

Send a remote push notification to an app on the Simulator.

Inputs: payload (required), bundleId (required), deviceId (required).

ios_screenshotA

Capture a screenshot from an iOS Simulator (returns base64 PNG).

Inputs: deviceId (required).

ios_terminateC

Terminate a running app on iOS Simulator.

Inputs: bundleId (required), deviceId (required).

ios_uninstallC

Uninstall an app from iOS Simulator.

Inputs: bundleId (required), deviceId (required).

list_devicesB

List all connected Android devices (ADB) and iOS Simulators (xcrun).

Inputs: platform.

record_videoC

Record a short video of the device screen.

Inputs: deviceId (required), platform, durationSec.

run_monkeyC

Run a Chaos Monkey stress test (Android only).

Inputs: packageName (required), events, deviceId.

test_performanceC

Run a performance test on an app, measuring CPU and memory over time.

Inputs: packageName (required), deviceId, platform, durationSec.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    C2.8/5.0

    Scored across 32 tools

    Disambiguation4/5

    Most tools target distinct resource+action pairs (e.g., adb_tap vs adb_swipe vs adb_input_text), and platform prefixes aid selection. A few pairs overlap meaningfully: test_performance vs get_app_vitals both report CPU/memory, and analyze_logs vs adb_logcat both retrieve logs, but descriptions provide enough differentiation.

    Naming Consistency3/5

    Most names follow verb_noun and platform prefixes (adb_, ios_) are used, but the convention is applied inconsistently: several Android-only tools are unprefixed (test_performance, get_app_vitals, run_monkey, get_device_info), while similar Android operations use adb_. The result is readable but mixed.

    Tool Count2/5

    32 tools exceeds the 25-tool threshold and includes many platform-specific duplicates that could be unified (adb_screenshot/ios_screenshot, adb_install/ios_install, adb_grant_permissions/revoke_permissions). The breadth of a two-platform device farm justifies some count, but the surface feels bloated rather than tightly scoped.

    Completeness3/5

    Core automation is covered (install, UI interaction, screenshots, logs, performance, permissions), but notable app-lifecycle gaps exist on Android: there is no adb_launch_app, adb_terminate_app, or adb_uninstall_app equivalent to the iOS tools, and adb_shell is the only workaround. Cross-platform parity is also missing for push notifications and media injection.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      B
      maintenance
      Enables AI agents to automate Android and iOS devices, including emulators and physical devices, by capturing screenshots, reading UI accessibility trees, performing touch and text input, and managing app lifecycle and logs.
      18
      4
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables AI agents to visually perceive and directly control Android devices via ADB and screen-control tooling, including screenshots, taps, swipes, typing, app management, UI inspection, file transfer, shell commands, and audio/video streaming.
      801 npm
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables AI agents to see and control Android devices through ADB and scrcpy, supporting screenshots, input, app management, UI automation, shell/file access, and audio/video streaming.
      801 npm
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables AI agents to see and control Android devices through ADB and screen mirroring, supporting screen capture, touch input, app management, UI element finding, file transfer, shell commands, clipboard access, and audio/video streaming.
      801 npm
      MIT