Skip to main content
Glama
Mobile Automator MCP Server

Mobile Automator MCP Server

by jegriffi91

Mobile Automator MCP Server

An MCP server that gives AI agents the power to record, replay, and mock mobile app interactions — combining Maestro UI automation with Proxyman network capture to generate complete, self-contained test scripts.

Architecture

Recording synthesis flow

The system orchestrates two async data streams — UI interactions (via Maestro) and HTTP traffic (via Proxyman) — then correlates them by timestamp to produce Maestro YAML + WireMock stubs for full experience replay.

Related MCP server: Hunt-Droid Mobile MCP

Capabilities

Capability

Description

UI Recording

Dispatch taps, types, scrolls, swipes on iOS/Android simulators via Maestro

Network Capture

Intercept HTTP/HTTPS traffic through Proxyman with scoped, session-aware exports

Correlation

Automatically match UI actions to the network requests they trigger (sliding time window)

YAML Synthesis

Generate Maestro test scripts with inline network context comments

WireMock Stubs

Produce WireMock-compatible mappings/ + __files/ for network replay

Selective Mocking

Mock all, some, or all-except-some APIs — unmocked routes proxy to the real server

SDUI Validation

Deep-compare server-driven UI payloads against expected JSON shapes

Named Flows

Invoke hand-authored Maestro flows by name (list_flows, run_flow) to navigate to the area of an incremental change

Build & Deploy

Compile, install, uninstall, and boot simulators via build_app / install_app / uninstall_app / boot_simulator — iOS (xcodebuild + simctl) and Android (gradlew + adb)

Visual Verification

Capture PNG screenshots via take_screenshot (iOS simctl io screenshot, Android adb exec-out screencap -p) so the agent can inspect the rendered UI directly

Unit Tests

Run XCTest / Gradle unit tests via run_unit_tests and get structured pass/fail counts plus first-line failure messages — no log dumps

Tools

Tool

Purpose

start_recording_session

Begin recording — snapshots Proxyman baseline, initializes session state

execute_ui_action

Dispatch a UI action and log it to the session

get_ui_hierarchy

Capture the current accessibility tree from the simulator

get_network_logs

Fetch intercepted HTTP traffic (with domain/path filtering)

verify_sdui_payload

Validate a network response against expected fields

stop_and_compile_test

Finalize session → export scoped HAR → correlate → generate YAML + WireMock stubs

list_flows

Discover named Maestro flows under ./flows/ (or a custom flowsDir)

run_flow

Execute a named flow by name, merging manifest defaults with caller-supplied params

build_app

Compile an iOS app (xcodebuild) or Android app (./gradlew assemble…); returns the built .app / .apk path

install_app

Install a built .app (iOS simctl) or .apk (Android adb install -r) on a target device

uninstall_app

Remove an installed app from a device to guarantee clean-state launches

boot_simulator

Boot an iOS simulator by UDID and wait for it to be ready (Android emulator: start manually)

take_screenshot

Capture a PNG of the current simulator/emulator screen; returns an absolute path Claude can read back

run_unit_tests

Run the unit-test target and return structured results (passed/failed counts, failing test names, first-line failure messages)

start_build

Async entry point for build_app — returns a taskId immediately so agents can poll without hitting the MCP transport timeout

poll_task_status

Read current status, duration, and recent streamed output for a task (read-only, never throws)

get_task_result

Read the final structured result for a completed task (idempotent, does not consume)

cancel_task

Abort a running task — SIGTERMs children, runs cleanups, marks cancelled

list_tasks

Inventory of in-process tasks filtered by kind / status / since

Quick Start

Prerequisites

  • Node.js v20+

  • Maestro CLI 2.5.0+ — curl -Ls "https://get.maestro.mobile.dev" | bash (older versions log a warning at startup; 2.3.x in particular exhibits XCTest driver flakiness on iOS port 22087)

  • Proxyman macOS 5.20+ with CLI — see Proxyman Setup

  • A booted iOS Simulator or Android Emulator

Install

git clone <repository>
cd mobile-automator-mcp
npm install
npm run build

Option A — HTTP Bridge (use this if the MCP client is blocked at your org)

