MobileAgentMCP
Allows agents to drive the Instagram Android app through UI automation, including reading structured screen elements, tapping, swiping, typing, extracting typed fields from known screens, and recovering the Reels feed when the engagement overlay fails to render.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
MobileAgentMCP
An MCP server that lets an agent drive a real Android phone — read the screen as structured UI elements, tap, swipe, type, and extract clean typed fields from known app screens.
Built and verified against a realme narzo 50 Pro 5G (RMX3395, Android 14) driving Instagram 440.1.0.46.86, unrooted.
Why structured UI, not screenshots
A raw uiautomator hierarchy for one Instagram Reel is ~70 KB of XML. The compact element form this server returns is typically 1–3 KB for the same screen, and it is machine-readable rather than requiring vision.
Screenshots are still available, but screenshot returns a file path, not
inline image data, so it can never silently blow up an agent's context.
// ui_dump output, trimmed
{
"package": "com.instagram.android",
"screen": "reels_viewer",
"app_version": "440.1.0.46.86",
"dump_ms": 358,
"total_elements": 39,
"elements": [
{"i": 12, "id": "clips_author_username", "text": "ally.verma_", "c": [402,1964], "f": "C"},
{"i": 18, "id": "like_count", "text": "The like number is 9732. View likes.", "c": [990,1041], "f": "C"}
]
}i is the index used by tap(i=…). c is the tap centre. f flags:
C=clickable, S=scrollable, *=selected.
Related MCP server: MobileMCP
Install
pip install -r requirements.txtRequires adb on PATH or at ADB_PATH. Enable USB debugging on the phone.
Register with Claude Code
.mcp.json in the repo root already does this. From the repo:
claude mcp add mobileagent -- python -m mobileagent.serverOr rely on the checked-in .mcp.json when Claude Code opens this directory.
Tools
Device — devices, device_info, foreground_app, launch_app, list_apps
Reading the screen — ui_dump, find_element, extract_fields, screenshot
Acting — tap, swipe, text_input, press_key
Registry / maintenance — check_drift, record_baseline, registry_info
App-specific — reset_reels_feed
Selector registry and drift detection
App UIs change without warning. Selectors live as data in
src/mobileagent/selectors/<app>.json, pinned to the app version they were
verified against.
# after an app update, or when extraction starts returning nulls
check_drift() # -> exactly which resource-ids vanished or appeared
record_baseline() # -> pin the new version once you have re-verifiedThree rules the registry enforces, each learned the hard way:
Values often sit on anonymous child nodes, not on the resource-id that names them. Instagram's caption lives under
clips_caption_componentand the audio track underclips_author_info_component;media_album_art_buttonmerely carries the literal string"Audio". Every element therefore reports itsanchor= nearest ancestor id.Intermittent anchors are marked
optionalso they never read as drift. Instagram'sscrubberappears in only ~29 % of dumps; treating it as required makes most dumps look broken and trains you to ignore the warning that matters.Fail loud. A missing anchor returns
nulland appears in_unavailable. It never falls back to a guess — a plausible wrong value is worse than a gap.
Known app issues
Encoded in the registry so they aren't misdiagnosed as drift:
Issue | Behaviour |
| The first reel after entering the Reels tab often renders with no engagement overlay — counts, caption and audio absent while username and video are fine. An Instagram bug. |
Backends
Phase | Backend | State |
1 |
| current |
2 | on-device AccessibilityService app | planned |
Phase 2 will sit behind the same tool surface, so agent-side code does not change.
They cannot run at the same time.
uiautomator2is aUiAutomation, which is itself a special AccessibilityService, and Android permits only one. Phase 2 is a swap, not a merge.
Platform notes
Not every target needs device automation, and two have sanctioned APIs that are strictly better than driving a phone:
Target | Recommended route |
Official API — covers the authenticated home feed. Don't scrape. | |
Custom Search JSON API + Programmable Search Engine. | |
No sanctioned path; device automation is the route. | |
X / Twitter | API is paid and gated; scraping is aggressively detected. |
Automated collection generally breaches these platforms' terms regardless of transport — wrapping it in MCP changes the convenience, not the permission. Use throwaway accounts and keep volume human-plausible.
Out of scope by design: defeating consent dialogs, CAPTCHA handling, device-identity spoofing, root exploits, and any anti-bot evasion. Android's security model is treated as a boundary, not an obstacle. In particular, MediaProjection consent is one tap per capture session and cannot legitimately be bypassed — not even by a device-owner or privileged app.
Device setup (ColorOS / realme)
ColorOS kills background services aggressively. For anything long-running:
Settings > Apps > App management > <app> > Battery usage
-> Allow background activity
-> Allow auto launchplus adb shell cmd deviceidle whitelist +<package>. Without the UI toggle
the ADB whitelist alone is not enough — services die within seconds.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Give your AI agent a real cloud Android phone: push APKs, drive it, get screenshots and logs.
Cloud Android phones for AI agents: create a phone, read the screen, tap, type, install APKs, park.
Let AI agents control Android and iOS devices on Mobilerun Cloud: screen, input, apps, workflows.
Let your AI agent control real iPhones: screenshots, tap, swipe, type and open apps.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables an agent to inspect and interact with Android emulators or physical devices via ADB, capturing UI snapshots, tapping nodes, typing text, and reading app logs.10MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to operate a real Android phone through its accessibility service, exposing screen trees with stable refs, taps, typing, gestures, notifications, apps, and other device controls.5MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to safely use real Android phones by listing devices, reading screens and UI elements, tapping, typing, launching apps, and running workflows only within allowed permissions and approvals, with every step recorded in an audit log.40 npmMIT
- AlicenseNot gradedqualityAmaintenanceEnables AI agents to see and control Android devices, with fast input, screenshots, UI element discovery, app and file management, shell access, and audio/video streaming or recording.357 npmMIT