Skip to main content
Glama

android-studio-mcp

An MCP server that gives AI coding agents the Android Studio toolchain: Gradle builds, tests, and lint, plus device control through adb, the emulator, and opening files in Android Studio. It isn't tied to one IDE or one AI client. Any MCP client can use it: Claude Code, Claude Desktop, Cursor, Gemini CLI, Codex, VS Code/Copilot, and ChatGPT (through HTTP mode).

Tools

Area

Tools

Setup

environment, project_info, project_apks, sdk_manager, studio_open

Build

build, run_app (build + install + launch, like Studio's ▶), gradle_run, gradle_tasks, test_results, lint_results

Device

devices_list, device_info, app_install, app_uninstall, app_launch, app_stop, packages_list, logcat, adb_shell, file_transfer

UI

screenshot (returns an image), ui_dump (nodes with tap coordinates), input (tap / swipe / text / key)

Emulator

emulator_list, emulator_start, emulator_stop

Jobs

job_status, job_cancel

Live IDE (needs the plugin)

ide_status, ide_editors, ide_read_file (unsaved buffers), ide_problems (one file), ide_project_problems (many files, no Gradle), ide_open, ide_save_all, ide_find_files, ide_screenshot (IDE window: Compose previews, layout editor)

Refactoring (plugin)

ide_find_usages, ide_rename (Shift+F6 semantics, Kotlin/Java aware)

Sync & run (plugin)

ide_gradle_sync (waits for the result), ide_sync_status, ide_actions, ide_action, ide_run_configurations, ide_run

Long operations run as jobs. build, run_app, gradle_run and emulator_start wait up to waitSec (default 50s). If they haven't finished by then, they return {status: "running", id} and the agent polls job_status. This stays under the tool-call timeouts that Cursor, Codex and Gemini CLI enforce.

Build failures come back as structured diagnostics (file, line, column, message). They're parsed from Kotlin, javac, AAPT2, and Gradle's "What went wrong" block.

Related MCP server: DroidAgentKit

Install

npm install
npm run build

Requires Node 20+, an Android SDK (platform-tools; emulator for the AVD tools), and a JDK. The JDK is taken from JAVA_HOME, falling back to Android Studio's bundled JBR.

Configuration (env vars)

Var

Purpose

ANDROID_SDK_ROOT / ANDROID_HOME

SDK location. Falls back to the project's local.properties sdk.dir, then the default SDK path.

ANDROID_STUDIO_HOME

Android Studio install dir (for studio_open and the JBR fallback) when it's not in the default location.

ANDROID_PROJECT_DIR

Default project. Otherwise every project tool takes projectDir, or the server's cwd is searched upward.

ASMCP_TOKEN, ASMCP_PORT

HTTP mode only: auth token (random if unset) and port (default 3939).

Replace the /path/to/... placeholders below with your paths. On Windows, use forward slashes (C:/Users/me/AppData/Local/Android/Sdk) or escaped backslashes in JSON and TOML. If your SDK and Studio are in their default locations, you can leave out ANDROID_SDK_ROOT and ANDROID_STUDIO_HOME.

Claude Code

claude mcp add android-studio --scope user \
  -e ANDROID_SDK_ROOT="/path/to/Android/Sdk" \
  -e ANDROID_STUDIO_HOME="/path/to/Android Studio" \
  -- node "/path/to/android-studio-mcp/dist/index.js"

Leave ANDROID_PROJECT_DIR unset. Claude Code starts the server in the folder you open, so it finds the project automatically.

Claude Desktop: %APPDATA%\Claude\claude_desktop_config.json

Cursor: ~/.cursor/mcp.json (global) or .cursor/mcp.json (per project)

{
  "mcpServers": {
    "android-studio": {
      "command": "node",
      "args": ["/path/to/android-studio-mcp/dist/index.js"],
      "env": {
        "ANDROID_SDK_ROOT": "/path/to/Android/Sdk",
        "ANDROID_STUDIO_HOME": "/path/to/Android Studio",
        "ANDROID_PROJECT_DIR": "/path/to/your/android-project"
      }
    }
  }
}

Gemini CLI: ~/.gemini/settings.json

Same mcpServers block as above. You can add "timeout": 120000 (ms) to give the job tools room.

Codex: ~/.codex/config.toml

[mcp_servers.android-studio]
command = "node"
args = ["/path/to/android-studio-mcp/dist/index.js"]
tool_timeout_sec = 120

[mcp_servers.android-studio.env]
ANDROID_SDK_ROOT = "/path/to/Android/Sdk"
ANDROID_STUDIO_HOME = "/path/to/Android Studio"
ANDROID_PROJECT_DIR = "/path/to/your/android-project"

VS Code / GitHub Copilot: .vscode/mcp.json

{ "servers": { "android-studio": { "type": "stdio", "command": "node", "args": ["…/dist/index.js"], "env": { "ANDROID_SDK_ROOT": "…" } } } }

Android Studio itself (Gemini in Android Studio)

Recent Android Studio versions let Gemini's agent mode use MCP servers. Find the MCP Servers page under the Gemini / AI settings (the exact location varies by version), enable MCP, and paste the same mcpServers JSON.

ChatGPT (HTTP mode)

ChatGPT only talks to remote MCP servers, so run the server in HTTP mode:

ASMCP_TOKEN=<long-random-secret> node dist/index.js --http 3939

Then expose it over HTTPS, for example with cloudflared tunnel --url http://127.0.0.1:3939. In ChatGPT → Settings → Connectors → Developer mode, add https://<tunnel-host>/mcp/<token> with no authentication. The token in the path is the credential. Anyone with that URL can run shell commands on your devices and Gradle on your machine, so keep it secret and stop the tunnel when you're done. Clients that can send headers can use http://127.0.0.1:3939/mcp with Authorization: Bearer <token> instead.

Android Studio plugin (live IDE bridge)

studio-plugin/ is a small IntelliJ Platform plugin. On startup it serves a token-protected HTTP endpoint on 127.0.0.1 (random port) and records the port and token in ~/.android-studio-mcp/bridges/<pid>.json. The MCP server reads that file. When Studio is running, the ide_* tools work, and build / run_app save unsaved editors first. When it isn't running, everything else still works from the CLI.

cd studio-plugin
./gradlew buildPlugin            # compiles against the Studio in ANDROID_STUDIO_HOME (or -PstudioHome=...)

Install studio-plugin/build/distributions/android-studio-mcp-bridge-0.1.0.zip via Settings → Plugins → ⚙ → Install Plugin from Disk, then restart Studio.

Or do the whole cycle with one command: build, quit any running Studio through the bridge (no confirm dialog), install, and relaunch:

node scripts/install-plugin.mjs path/to/project

Calls that open a modal dialog in Studio (a rename conflict, the exit confirmation) wait for the dialog to close. After 20s they return a "UI thread busy" error, and you handle the dialog in Studio.

Development

npm run dev          # tsc --watch
npm run smoke        # spawn over stdio and call environment/project_info/devices_list/emulator_list
node scripts/smoke.mjs logcat '{"lines":20}' ui_dump '{}'   # call arbitrary tools
node scripts/poll.mjs run_app '{"waitSec":30}'              # start a job and poll it to completion
npm test             # parser + HTTP transport tests
npm run inspect      # MCP Inspector UI

Roadmap

  • Plugin: more refactorings (move, extract, change signature), project-wide inspections with quick-fixes, Layout Inspector snapshots, and headless Compose preview rendering (ide_screenshot captures previews shown in the IDE for now).

  • Compose preview rendering, Logcat streaming via MCP notifications, avdmanager create/delete, instrumented-test sharding, and baseline profile / Macrobenchmark helpers.

Available Tools

46 tools
adb_shellRun adb shell commandA
Destructive

Run an arbitrary shell command on the device (e.g. 'pm list packages -3', 'dumpsys battery'). Output is truncated to the tail.

Inputs: command (required), serial, timeoutSec.

app_installInstall APKA

Install (or reinstall, keeping data) an APK on a device. Use project_apks to find built APKs.

Inputs: apkPath (required), serial, allowDowngrade, grantPermissions.

app_launchLaunch appC

Start an app's launcher activity (or a given activity) and report launch time.

Inputs: package (required), serial, activity, stopFirst.

app_stopForce-stop appA
Destructive

Force-stop an app, optionally also clearing all of its data.

Inputs: package (required), serial, clearData.

app_uninstallUninstall appC
Destructive

Uninstall an app package from a device.

Inputs: package (required), serial, keepData.

buildBuild appA

Assemble an APK for a module and variant (default: the app module, debug). Returns compiler errors and the APK path.

Inputs: module, variant, waitSec, projectDir.

device_infoDevice infoB
Read-only

Model, Android version, API level, ABI, screen size and density of a device.

Inputs: serial.

devices_listList devicesA
Read-only

List connected Android devices and running emulators (adb devices -l).

Inputs: no named parameters.

emulator_listList AVDsA
Read-only

List Android Virtual Devices and which are currently running (with their serials).

Inputs: no named parameters.

emulator_startStart emulatorA

Boot an AVD in the background and wait for it to finish booting. Returns a job; if it isn't done within waitSec, poll it with job_status.

Inputs: avd (required), waitSec, coldBoot, headless, +1 more.

emulator_stopStop emulatorA
Destructive

Shut down a running emulator by serial (e.g. emulator-5554).

Inputs: serial (required).

environmentEnvironmentA
Read-only

Report the Android toolchain this server sees: SDK path and installed packages, Android Studio install, JAVA_HOME, and the resolved project. Call this first when something isn't found.

Inputs: projectDir.

file_transferPush / pull fileC
Destructive

Copy a file between this machine and the device (adb push / adb pull).

Inputs: direction (required), localPath (required), devicePath (required), serial.

gradle_runRun Gradle tasksA

Run Gradle tasks through the project's wrapper (e.g. ['assembleDebug'], [':app:testDebugUnitTest'], ['clean','build']). Returns parsed compiler errors. Runs as a job; poll with job_status if still running.

Inputs: tasks (required), args, waitSec, projectDir.

gradle_tasksList Gradle tasksC
Read-only

List the Gradle tasks available in the project (or one module).

Inputs: all, module, projectDir.

ide_actionRun IDE actionA
Destructive

Invoke an Android Studio action by id, as if chosen from the menu. Useful ids: Android.SyncProject (Gradle sync), ReformatCode, OptimizeImports, MakeGradleProject (Build › Make), CompileDirty, Android.RunAndroidLint. Editor actions apply to the active editor; use ide_open first.

Inputs: id (required), project.

ide_actionsSearch IDE actionsB
Read-only

Search Android Studio's action ids by id or menu text (e.g. 'sync', 'reformat', 'rebuild').

Inputs: limit, query.

ide_editorsOpen editorsC
Read-only

Files open in Android Studio, which have unsaved changes, and the active file with caret position and selection.

Inputs: project.

ide_find_filesFind filesA
Read-only

Find project files by name using the IDE index: exact name ('MainActivity.kt') or glob ('*ViewModel.kt').

Inputs: name (required), limit, project.

ide_find_usagesFind usagesA
Read-only

Find every reference to the symbol at path:line:column across the project using the IDE's semantic index (Kotlin and Java aware, not text search).

Inputs: line (required), path (required), limit, column, +1 more.

ide_gradle_syncGradle syncB

Run 'Sync Project with Gradle Files' in Android Studio and wait for the result (success, or the failure message).

Inputs: project, waitSec.

ide_openOpen in editorA

Open a file at a line/column in the running Android Studio and bring its window to the front.

Inputs: path (required), line, column, project.

ide_problemsIDE problemsA
Read-only

Errors and warnings from Android Studio's live analysis of a file (Kotlin/Java compiler checks, Android Lint, inspections), without running Gradle. Opens the file in the IDE if needed.

Inputs: path (required), project, waitSec, minSeverity.

ide_project_problemsProject problemsA
Read-only

Run Android Studio's analysis (compiler checks, inspections, on-the-fly lint) over the project or given files/folders without opening them or running Gradle. Errors only by default; faster than a build for checking an edit compiles.

Inputs: paths, project, maxFiles, minSeverity.

ide_read_fileRead editor bufferA
Read-only

Read a file as Android Studio currently has it, including unsaved edits. Prefer this over reading from disk when the user is editing in the IDE.

Inputs: path (required), endLine, startLine.

ide_renameRename symbolA
Destructive

Rename the symbol at path:line:column and update all references, like Shift+F6 (classes also rename their file). Saves all files afterwards. If the IDE detects conflicts it shows a dialog in Studio and this call times out; resolve it there.

Inputs: line (required), path (required), newName (required), column, +3 more.

ide_runRun configurationB

Run or debug a run configuration in Android Studio, like its toolbar buttons (deploys to the IDE's selected device). Defaults to the selected configuration.

Inputs: name, debug, project.

ide_run_configurationsRun configurationsA
Read-only

List the project's run/debug configurations and which one is selected.

Inputs: project.

ide_save_allSave allA

Save all unsaved editor buffers to disk (build and run_app do this automatically when Studio is running).

Inputs: no named parameters.

ide_screenshotIDE screenshotA
Read-only

Capture Android Studio's window (or just the active editor area) as an image: see Compose previews, the layout editor, tool windows and error balloons as the user does.

Inputs: target, project.

ide_statusAndroid Studio statusA
Read-only

Whether Android Studio (with the bridge plugin) is running, its version, and its open projects and indexing state.

Inputs: no named parameters.

ide_sync_statusGradle sync statusA
Read-only

State of the most recent Gradle sync in Android Studio (running / succeeded / failed with error).

Inputs: project.

inputSend inputA

Drive the device UI: tap or long-press at coordinates, swipe, type text, or press a key (BACK, HOME, ENTER, APP_SWITCH, DEL, or any KEYCODE_*). Get coordinates from ui_dump.

Inputs: action (required), x, y, x2, +5 more.

job_cancelCancel jobC
Destructive

Cancel a running background job.

Inputs: id (required).

job_statusJob statusA
Read-only

Check a background job (build, run_app, emulator_start). Optionally wait for it to finish. Omit id to list all jobs.

Inputs: id, waitSec, logChars.

lint_resultsRead Android Lint resultsB
Read-only

Parse the Android Lint XML report (run gradle_run with lintDebug or lint first).

Inputs: module, projectDir, minSeverity.

logcatRead logcatB

Read recent device logs. Filter by app package (uses its current PID), minimum priority, tag, or a regex. Use crashesOnly to get the crash buffer.

Inputs: tag, grep, clear, lines, +4 more.

packages_listList packagesB
Read-only

List installed packages, third-party only by default.

Inputs: filter, serial, thirdPartyOnly.

project_apksBuilt APKsB
Read-only

List APKs produced by previous builds, newest first.

Inputs: module, projectDir.

project_infoProject infoB
Read-only

Summarize the Android project: modules, their type, namespace/applicationId, SDK levels, launcher activities, Gradle and AGP versions.

Inputs: projectDir.

run_appBuild, install and launchB

The Android Studio 'Run' button: assemble the variant, install it on the device, and launch the launcher activity. Runs as a job.

Inputs: module, serial, variant, waitSec, +1 more.

screenshotScreenshotB
Read-only

Capture the device screen as a PNG image. Optionally also save it to a file on this machine.

Inputs: serial, savePath.

sdk_managerSDK managerA

List installed/available SDK packages or install packages (e.g. 'platforms;android-36', 'system-images;android-36;google_apis;x86_64'). Requires the SDK Command-line Tools package.

Inputs: action (required), packages.

studio_openOpen in Android StudioB

Open a project, or a file at a line, in Android Studio (reuses the running IDE window if one is open). Handy for handing off to the human.

Inputs: path (required), line, column.

test_resultsRead test resultsA
Read-only

Parse JUnit XML results from the last unit test (testUnitTest) or instrumented test (connectedAndroidTest) run. Run tests with gradle_run first.

Inputs: module, failedOnly, projectDir.

ui_dumpDump UI hierarchyA
Read-only

Dump the on-screen view hierarchy via uiautomator, as a compact list of nodes with text, resource-id, content-desc and tap-ready center coordinates.

Inputs: raw, serial, includeAll.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3.1/5.0

    Scored across 46 tools

    Disambiguation3/5

    Most tools target distinct resources, but several overlap enough to cause misselection: studio_open vs ide_open (both open files in Studio), run_app vs ide_run (both deploy and launch a variant), and ide_problems vs ide_project_problems vs lint_results (three ways to surface errors). The detailed descriptions mitigate but don't fully resolve the boundaries.

    Naming Consistency3/5

    There is a general prefix-based convention (ide_*, app_*, emulator_*, device_*, project_*), but ordering is inconsistent (app_launch is noun_verb while ide_read_file is prefix_verb_noun) and several tools are bare unprefixed names (build, input, screenshot, logcat, environment). Readable, but the conventions are mixed rather than predictable.

    Tool Count2/5

    46 tools is well past the '25+ is too many' threshold, and while the IDE+device+build surface is broad, there are real consolidation opportunities (multiple run tools, multiple problem-analysis tools, IDE-action plumbing). The weight increases the chance of an agent picking a near-duplicate.

    Completeness4/5

    The surface covers the full lifecycle: environment discovery, project introspection, Gradle build/test, IDE control, device/emulator management, UI automation, screenshots, logs, and file transfer. Gaps are minor (no breakpoint/debugger control or profiling tools), which agents can work around.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      An MCP server that enables AI assistants to build, test, and debug Android applications by interacting directly with the Android development environment. It provides tools for managing emulators, executing Gradle tasks, running ADB commands, and performing UI automation via accessibility trees.
      14
      105 npm
      19
      MIT
    • F
      license
      Not graded
      quality
      A
      maintenance
      MCP server that provides AI coding agents real Android development tools—Gradle, adb, logcat, lint, crash triage—through a local, permissioned interface. Enables agents to inspect projects, run safe Gradle tasks, capture logs/screenshots, and triage crashes.
      1
      -
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to control a physical Android device or Docker-hosted emulator over ADB by taking screenshots and performing taps, swipes, key presses, text input, shell commands, app launches, and device info queries. It runs as a local MCP stdio server alongside a web UI and REST API for remote access.
      1
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Gives MCP-compatible AI assistants vision and control over Android devices — capturing screenshots, tapping, swiping, typing, launching apps, inspecting UI elements, streaming audio/video, transferring files, and running shell commands over ADB, with a fast binary control protocol for near-instant input and screenshots.
      392 npm
      MIT