npm run dev:http

Verify it's running:

curl http://localhost:3000/health
# {"ok":true,"tools":34}

Then call any tool via JSON-RPC:

curl -X POST http://localhost:3000/message \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"list_devices","arguments":{"platform":"ios"}}}'

For a full tool reference, session lifecycle patterns, and common workflows see .github/skills/generate_mcp_curls/SKILL.md.
To regenerate boilerplate curl commands for all 34 tools: npx tsx .github/skills/generate_mcp_curls/generate.ts

Phase-1 admin tools

When something looks stuck, five admin tools provide visibility and recovery without restarting the server:

  • audit_state — single-shot snapshot of sessions, drivers, pollers, and Proxyman rules with an orphans report

  • list_active_sessions — read-only inventory with driver/poller liveness and mock counts

  • list_active_mocks — Proxyman rules tagged mca: plus drift between Proxyman and the local ledger

  • force_cleanup_session — destructive: stop poller/driver, delete tagged Proxyman rules, mark session aborted (never throws)

  • force_cleanup_mocks — destructive bulk delete of mca:-tagged Proxyman rules by scope (all, session, standalone)

Option B — Register with an MCP Client (once org-approved)

Add to your MCP client config (e.g., Claude Desktop, Gemini Code Assist):

{
  "mcpServers": {
    "mobile-automator": {
      "command": "node",
      "args": ["/absolute/path/to/mobile-automator-mcp/dist/index.js"]
    }
  }
}

Selective Mocking

The stop_and_compile_test tool accepts a mockingConfig to control which APIs are mocked vs. proxied to a real backend:

full      → Mock all captured APIs (default, no real server needed)
include   → Mock only listed routes, proxy everything else
exclude   → Mock everything EXCEPT listed routes

Example — mock only login, proxy everything else:

{
  "mockingConfig": {
    "mode": "include",
    "routes": ["/api/login"],
    "proxyBaseUrl": "http://localhost:3030"
  }
}

Output Structure

session-<id>/
├── wiremock/
│   ├── mappings/           ← WireMock stub JSON files
│   │   ├── post_api_login.json
│   │   ├── get_api_lore_doom.json
│   │   └── _proxy_fallback.json   ← (include/exclude modes only)
│   └── __files/            ← Response body fixtures
│       ├── post_api_login_response.json
│       └── get_api_lore_doom_response.json
└── manifest.json           ← Session metadata + route manifest

Project Structure

src/
├── index.ts              ← MCP server entry point
├── handlers.ts           ← Tool handler implementations
├── schemas.ts            ← Zod schemas (single source of truth for I/O)
├── types.ts              ← Domain models
├── session/              ← Session lifecycle + SQLite persistence
├── maestro/              ← Maestro CLI wrapper + hierarchy parser
├── proxyman/             ← Proxyman CLI wrapper + payload validator
├── flows/                ← Named, hand-authored flow registry
├── build/                ← iOS (xcodebuild/simctl) + Android (gradlew/adb) build & deploy
├── screenshot/           ← PNG capture for visual self-verification
├── testing/              ← XCTest / JUnit unit-test runner + result parsers
└── synthesis/            ← Correlator + YAML generator + WireMock stub writer

Named Flows

Hand-authored Maestro flows let an agent navigate to a specific app screen before verifying an incremental change. Flows live as .yaml files in a flows directory (default: ./flows/) and are invoked by name.

flows/
├── _manifest.json              ← optional: descriptions, tags, param specs
├── login.yaml                  ← flow name is "login"
└── navigate-to-checkout.yaml   ← flow name is "navigate-to-checkout"

An optional _manifest.json declares parameters and metadata:

{
  "flows": {
    "login": {
      "description": "Launch the app and reach the logged-in home screen",
      "tags": ["auth", "setup"],
      "params": {
        "USERNAME": { "default": "admin", "description": "Login username" },
        "PASSWORD": { "default": "admin" }
      }
    }
  }
}

Params are forwarded to Maestro as -e KEY=VALUE and referenced inside the YAML as ${KEY}. Call list_flows to discover flows, then run_flow with { name, params? } to execute one.

