android-mcp-server
Provides tools for interacting with Android devices and emulators via adb: listing devices, reading logcat, crashes and ANRs, launching apps, taking screenshots, installing APKs, and running adb shell commands.
Runs Gradle tasks through the project's gradlew and returns compiler errors, the "What went wrong" section, and the output tail.
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.
android-mcp-server
An MCP server that gives Claude Code, and any other MCP client, access to your Android device and build. It can read logcat, pull crash stack traces and ANRs, run Gradle tasks, install APKs and take screenshots.
"The app crashes when I open settings. Find out why and fix it."
Claude can now do the whole loop itself: launch the app, read the crash, open the file, fix it, rebuild, reinstall and confirm it's gone.
All screenshots were captured by the server's own screenshot tool on an Android emulator.
Why
Debugging Android with an AI assistant usually means copying logcat into the chat by hand. Logcat is noisy, stack traces get cut off, ANR traces are buried in dumpsys dropbox, and Gradle errors sit at the bottom of 2,000 lines of output. This server turns each of those into a tool call that returns structured, trimmed results.
Related MCP server: phone-control
Tools
Tool | What it does |
| Connected devices and emulators with state and model |
| Recent logs, filtered by app package (its PID), minimum priority, tag or text |
| One record per |
| ANRs from the system dropbox, with subject and the |
| Runs any task with the project's |
| Starts an app's launcher activity |
| Device screen as a PNG image |
|
|
| Clears the main, system and crash buffers so the next read shows only new output |
| Runs any |
Start the server with --read-only to turn off install_apk, clear_logcat and adb_shell.
What the tools return
Real output from an emulator run.
get_crashes: one record per FATAL EXCEPTION, with the full stack trace instead of a truncated logcat paste.
gradle_build: a failing build reduced to the part that matters, instead of 2,000 lines of Gradle output.
logcat: only the lines from the app's running process.
Install
Requirements: Node 20+, and adb (Android SDK platform-tools) on PATH or in $ANDROID_HOME/platform-tools.
git clone https://github.com/shekharpande/android-mcp-server
cd android-mcp-server
npm install && npm run buildClaude Code
claude mcp add android -- node /absolute/path/to/android-mcp-server/dist/index.js
# or read-only:
claude mcp add android -- node /absolute/path/to/android-mcp-server/dist/index.js --read-onlyClaude Desktop, Cursor and other MCP clients
{
"mcpServers": {
"android": {
"command": "node",
"args": ["/absolute/path/to/android-mcp-server/dist/index.js"]
}
}
}Using it with your app
1. Connect a device or emulator
Start an emulator from Android Studio's Device Manager, or from the command line:
emulator -list-avds # names of your virtual devices
emulator -avd Pixel_8 & # start oneA physical phone works too: turn on Developer options → USB debugging and plug it in, or use Wireless debugging and adb pair / adb connect. Check that it shows up:
adb devices
# emulator-5554 deviceIf more than one device is connected, tell Claude which one to use (e.g. "use emulator-5554"). Every tool takes an optional serial.
2. Find your app's package name
Tools that target an app need its package name (the applicationId), not the app's display name:
grep applicationId app/build.gradle* # from your project
adb shell pm list packages -3 # apps you installed on the deviceDebug builds often have a suffix such as .debug, so com.example.app installs as com.example.app.debug. Use the name that's actually installed.
3. Open Claude Code in your app's project
cd ~/AndroidStudioProjects/MyApp
claudeStarting Claude in the project folder lets it read and edit your source, and pass the right projectDir to gradle_build. Run /mcp to check that the android server is connected.
4. Ask in plain language
Claude picks the tools for you. Some prompts that work well:
Goal | Prompt |
Fix a crash | "Launch com.example.app, open the settings screen, then use get_crashes to find out why it crashes and fix it." |
Investigate a crash that already happened | "Check get_crashes for com.example.app and explain the most recent one." |
Build, install and run | "Build the debug APK, install it on the emulator and launch it. Take a screenshot when it's open." |
Fix build errors | "Run assembleDebug and fix whatever fails." |
Run tests or lint | "Run testDebugUnitTest and fix the failing tests." / "Run lint and fix the errors." |
Debug a freeze | "The app froze earlier. Check list_anrs for com.example.app and tell me what the main thread was blocked on." |
Read logs | "Show me warnings and errors from com.example.app's logcat since I tapped Login." |
Check the UI | "Take a screenshot and tell me if the layout looks broken." |
A typical fix loop
Reproduce:
clear_logcat, thenlaunch_app, then trigger the bug yourself on the device or tell Claude what to tap viaadb_shell input ....Diagnose:
get_crashes(orlist_anrs/logcat) returns the exception and stack trace. Claude maps the frames to files in your project.Fix: Claude edits the source.
Verify:
gradle_build(assembleDebug),install_apkwithapp/build/outputs/apk/debug/app-debug.apk, thenlaunch_appagain. Claude repeats the steps and confirms withget_crashesthat the crash is gone.
Tips
logcatwithpackageonly sees a running app. It filters by the app's current process ID. If the app has crashed or isn't open, launch it first, or leave outpackageand usegrepinstead.Clear before reproducing. Run
clear_logcatfirst soget_crashesandlogcatonly show what happened during this attempt.The first Gradle build is slow. A cold build can take several minutes while Gradle downloads dependencies. Later builds use the cache. Raise
timeoutMinutesfor big projects.Use
--read-onlyon a personal phone. It still lets Claude read logs, crashes and screenshots, but not install apps or run shell commands.Release builds: stack traces from minified (R8/ProGuard) builds are obfuscated. Debug builds give readable traces.
Configuration
Env var | Default | Purpose |
|
| adb binary to use |
| unset | Set to |
|
| Max characters returned per tool call (longer output is cut, keeping the end) |
Architecture
exec.tsruns every command throughexecFilewith an argument array. Nothing goes throughshon the host, so tool arguments can't inject host commands.parsers.tscontains pure functions that turnadb devices -l, the crash buffer,dumpsys dropboxand Gradle output into typed records. They are unit-tested without a device.tools.tsregisters the tools, validates input with zod (package names, Gradle task names and flags are checked with regexes) and keeps output within the context budget.
Safety notes
adb_shellruns whatever command it's given on the device. Your MCP client asks for approval before each call, but use--read-onlyif you don't want that tool available at all.gradle_buildonly runs thegradlewin the directory you pass. Task names and flags are restricted to safe characters.
Development
npm test # parser unit tests (vitest)
npm run typecheck
npm run dev # tsc --watchLicense
MIT
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
Remote MCP for Android CLI agent build gate, structured receipts, audit logs, and reviewer-ready evi
Cloud Android devices for AI agents: install an APK, read the screen, tap, type, read logcat.
Remote MCP server to control your Android phone from AI assistants with per-app permissions.
Give your AI agent a real cloud Android phone: push APKs, drive it, get screenshots and logs.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables 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.11 npmMIT
- AlicenseNot gradedqualityBmaintenanceEnables controlling an Android device from an MCP client via ADB, including wireless debugging discovery, UI-tree inspection, and performing taps, swipes, typing, app actions, and shell commands without relying on screen coordinates.MIT
- AlicenseNot gradedqualityBmaintenanceEnables coding agents to build, install, and launch Android apps on emulators and physical devices, automate UI interactions, inspect logcat/crash diagnostics, measure JaCoCo coverage, and discover or scaffold projects through an MCP server.MIT
- AlicenseNot gradedqualityBmaintenanceEnables MCP clients to control an Android phone by reading the screen, taking screenshots, tapping, typing, swiping, opening apps, and running multi-step tasks. It also supports on-device Android app testing and optional adb commands.2,285 npm9MIT