AndroidMCP Framework
v0.1.12MCP server and CLI for Android development and change-aware Android and Flutter testing workflows.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
list_devices List Devices
List every connected Android target - booted emulators and physical devices together, the same way `adb devices -l` does. Each entry reports id (adb serial), type ('emulator'|'physical'), state, and avdName when resolvable.
build_device Build (Device)
Compile-only build for a Gradle module + variant (assemble<Variant>). Does not install or launch. Works identically whether you plan to target an emulator or a physical device - both use the same adb, unlike Xcode's simulator/device split.
| Parameter | Type | Description |
|---|---|---|
extraArgs | array | Extra raw Gradle CLI args, e.g. ["--stacktrace"]. |
module | string | Gradle module path, e.g. ":app". Falls back to sessionDefaults.module. |
projectPath | string | Gradle project root. Falls back to sessionDefaults.projectPath. |
variant | string | Build variant, e.g. "debug" or "devDebug". Falls back to sessionDefaults.variant. |
build_run_device Build, Install, and Launch
One-shot: build a module + variant, install it, and launch it. Resolves the target automatically - an explicit targetId wins, then the active session default, then whichever single emulator/device is connected; if more than one is connected without a pin, this fails with the candidate list instead of guessing. Launches via the default launcher activity unless `activity` is given.
| Parameter | Type | Description |
|---|---|---|
activity | string | Fully-qualified activity to launch, e.g. "com.example.app.MainActivity". Defaults to the app's launcher activity. |
extraArgs | array | |
module | string | |
projectPath | string | |
targetId | string | adb serial. Auto-resolved if omitted. |
variant | string |
install_app_device Install App
Install an already-built APK for a module + variant onto the resolved target. Does not rebuild - run build_device first if sources changed. Pass apkPath directly to skip variant lookup entirely.
| Parameter | Type | Description |
|---|---|---|
apkPath | string | Explicit path to a .apk, bypassing module/variant lookup. |
module | string | |
projectPath | string | |
reinstall | boolean | Pass -r to adb install to keep existing app data. Default true. |
targetId | string | |
variant | string |
launch_app_device Launch App
Launch an already-installed app on the resolved target. Provide packageId directly, or module/variant to look it up from the last build's APK. Uses the app's default launcher activity unless `activity` is given.
| Parameter | Type | Description |
|---|---|---|
activity | string | |
module | string | |
packageId | string | Application id, e.g. "com.example.app". Resolved from the built APK if omitted. |
projectPath | string | |
targetId | string | |
variant | string |
stop_app_device Stop App
Force-stop a running app on the resolved target (adb shell am force-stop).
| Parameter | Type | Description |
|---|---|---|
packageId * | string | Application id, e.g. "com.example.app". |
targetId | string |
uninstall_app_device Uninstall App
Uninstall an app (and its data) from the resolved target.
| Parameter | Type | Description |
|---|---|---|
packageId * | string | |
keepData | boolean | Pass -k to adb uninstall to keep app data/cache. Default false. |
targetId | string |
clear_app_data_device Clear App Data
Reset an app to first-install state on the resolved target (adb shell pm clear) - wipes the app's data and cache without uninstalling it.
| Parameter | Type | Description |
|---|---|---|
packageId * | string | |
targetId | string |
test_device Test (Device)
Run tests for a module + variant. `instrumented` (default) runs connected<Variant>AndroidTest against the resolved target via ANDROID_SERIAL - needs an emulator or device attached. `unit` runs test<Variant>UnitTest on the JVM instead and needs no target at all.
| Parameter | Type | Description |
|---|---|---|
extraArgs | array | |
kind | string | Defaults to "instrumented". |
module | string | |
projectPath | string | |
targetId | string | |
variant | string |
push_file_device Push File
Copy a local file or directory onto the resolved target (adb push).
| Parameter | Type | Description |
|---|---|---|
localPath * | string | |
remotePath * | string | |
targetId | string |
pull_file_device Pull File
Copy a file or directory off the resolved target onto the local filesystem (adb pull).
| Parameter | Type | Description |
|---|---|---|
localPath * | string | |
remotePath * | string | |
targetId | string |
snapshot_ui Snapshot UI
Capture a semantic UI hierarchy for the current screen - every element gets a short-lived elementRef (e1, e2, ...) that tap/long_press/type_text can target directly. Saves the captured hierarchy as JSON under .androidmcp-framework/artifacts/ui-snapshots/ by default.
| Parameter | Type | Description |
|---|---|---|
interactiveOnly | boolean | Default true: only clickable/focusable/scrollable/checkable elements or ones with text/content-desc. false returns the full raw tree. |
projectPath | string | Project root for the saved JSON snapshot; defaults to the current working directory. |
targetId | string |
tap Tap
Tap either a raw (x, y) point or an elementRef from the latest snapshot_ui output. Prefer elementRef - it survives minor layout shifts that would break a hard-coded coordinate.
| Parameter | Type | Description |
|---|---|---|
elementRef | string | |
targetId | string | |
x | number | |
y | number |
long_press Long Press
Long-press either a raw (x, y) point or an elementRef from the latest snapshot_ui output.
| Parameter | Type | Description |
|---|---|---|
durationMs | number | Default 600. |
elementRef | string | |
targetId | string | |
x | number | |
y | number |
swipe Swipe
Swipe either by explicit start/end coordinates, or a screen-relative direction ("up"|"down"|"left"|"right") computed from the current screen size.
| Parameter | Type | Description |
|---|---|---|
direction | string | |
distance | number | Screen-relative distance for direction mode, 0-1. Default 0.6. |
durationMs | number | Default 300. |
endX | number | |
endY | number | |
startX | number | |
startY | number | |
targetId | string |
drag Drag
Press-and-drag from one point to another (adb shell input draganddrop) - for reordering list items or drag targets, where a quick swipe would be interpreted as a flick instead of a hold-and-move. Endpoints can be elementRefs from the latest snapshot_ui, or raw coordinates.
| Parameter | Type | Description |
|---|---|---|
durationMs | number | Default 800. |
endElementRef | string | |
endX | number | |
endY | number | |
startElementRef | string | |
startX | number | |
startY | number | |
targetId | string |
type_text Type Text
Type text into whatever field currently has focus. If elementRef is given, taps it first to focus it, then types. Only ASCII-range and common Latin text renders reliably through adb input text - non-Latin scripts and emoji generally need an IME-level workaround this tool does not attempt.
| Parameter | Type | Description |
|---|---|---|
text * | string | |
elementRef | string | Tapped first to focus, if given. |
targetId | string |
key_press Key Press
Send one hardware/software key event (adb shell input keyevent). Accepts either a symbolic Android keycode name (KEYCODE_BACK, KEYCODE_ENTER, KEYCODE_DEL, KEYCODE_TAB) or its numeric code. Prefer button for common hardware buttons (home/back/recents/power/volume) - it maps friendly names for you.
| Parameter | Type | Description |
|---|---|---|
keyCode * | string | e.g. "KEYCODE_ENTER" or "66". |
targetId | string |
button Hardware Button
Press a named hardware/system button: home, back, recents, power, volume_up, volume_down, menu, enter, camera.
| Parameter | Type | Description |
|---|---|---|
button * | string | |
targetId | string |
gesture Gesture Preset
Named system gesture presets: expand_notifications, expand_quick_settings, collapse_statusbar (all via `cmd statusbar`, no coordinates needed), swipe_up_from_bottom (home/app-switcher gesture-nav swipe), swipe_down_from_top (notification-shade swipe as an alternative to expand_notifications on older API levels).
| Parameter | Type | Description |
|---|---|---|
preset * | string | |
targetId | string |
screenshot Screenshot
Capture the current screen, return it as an image, and save a copy under .androidmcp-framework/artifacts/screenshots/ by default.
| Parameter | Type | Description |
|---|---|---|
outputPath | string | Optional explicit screenshot file path. Defaults to the project artifacts folder. |
projectPath | string | Project root for the saved screenshot; defaults to the current working directory. |
targetId | string |
wait_for_ui Wait For UI
Poll the UI until a condition holds, then record the latest snapshot (same caching as snapshot_ui - refs from the result are usable directly). With textContains/resourceId: waits for a matching element to appear (or disappear, if gone:true). With neither: waits for the hierarchy to stop changing between polls ("settled").
| Parameter | Type | Description |
|---|---|---|
gone | boolean | Wait for absence instead of presence. Default false. |
pollIntervalMs | number | Default 500. |
resourceId | string | |
targetId | string | |
textContains | string | |
timeoutMs | number | Default 10000. |
batch Batch
Run several same-screen UI actions in one call, resolving the target once and reusing it for every step. Use for multiple taps/toggles with no intermediate assertion needed - if you need to check state between steps, call the individual tools instead so you can inspect each result.
| Parameter | Type | Description |
|---|---|---|
steps * | array | |
targetId | string |
touch Touch (raw down/up/move)
Send a raw touch event (adb shell input motionevent) rather than a full tap/swipe gesture. Use for composing custom multi-point sequences - e.g. DOWN, several MOVEs, then UP - that the higher-level tap/swipe/drag tools don't expose.
| Parameter | Type | Description |
|---|---|---|
action * | string | |
x * | number | |
y * | number | |
targetId | string |
session_show_defaults Show Session Defaults
Show the active session-default profile and its resolved values (config.yaml sessionDefaults, overlaid with any runtime overrides from session_set_defaults). Call this before your first build/run/test call in a session - do not assume defaults are configured.
session_set_defaults Set Session Defaults
Set one or more session defaults for the active profile at runtime (in-memory + persisted under the state dir for this profile - not written back to config.yaml). Only the fields you pass are changed; everything else stays as-is.
| Parameter | Type | Description |
|---|---|---|
applicationId | string | |
avdName | string | |
gradleTaskPrefix | string | |
module | string | |
projectPath | string | |
targetId | string | |
variant | string |
session_clear_defaults Clear Session Defaults
Clear runtime overrides for the active profile (or a named one) - falls back to config.yaml's static sessionDefaults on the next read, not to nothing.
| Parameter | Type | Description |
|---|---|---|
profile | string |
session_use_defaults_profile Switch Session Defaults Profile
Switch the active session-defaults profile - useful in a monorepo with several Gradle projects, so each can keep its own remembered projectPath/module/variant/targetId without overwriting the others.
| Parameter | Type | Description |
|---|---|---|
profile * | string |
doctor Doctor
Check Android development prerequisites: adb, Java, Gradle, Android SDK, emulator, build-tools and the optional Google Android CLI integration. This framework does not require Python.
manage_workflows Manage Workflows
List every workflow and which of its tools are currently enabled, or enable/disable a workflow for this running server session. Session-only - it does not edit .android-build-mcp/config.yaml, so restart-persistent changes still belong in enabledWorkflows there.
| Parameter | Type | Description |
|---|---|---|
action | string | Default "list". |
workflowName | string | Required for enable/disable. |