Build & Deploy Loop

Closes the edit → rebuild → reinstall → navigate cycle so an agent can verify changes against a fresh build.

build_app     → compile with xcodebuild / ./gradlew, return built .app or .apk path
uninstall_app → wipe the prior install + its data from the target device
install_app   → push the new binary to the simulator / emulator
boot_simulator→ boot an iOS simulator (idempotent; alreadyBooted=true if already running)

iOS — shells xcodebuild build -scheme <scheme> -destination 'generic/platform=iOS Simulator' -derivedDataPath <path> and locates the .app under <derivedDataPath>/Build/Products/<Configuration>-iphonesimulator/. Bundle id is extracted via plutil from the built Info.plist.

Android — shells ./gradlew :<module>:assemble<Variant> from the project root and locates the APK at <project>/<module>/build/outputs/apk/<variant>/. Booting the emulator is not yet automated — start it manually (e.g., emulator -avd <name>) before calling install/run tools.

Build output is truncated (head + tail) to keep MCP responses small while preserving both the lead-up and the final error context.

Visual Verification & Unit Tests

take_screenshot writes a PNG to disk and returns its path — Claude reads the image back directly, which catches visual regressions (wrong color, clipped text, broken image) that structural hierarchy checks miss. Pair it with get_ui_hierarchy for structural assertions.

run_unit_tests runs the normal unit-test target for the project:

  • iOS — xcodebuild test -resultBundlePath <path> with optional -only-testing:<Target>/<Class>[/<Method>] filters. The stdout is parsed for per-test pass/fail so totals stay accurate across Xcode versions.

  • Android — ./gradlew :<module>:test<Variant>UnitTest with an optional --tests <filter>. JUnit XML under <module>/build/test-results/<task>/ is parsed for failure details.

Both return structured results: { passed, totalTests, passedTests, failedTests, skippedTests, failures[] }. failures[] carries the failing test name and (where available) the first-line error message plus source file/line — enough for the agent to jump straight to the offending code without grepping the full log.

The full agent workflow (build → install → navigate → screenshot → unit test → iterate) is documented in .agents/skills/agent-loop.md.

Development

npm test            # Run tests
npm run test:watch  # Watch mode
npm run build       # Compile TypeScript
npm start           # Start server (stdio)
npm run lint        # ESLint

License

MIT

Available Tools

33 tools
boot_simulatorBoot SimulatorA
Idempotent

Boot an iOS simulator by UDID and wait for it to be fully ready. Idempotent — returns alreadyBooted=true if already running. Opens Simulator.app by default. Android emulator booting is not yet supported (start it manually).

Inputs: platform (required), deviceUdid (required), timeoutMs, openSimulatorApp. Returns: state, output, passed, platform, +3 more

cancel_taskCancel TaskA
DestructiveIdempotent

Aborts a running task: sends SIGTERM to children, runs registered cleanups in reverse order, marks the task cancelled. Idempotent and never throws.

Inputs: taskId (required), reason. Returns: taskId, notFound, cancelled, finalStatus, +2 more

clear_mock_responsesClear Mock ResponsesA
DestructiveIdempotent

Remove mocks installed by set_mock_response. Pass mockId to remove one; omit to clear all mocks for the session. stop_and_compile_test runs this implicitly on session end.

Inputs: no named parameters. Returns: scope, removed, remaining

execute_ui_actionExecute UI ActionA

Dispatch a UI action (tap, type, scroll, etc.) on a target element. Logs the interaction to session memory for later test synthesis. Selector priority: id > accessibilityLabel > text. Scroll/swipe are not supported during a live recording session — use start_flow for complex sequences.

Inputs: action (required), sessionId (required), element, textInput. Returns: message, success

get_network_logsGet Network LogsA
Read-onlyIdempotent

Retrieve intercepted HTTP/HTTPS network transactions for the session from Proxyman. Filter by URL path to isolate SDUI or analytics endpoints. Used to correlate network state with UI state.

Inputs: sessionId (required), limit, filterPath, filterDomains. Returns: total, events

get_session_timelineGet Session TimelineA
Read-onlyIdempotent

