android-build-mcp
Provides tools for interacting with Android devices and apps, including building, testing, installing, launching, UI inspection, screen capture, input simulation, logging, and device management via adb.
Enables running Gradle builds and tests, with concise failure summaries and pre-build checks for JDK/Gradle compatibility and other known failure modes.
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., "@android-build-mcpThe start button doesn't do anything on the tablet. Fix it."
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-build-mcp
An MCP server that gives a coding agent hands and eyes on an Android device.
Your agent can already shell out to gradlew and adb. The problem is what that costs: a failed build dumps four thousand lines of task progress into the context window, tap coordinates get guessed off a screenshot, and a JDK/Gradle mismatch sends it bisecting application code for an hour over an error that had nothing to do with the app.
This is the build-debug loop made cheap. 19 tools covering build, test, install, launch, screenshot, UI inspection, input, logs, and toolchain diagnosis — each one shaped to return the smallest thing that answers the question.
You: "The start button doesn't do anything on the tablet. Fix it."
Agent: android_doctor -> toolchain OK, Gradle 8.7 / JDK 17 compatible
android_build -> assembleDebug + install + launch
android_set_rotation -> landscape
android_dump_ui -> Button "start" at (1580, 890), clickable=false
android_logcat -> IllegalStateException in onMeasure
...reads the layout, edits it, rebuilds, taps the button, confirmsInstall
Requires Node 18+, the Android SDK platform-tools, and a JDK (Android Studio's bundled one is found automatically).
Not on npm yet — install from source:
git clone https://github.com/jjs03111/android-build-mcp
cd android-build-mcp
npm install && npm run buildClaude Code
claude mcp add android -- node /absolute/path/to/android-build-mcp/dist/index.jsAny MCP client — add to the client's server config:
{
"mcpServers": {
"android": {
"command": "node",
"args": ["/absolute/path/to/android-build-mcp/dist/index.js"]
}
}
}No configuration needed if you have a standard Android Studio install. Run android_doctor to confirm.
Related MCP server: Android MCP Server
What this does beyond wrapping adb
It knows why builds fail. JDK/Gradle incompatibility is checked before the build starts, so you get "JDK 23 is newer than Gradle 8.7 supports (max 22)" instead of Unsupported class file major version 67 after a two-minute wait. SDK location not found, signature mismatches on install, and INSTALL_FAILED codes all come back with the actual remedy attached.
It doesn't flood the context. A failed Gradle build is thousands of lines, nearly all of it task progress. The failure summary keeps the compiler diagnostics and the FAILURE: block and drops the rest — typically a 50%+ reduction, all of it noise. Logcat filters to your app's pid. android_dump_ui returns text and coordinates instead of a megabyte of screenshot when what you needed was the label on a button.
It recognises failures it has seen before. Every failure path — Gradle, install, crash logs — runs its output past a set of known Android failure modes whose symptoms point nowhere near their causes. When one matches, the fix arrives attached to the error, not in a document somebody has to remember to consult:
Gradle refusing to run on a too-new JDK (
Unsupported class file major version)SDK location not foundon a fresh clone, becauselocal.propertiesis gitignoredOEM battery management killing foreground services within seconds on Samsung and Xiaomi
adb shell input textsilently dropping every non-ASCII characterGridLayoutcells collapsing when weights meetwrap_contentPackage visibility filtering returning empty lists on Android 11+
Signature mismatches on install, and stale package references after an external uninstall
android_pitfalls exposes the same set for browsing and searching. An agent that hits one of these otherwise starts bisecting application code that was never the problem.
It finds your toolchain. adb via ANDROID_HOME, the platform's standard SDK locations, then PATH. The JDK via Android Studio's bundled JBR — chosen because it is version-matched to AGP, unlike whatever is on PATH. Gradle is launched through the wrapper's main class rather than gradlew.bat, which both sidesteps Node's refusal to spawn .bat files and guarantees the validated JDK is the one that runs.
Tools
Device
Tool | Purpose |
| Connected devices with Android version, screen size, density, rotation |
| Promote a USB device to wireless adb, or reconnect to a known address |
Build
Tool | Purpose |
| Gradle assemble, optionally install and launch in one call |
| Run unit or instrumented tests, reporting which ones failed |
| Install an APK |
| Start an app, optionally cold |
| Wipe an app's data without uninstalling it |
| Remove an app |
Inspect
Tool | Purpose |
| PNG of the screen, inline or to a file |
| View hierarchy as text, with tap coordinates for every element |
| Logs filtered by package, tag, priority, or the crash buffer |
| Arbitrary |
Interact
Tool | Purpose |
| Tap or long-press |
| Swipe, scroll, drag |
| Type into the focused field |
| Back, Home, Enter, arrows, volume |
| Force an orientation, or restore auto-rotate |
Diagnose
Tool | Purpose |
| Check adb, SDK, JDK, devices, and JDK/Gradle compatibility |
| Look up known failure modes by error text, topic, or keyword |
How this compares
vs. letting an agent run gradlew and adb through a shell tool. It already can, and when a build succeeds the difference is small. The difference shows up on failure and at scale: a failed build here returns the compiler errors instead of several thousand lines of task progress, a JDK/Gradle mismatch is caught before the build rather than two minutes into it, logs come back scoped to your app's process, and android_dump_ui hands over exact tap coordinates instead of the agent estimating them off a screenshot. Shell output is also unstructured, so every result has to be re-read by the model.
vs. mobile-mcp and other device-control servers. Those cover device automation — tap, swipe, screenshot, element inspection — and mobile-mcp covers iOS too, which this does not. The overlap is real, and if driving a device is all you need, they are the more established choice. What they do not cover is the build side: compiling the project, resolving the application id out of Gradle, installing, running tests, and explaining why the toolchain refused. That is what this server is for. Testing an app you did not build? Prefer theirs. Writing the app? This closes the edit-run-read cycle.
vs. Android Studio. Not a competitor. This exists so an agent can do the parts of the loop that do not need a person watching. Keep the IDE open.
Configuration
Everything is auto-detected. Override only if you need to:
Variable | Purpose |
| Android SDK root |
| Path to the adb binary |
| JDK to build with |
Security
android_shell runs arbitrary commands on the connected device, and the build tools execute the target project's Gradle wrapper — which is code from that project. Point this at repositories you trust, the same way you would before opening one in an IDE. Nothing is sent anywhere: every tool talks only to the local adb server and the local filesystem.
android_clear_data and android_uninstall destroy app data irrecoverably; both are marked with destructiveHint so clients that gate destructive tools can prompt before running them.
Known limitations
android_input_textcannot type non-ASCII characters, nor the literal sequence%s. Both are limitations of Android'sinput textcommand: it is ASCII-only, and it decodes%sto a space with no escape available (even%%sdecodes to%). The tool rejects both cases with an explanation rather than silently mangling the text. Use an adb-driven IME (ADBKeyBoard) for CJK.android_dump_uicannot see insideWebViewcontent; uiautomator only exposes the WebView node itself. Useandroid_screenshotfor WebView-based UIs.android_dump_uicannot see past a locked screen either — you get the keyguard, not the app.Wireless adb requires the host and the device to be on the same LAN. A VPN interface on the host does not bridge to the device's network, and routers with AP isolation block it outright.
android_connect_wifidetects the subnet mismatch case and says so rather than reporting a bare timeout.Release builds require the project's own signing config.
Developed and manually verified on Windows against a physical device (Galaxy A16, Android 16) and an emulator (API 35). macOS and Linux run the unit tests and a server smoke check in CI, and Linux additionally runs the full end-to-end suite on an emulator — but neither has been driven by hand, so rough edges in toolchain discovery are likelier there. Reports welcome.
Development
npm install
npm run build
npm test # unit tests
npm run typechecknpm test needs no device. The end-to-end suite does — start an emulator or plug in a phone, then:
node test/e2e/run.mjsIt prefers an emulator when one is running, so it will not rotate the screen or inject input on a phone you happen to have plugged in.
Contributing
The most useful contribution is a pitfall. If some Android failure cost you an afternoon because the symptom pointed nowhere near the cause, add it to src/services/pitfalls.ts: the symptom as you observed it, the actual cause, the fix, and — if the error has a recognisable signature — a regex so it fires automatically at the moment of failure instead of waiting to be looked up.
Bug reports that include the output of android_doctor are much faster to act on.
License
MIT
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
- AlicenseBqualityAmaintenanceA comprehensive MCP server that enables AI agents to interact with Android devices through Android Debug Bridge (ADB), offering 198 tools for device control, app management, diagnostics, and more.Last updated1007313Apache 2.0
- Flicense-qualityDmaintenanceAn MCP server designed for Android development, enabling AI assistants to directly control Android devices for screenshots, UI analysis, app management, and more.Last updated
- AlicenseAqualityCmaintenanceAn MCP server that gives AI agents full control of Android devices and emulators through plain ADB — no companion APK, no extra daemon, no telemetry.Last updated2622MIT
- Alicense-qualityCmaintenanceA comprehensive MCP server for Android Debug Bridge, enabling AI agents to control Android devices through structured tools like launching apps, UI automation, file operations, and log capture.Last updatedMIT
Related MCP Connectors
Remote MCP for Android CLI agent build gate, structured receipts, audit logs, and reviewer-ready evi
Hosted MCP endpoint with realistic fake data for prototyping agents. 12 tools, no setup.
The MCP server for Azure DevOps, bringing the power of Azure DevOps directly to your agents.
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/jjs03111/android-build-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server