scrcpy-agent
This server is an MCP server for remotely controlling and inspecting an authorized Android device over ADB, with a visible scrcpy screen mirror. It can list/select devices and read device info; start, stop, and check a configurable scrcpy mirror; take validated screenshots; dump and search the UI hierarchy; tap UI elements or coordinates; swipe, long-press, press allowlisted keys, and type text; list, inspect, launch, stop, install, and clear data for allowlisted apps; list and set runtime permissions; capture filtered/redacted logcat and retrieve crash/ANR reports; poll for UI conditions or screen changes; and run bounded, sanitized evidence sessions with notes. Mutating actions like app install, data clear, and permission changes require explicit approval, sensitive packages are blocked by default, and operations fail closed without generic shell access.
Allows observing and controlling an authorized Android device over USB via ADB, including screenshots, UI hierarchy inspection, semantic interaction, app inspection, logcat capture, and optional scrcpy mirroring.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@scrcpy-agentwhat's on the device screen right now?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Android Agent MCP (android-agent-mcp)
Android Agent MCP is a local MCP server that enables AI agents to control an explicitly authorized Android phone over ADB, with a visible server-owned scrcpy mirror. It exposes screenshots, UIAutomator state, semantic interaction, package diagnostics, bounded logcat, evidence recording, and reversible phone controls. scrcpy is the live-view subsystem, not the product's control plane.
The server does not call a language model and does not bypass Android locks, authentication, Play Integrity, DRM, root detection, permission prompts, or enterprise policy.
Status
Implemented and locally verified:
TypeScript build and strict type-checking
Automated unit, integration, protocol, and scrcpy tests, plus a separate opt-in physical-device smoke test
ADB/scrcpy adapters with injectable command runners
Device discovery, explicit selection, screenshots, UIAutomator parsing, semantic selectors, input, app inspection, logcat, scrcpy ownership, and evidence sessions
Path-restricted APK installation and approval-gated mutations
Physical-device validation is opt-in and remains a separate gate. The full MCP stdio path has been validated on an authorized Samsung SM-A075F: discovery, selection, device information, visible scrcpy, app launch, screenshot image content, UI dump/find/tap, bounded logcat, evidence completion, and owned-mirror shutdown.
Related MCP server: @wilsonbeam/openclaw-adb-mcp
Requirements
Linux desktop is the supported initial platform; Manjaro/Arch is the primary tested distribution.
Node.js 22 or newer.
Android platform-tools (
adb).scrcpyis required by the default visible-mirror workflow; setANDROID_AGENT_MCP_MIRROR_AUTO_START=falsefor headless operation.A phone with Developer Options and USB debugging enabled, with this host’s RSA key accepted.
The server does not install ADB or scrcpy. Verify the host tools without changing system state:
adb version
scrcpy --version
adb devices -lThe repository also provides a read-only environment check:
npm run check:environment
# Add -- --require-scrcpy when mirroring is required.It never installs packages, changes udev rules, restarts ADB, or uses elevated privileges.
Install from a checkout
git clone https://github.com/EF-Code/android-agent-mcp.git
cd android-agent-mcp
npm run install:local
npm run verifynpm run install:local runs the locked local dependency install, builds the server, and prints the resolved absolute MCP entrypoint and Codex registration command. It does not install system packages, change udev rules, restart ADB, or use elevated privileges. Use npm run install:local -- --skip-dependencies when dependencies are already installed; add --check-environment to run the read-only ADB/scrcpy preflight during installation.
The executable is then:
/absolute/path/to/android-agent-mcp/dist/index.jsRun it directly over stdio:
node /absolute/path/to/android-agent-mcp/dist/index.jsThe process reads MCP messages from stdin and writes MCP messages to stdout. Diagnostics go to stderr.
Codex registration
Resolve the checkout path first, then register the local stdio server:
PROJECT_DIR="$(pwd)"
codex mcp add android-device -- node "$PROJECT_DIR/dist/index.js"
codex mcp listThe official OpenAI MCP guidance documents local stdio servers and the same codex mcp add <name> -- <command> shape. Restart Codex after registration so the server and its tools are loaded. A project-scoped .codex/config.toml can also be used for trusted projects.
Configuration
Configuration is optional. Without a file, the server enables broad non-sensitive phone control and a visible scrcpy mirror. Select a JSON file with ANDROID_AGENT_MCP_CONFIG:
ANDROID_AGENT_MCP_CONFIG=/absolute/path/to/android-agent-mcp.json \
node /absolute/path/to/android-agent-mcp/dist/index.jsExample:
{
"adbPath": "adb",
"scrcpyPath": "scrcpy",
"autoSelectSingleDevice": true,
"allowedPackages": ["*"],
"sensitivePackages": ["*.bank.*", "*.wallet.*", "*.password*"],
"allowedRuntimePermissions": [],
"allowedApkRoots": ["/home/user/projects"],
"evidenceRoot": "/home/user/android-agent-mcp-evidence",
"maxScreenshotBytes": 25000000,
"maxApkBytes": 500000000,
"maxLogBytes": 2000000,
"maxCommandOutputBytes": 4000000,
"maxEvidenceBytes": 100000000,
"maxEvidenceFiles": 500,
"evidenceRetentionMaxAgeMs": 604800000,
"defaultTimeoutMs": 15000,
"uiSnapshotMaxAgeMs": 3000,
"approvalMode": "prompt",
"mirror": {
"autoStart": true,
"maxSize": 1600,
"maxFps": 30,
"audio": false
}
}Environment overrides use the ANDROID_AGENT_MCP_ prefix. The former ANDROID_MCP_ and ANDROID_DEVICE_MCP_ variables remain accepted as deprecated compatibility aliases, with canonical variables taking precedence. Lists are comma-separated. Configuration never contains a phone PIN, password, account credential, API key, cookie, or authorization token.
The default allowedPackages policy is *, so the agent does not require manual app selection. Banking, wallet, and password-style package patterns remain blocked by default; set ANDROID_AGENT_MCP_SENSITIVE_PACKAGES='' only for a deliberately trusted session that needs literal all-app control.
Preferred operating loop
Call
device_list.Call
device_selectwhen selection is not unambiguous.Call
device_infoand confirm the target.Use
ui_dump/ui_findbefore coordinate tools.For each action, observe, act, wait briefly, observe again, and report uncertainty.
General valid packages are available by default; honor configured sensitive-package blocks.
Mutating tools remain fail-closed unless the host explicitly uses
approvalMode: "allow"; keep Codex write approval enabled as an additional client control.Selecting a device makes one best-effort attempt to start the visible scrcpy mirror unless
mirror.autoStartis disabled. A scrcpy failure is returned as a warning and never blocks ADB tools. Aftermirror_stop, usemirror_startto reopen it explicitly.Use
evidence_begin, explicitly capture the desired artifacts, thenevidence_finish.
If the selected phone disconnects or becomes unauthorized, the server invalidates retained UI state and requires an explicit device_select again after reconnecting, even when the serial is unchanged.
The server also finalizes an active evidence session during graceful shutdown after cleaning up its owned scrcpy process.
No generic shell tool is exposed.
Tests
npm run typecheck
npm test
npm run build
npm run verify
npm pack --dry-run
npm audit --omit=devThe automated suite uses fake/injectable command boundaries and a child-process MCP client. It does not require a phone and does not install packages or alter device state.
Opt-in physical tests are separate:
export ANDROID_AGENT_MCP_PHYSICAL=1
export ANDROID_AGENT_MCP_TEST_PACKAGE=com.example.androiddevicetest
export ANDROID_AGENT_MCP_TEST_SELECTOR='{"text":"7"}'
npm run test:physicalThe physical harness remains deliberately explicit: it requires a designated test package, a repeatable harmless selector, and exactly one connected authorized phone. It starts the actual stdio MCP server and drives the complete protocol path. This fixture is separate from normal MCP operation, where the default policy permits all valid non-sensitive packages. Destructive tests are not run automatically.
Tool groups
Read-only tools include device_list, device_info, mirror_status, screen_capture, ui_dump, ui_find, app_list, app_info, permissions_list, logcat_capture, and logcat_crashes.
Interactive tools include device_select, mirror_start, mirror_stop, ui_tap, screen_tap, screen_swipe, screen_long_press, key_press, text_type, app_launch, app_stop, and wait_for_ui.
Approval-required tools include app_install, app_clear_data, and permissions_set. Evidence tools are local artifact operations with bounded storage and redaction.
Limitations
USB ADB and display 0 are the initial supported targets.
UIAutomator may omit WebViews, games, video, Compose accessibility gaps, and custom canvases; warnings are surfaced.
Node IDs are snapshot-local and expire after the configured freshness window or a foreground change.
Default text entry is printable ASCII only and rejects password fields.
scrcpy audio/control flags are mapped only when supported by the detected version.
Logcat duration captures are bounded live reads;
sinceselects a bounded timestamp dump.No wireless pairing, multiple-device parallel control, OCR, continuous video MCP frames, root features, iOS, or remote listener is provided.
See SECURITY.md and the documents under docs/ for operational details.
Name compatibility
The npm distribution is @ef-code/android-agent-mcp. The primary executable is android-agent-mcp; android-mcp and scrcpy-agent remain deprecated executable aliases for existing local setups. The MCP server registration name and protocol identity remain android-device, so existing Codex MCP configuration does not need to be renamed. Environment precedence is ANDROID_AGENT_MCP_*, then deprecated ANDROID_MCP_*, then older ANDROID_DEVICE_MCP_*.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityAmaintenanceMCP server that gives AI agents full vision and control over Android devices via ADB and scrcpy. Supports screenshots, input, apps, UI automation, shell, files, and clipboard.3825970MIT
- FlicenseBqualityDmaintenanceMCP server for Android device automation via ADB, enabling screen control, phone functions, app management, and device control.301
- Alicense-qualityDmaintenanceEnables MCP-compatible agents to control an Android device over the network via ADB, providing tools for shell commands, screen capture, UI inspection, file operations, and input simulation.17MIT
- Flicense-qualityDmaintenanceA powerful MCP server that provides comprehensive Android device automation capabilities through ADB, enabling AI agents to interact with Android devices for testing, automation, and device control tasks.1
Related MCP Connectors
Remote MCP for Android CLI agent build gate, structured receipts, audit logs, and reviewer-ready evi
MCP server for Appcircle mobile CI/CD platform.
Personal assistant MCP server with search, execute, packages, jobs, secrets, and integrations.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/EF-Code/android-agent-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server