Get a lightweight mid-session health check showing polling stats, interaction counts, and gap analysis. Use during an active recording to verify the poller is keeping up and interactions are being captured. Only available while session status is "recording".

Inputs: sessionId (required). Returns: gaps, status, elapsedMs, sessionId, +3 more

get_task_resultGet Task ResultA
Read-onlyIdempotent

Returns the final structured result for a completed task. Returns error/notFound for not-yet-done or unknown tasks. Idempotent — does not consume the task.

Inputs: taskId (required). Returns: error, result, status, taskId, +2 more

get_ui_hierarchyGet UI HierarchyA
Read-onlyIdempotent

Capture the current UI element tree from a booted simulator. Works standalone (auto-targets the sole booted device) or within a recording session via sessionId. Returns a normalized accessibility tree with pixel bounds for point-based taps when selectors don't match. Use interactiveOnly to filter to tappable elements.

Inputs: compact, sessionId, artifactPath, interactiveOnly, +1 more. Returns: hierarchy, nodeCount, rawOutput, diagnostics, +1 more

install_appInstall AppA
Idempotent

Install a built app onto a booted simulator/emulator. iOS uses xcrun simctl install; Android uses adb install -r. Returns the resolved bundle id (iOS) when available.

Inputs: appPath (required), platform (required), deviceUdid (required). Returns: output, passed, bundleId, platform, +2 more

list_devicesList DevicesA
Read-onlyIdempotent

List available iOS simulators and Android emulators. Filter by platform, state (Booted/Shutdown), or OS version. Use this to discover device UDIDs before calling get_ui_hierarchy.

Inputs: state, platform, osVersionContains. Returns: total, devices

list_flowsList FlowsA
Read-onlyIdempotent

Discover named Maestro flows in a flows directory (default: ./flows). Each flow is a .yaml file; an optional _manifest.json adds descriptions, tags, and parameter specs. Use start_flow to execute one by name.

Inputs: flowsDir. Returns: flows, total, flowsDir

list_tasksList TasksA
Read-onlyIdempotent

Lists tasks in the registry, optionally filtered by kind/status. Useful for orphan recovery alongside list_active_sessions.

Inputs: kind, since, status. Returns: tasks, totalTasks

poll_task_statusPoll Task StatusA
Read-onlyIdempotent

Returns current status, duration, and the recent tail of streamed output for a task. Cheap; safe to call frequently. Returns notFound:true for unknown or pruned task IDs (never throws).

Inputs: taskId (required), tailLines. Returns: kind, error, status, taskId, +7 more

register_segmentRegister SegmentA
Idempotent

Register a recorded session as a named, reusable flow segment. Computes a fingerprint from the correlated steps and saves it to the segment registry for future deduplication.

Inputs: name (required), sessionId (required), registryPath. Returns: name, message, fingerprint, registryPath

run_feature_testRun Feature TestA

Execute a declarative feature test in ONE tool call: setup flows → start recording → UI actions → network assertions → stop & compile → teardown. Replaces 8–15 AI-orchestrated tool calls per run with a single deterministic lifecycle. Accepts an inline FeatureTestSpec or a path to a .yaml/.json spec file.

Inputs: spec (required), env, flowsDir, platform, +5 more. Returns: name, error, mocks, setup, +5 more

run_unit_testsRun Unit TestsA
Idempotent

Run the unit-test target for the project. Returns structured results: pass/fail counts, failing test names, first-line failure messages. Long-running — default timeout 30 minutes.

Inputs: platform (required), module, scheme, variant, +9 more. Returns: output, passed, failures, platform, +7 more

set_mock_responseSet Mock ResponseA

Install a live response-mocking rule via Proxyman. Two modes: staticResponse (return a verbatim payload — feature flags, fixtures) and responseTransform.jsonPatch (proxy to the real backend then mutate the response body in flight — e.g. the loginStatus override pattern). Session-scoped mocks auto-clean on stop_and_compile_test; standalone mocks persist until explicitly cleared. Requires Proxyman running with MCP enabled.

Inputs: mock (required), sessionId. Returns: scope, mockId, ruleName, proxymanRuleId, +2 more

start_buildStart Build (Async)A

Compile an iOS or Android app from source (xcodebuild or gradlew). Returns a taskId immediately; poll via poll_task_status, get final .app/.apk path + bundleId via get_task_result. Default timeout 15 min.

Inputs: platform (required), module, scheme, variant, +6 more. Returns: kind, status, taskId, startedAt

start_flowStart Flow (Async)A

Execute a named Maestro flow (resolves /.yaml and merges manifest param defaults with caller params). Use to navigate to the area of an incremental change before verifying it. Returns a taskId; poll_task_status streams output, get_task_result returns final pass/fail. With MCA_FLOW_PAUSE_RESUME=on, pauses any active recording for the run and auto-resumes; otherwise errors if a session is active. cancel_task interrupts mid-flow.

Inputs: name (required), params, flowsDir, platform, +4 more. Returns: kind, status, taskId, startedAt

start_recording_sessionStart Recording SessionA

Begin recording a mobile interaction session. Initializes session memory, monitors the UI hierarchy, and starts capturing network events. Returns a session ID to use with subsequent tool calls. During the session, drive the app via execute_ui_action (single steps) or start_flow (stored Maestro yaml). Both update the recording timeline.

Inputs: platform (required), appBundleId (required), timeouts, captureMode, +5 more. Returns: message, readiness, sessionId

start_testStart Test (Async)A

Run a Maestro YAML test file with optional WireMock stub replay. Replays a static script against a booted simulator — does NOT record new network traffic. Returns a taskId; poll_task_status streams live output, get_task_result returns final pass/fail. With MCA_FLOW_PAUSE_RESUME=on, pauses any active recording for the run and auto-resumes; otherwise errors if a session is active. cancel_task interrupts mid-flow.

Inputs: yamlPath (required), env, platform, stubsDir, +4 more. Returns: kind, status, taskId, startedAt

stop_and_compile_testStop and Compile TestA
Idempotent

Stop the active recording session and synthesize a Maestro YAML test script. Correlates captured UI interactions with network payloads and embeds JavaScript assertions for analytics events.

Inputs: sessionId (required), conditions, outputPath, mockingConfig. Returns: yaml, stubsDir, yamlPath, sessionId, +7 more

take_screenshotTake ScreenshotA
Read-only

Capture a PNG of the current simulator/emulator screen; returns an absolute path the agent can read back. Auto-retries on transient failures; returns passed:false on terminal failure instead of throwing.

Inputs: platform (required), deviceUdid (required), timeoutMs, outputPath. Returns: output, passed, platform, imagePath, +3 more

uninstall_appUninstall AppA
DestructiveIdempotent

Remove an installed app from a booted simulator/emulator, wiping its storage. Use before install_app to guarantee a clean-state launch. iOS: xcrun simctl uninstall; Android: adb uninstall.

Inputs: bundleId (required), platform (required), deviceUdid (required). Returns: output, passed, bundleId, platform, +2 more

verify_network_absentVerify Network AbsentA
Read-onlyIdempotent

Assert that a list of forbidden network calls do NOT fire within withinMs of a referenced UI action. Use to verify cache hits or absence of unnecessary prefetching.

Inputs: sessionId (required), afterAction (required), forbiddenCalls (required), withinMs, +1 more. Returns: passed, verdict, violations, anchorTimestamp

verify_network_deduplicationVerify Network DeduplicationB
Read-onlyIdempotent

Assert that requests are not duplicated beyond a threshold. Groups by URL or extracted GraphQL operationName; flags groups exceeding maxDuplicates.

Inputs: sessionId (required), groupBy, matcher, withinMs, +3 more. Returns: passed, verdict, duplicates

verify_network_error_handlingVerify Network Error HandlingA
Read-onlyIdempotent

Assert that specific error responses appear in the session. Pair with WireMock stubs to verify the app behaves correctly under injected failures.

Inputs: sessionId (required), expectedErrors (required), withinMs, afterAction, +1 more. Returns: passed, verdict, errorsFound, missingErrors

verify_network_on_screenVerify Network On ScreenA
Read-onlyIdempotent

Assert that a list of expected network calls all fire within withinMs of a referenced UI action. Use to verify that navigating to a screen triggers the right API calls.

Inputs: sessionId (required), afterAction (required), expectedCalls (required), withinMs, +1 more. Returns: extras, passed, matched, missing, +2 more

verify_network_parallelismVerify Network ParallelismA
Read-onlyIdempotent

Assert that a set of matching network requests all start within a given time window (e.g., SDUI queries firing in parallel). Fails if fewer than minExpectedCount match or the total span exceeds maxWindowMs.

Inputs: matcher (required), sessionId (required), maxWindowMs (required), minExpectedCount (required), +1 more. Returns: count, events, passed, verdict, +2 more

verify_network_payloadVerify Network PayloadA
Read-onlyIdempotent

Assert JSON response fields via dot/bracket paths: equals, contains, exists, type, minLength. More flexible than verify_sdui_payload, which only supports exact field matching.

Inputs: sessionId (required), responseAssertions (required), url, matcher, +1 more. Returns: event, passed, verdict, mismatches

verify_network_performanceVerify Network PerformanceA
Read-onlyIdempotent

Assert latency budgets: max per-request durationMs and/or max total first-start→last-end across a matcher. Reports p50/p95 stats and excludes events with unknown durations from percentiles.

Inputs: matcher (required), sessionId (required), withinMs, maxTotalMs, +3 more. Returns: p50, p95, count, passed, +6 more

verify_network_sequenceVerify Network SequenceA
Read-onlyIdempotent

Assert that a set of network calls happened in a specific chronological order. Strict mode fails if any unmatched event appears between ordered matches.

Inputs: sessionId (required), expectedOrder (required), strict, matcher, +3 more. Returns: passed, missing, verdict, actualOrder, +1 more

verify_sdui_payloadVerify SDUI PayloadA
Read-onlyIdempotent

Validate that a specific SDUI network response matches expected fields. Returns matched status and a list of any mismatches. Used to assert correct server-driven content is rendered by the UI.

Inputs: url (required), sessionId (required), filterDomains, expectedFields. Returns: actual, matched, mismatches

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 33 tools

    Disambiguation4/5

    Most tools have clearly distinct purposes, but the many verify_network_* variants (absent, deduplication, error_handling, on_screen, parallelism, payload, performance, sequence) could cause confusion for an agent if descriptions are not read carefully. Also, start_flow and start_test are similar but serve different functions. Overall, well-disambiguated with minor overlap.

    Naming Consistency2/5

    Naming is inconsistent: some tools use snake_case (boot_simulator, cancel_task), while others use camelCase (execute_ui_action, get_ui_hierarchy, get_network_logs). Additionally, verbs are not uniformly placed (e.g., list_devices vs. get_ui_hierarchy). This lack of pattern makes the set harder to navigate.

    Tool Count2/5

    With 33 tools, the set is too large for easy comprehension. The server covers a broad domain (device management, UI interaction, network mocking, verification), but the number exceeds the recommended range (3-15) and violates the 'too many' threshold (25+). Some tools like the many verify_network_* variants could be consolidated.

    Completeness5/5

    The tool set is comprehensive for mobile automation: device management (boot, list, install, uninstall), UI inspection and interaction (get_ui_hierarchy, execute_ui_action), recording and playback (start_recording_session, stop_and_compile_test, start_flow, start_test), network mocking and verification (set_mock_response, all verify_network_* tools), and task management. No obvious gaps for the stated purpose.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      An MCP server that lets AI agents control iOS and Android devices (tap, scroll, type, take screenshots, read UI trees, and run code). Works with multiple devices at the same time.
      94 npm
      54
      MIT
    • A
      license
      B
      quality
      D
      maintenance
      An MCP server that lets AI agents see, tap, type, scroll, and assert inside live Flutter apps — no pre-written tests required.
      28
      18 npm
      MIT
    • F
      license
      Not graded
      quality
      C
      maintenance
      An MCP server that lets AI agents drive real mobile-app automation on connected devices, enabling natural-language test tasks, test case generation, and app/build management for Android and iOS.
      -