Androidbuild Mcp

io.github.dev-jackson由 GitHub 账号 dev-jackson 发布v0.1.1更新于 Oct 24, 2026

Build, deploy, drive and debug Android apps: Gradle, emulators, adb, logcat, UI automation

已验证STDIO仅桌面浏览器自动化开发者工具

概览

AI 生成的概览

一个本地 MCP 服务器,让 AI 助手通过 Gradle、模拟器、adb、logcat 和 UI 自动化来构建、部署、操作和调试 Android 应用。

可以做什么
检查环境与项目:doctor、查找项目和模块、列出构建变体、读取应用 ID 与 Gradle 配置,并设置项目、模块、变体和设备的会话默认值。构建、测试与质量检查:构建 APK 并返回精简的编译错误、一键构建安装启动、单元测试与仪器测试、Lint、clean 和覆盖率报告。管理设备与模拟器:列出设备和 AVD,创建、启动、清除和关闭模拟器,设置 GPS 位置与外观。控制应用生命周期:安装、启动、停止、卸载、清除数据并查看应用信息。自动化界面:获取带点击坐标的 UI 快照、截图(可标注)、点击、滚动、滑动、拖拽、长按、输入文字、按键和等待元素出现。读取日志与录制:logcat 抓取、崩溃日志、后台日志捕获和屏幕录制。生成一个可直接构建的 Compose 项目骨架。
适用场景
适合让助手端到端处理真实 Android 项目:编译并修复构建错误、运行测试、在模拟器或设备上启动应用、通过 UI 自动化复现问题,或采集日志、截图和录屏。
运行要求
通过 npx 以 stdio 在本地运行(Node 18+)。需要 Android SDK(ANDROID_HOME 或默认安装路径)、用于 Gradle 构建的 JDK 17+,以及 adb/模拟器工具;部署和 UI 操作需要模拟器或已连接设备。可选:Google 的 Android CLI 用于标注截图,ADBKeyboard 输入法用于非 ASCII 输入。
安装前请注意
这些工具会写入本机和设备:构建、安装、卸载、清除应用数据、创建和删除模拟器,并发送点击和按键。录屏和日志捕获会在本地保存文件。只对愿意修改的项目和设备使用。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Androidbuild Mcp,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

AndroidBuildMCP

[npm] [license]

Give your AI agent hands on Android. AndroidBuildMCP is an MCP server that lets any MCP client (Claude Code, Cursor, ...) build, deploy, drive and debug real Android apps: Gradle builds with readable errors, emulator management, adb deployment, logcat capture and full UI automation.

Quick start

Requirements: Node 18+, the Android SDK (ANDROID_HOME or a default install), and a JDK 17+ for Gradle builds.

No install step — npx fetches the server on first run.

Claude Code

bash
claude mcp add androidbuild -- npx -y @asjackson/androidbuild-mcp

Any other MCP client

json
{  "mcpServers": {    "androidbuild": {      "command": "npx",      "args": ["-y", "@asjackson/androidbuild-mcp"]    }  }}
Run from source instead
bash
git clone https://github.com/dev-jackson/androidbuild-mcp.gitcd androidbuild-mcpnpm install && npm run buildclaude mcp add androidbuild -- node /absolute/path/to/androidbuild-mcp/dist/index.js

Then ask your agent to run doctor — it checks the SDK, adb, emulator, Java and connected devices, and tells you exactly what is missing.

What your agent can do

  • Build and test — build_app compiles and returns compact file:line compiler errors instead of a thousand lines of Gradle noise. test_app / test_instrumented return parsed pass/fail summaries. Lint, clean, coverage (Kover/Jacoco) included.
  • Manage emulators — list, create, boot (waits for full boot, returns the serial), wipe, and kill AVDs. Set GPS location, dark mode, and a clean demo status bar for screenshots.
  • Deploy — build_run compiles, installs and launches in one call. Install/uninstall/clear-data/app-info via adb, with the right device auto-selected when only one is connected.
  • See the screen — snapshot_ui returns the UI as a compact list of named elements with tap coordinates (Compose semantics merged, noise filtered). screenshot returns an image; with annotate: true it draws numbered boxes using vision, catching text inside images and WebViews.
  • Touch the screen — tap, scroll, swipe, drag, long-press, type (keyboard-aware, with clear/submit), hardware keys, and wait_for_ui to poll until an element appears.
  • Read the logs — background logcat capture filtered to your app, one-shot dumps, and the crash buffer for stack traces.
  • Start new apps — scaffold_android_project generates a minimal Compose project that builds out of the box.

Session defaults (session_set_defaults) mean you configure project, module, variant and device once — every other call then works without arguments.

Tool reference

53 tools over stdio. Every tool takes plain arguments and returns text (or an image, for screenshot).

Environment and project

ToolDescription
doctorCheck SDK, adb, emulator, avdmanager, Java and connected devices; reports what is missing
discover_projectsFind Android/Gradle projects under a path
list_modulesList modules declared in settings.gradle(.kts)
list_variantsList build variants of a module
get_app_idRead the applicationId of a module
show_gradle_configShow Gradle, AGP, Kotlin and version-catalog entries

Session defaults

ToolDescription
session_set_defaultsSet default project, module, variant, serial and appId for all later calls
session_show_defaultsShow the current defaults
session_clear_defaultsClear all defaults, or only the listed keys

Build, test and quality

ToolDescription
build_appBuild an APK; returns compact file:line compiler errors
build_runBuild, install and launch in one call
test_appRun JVM unit tests with a parsed pass/fail summary
test_instrumentedRun instrumented tests on a device
lintRun Android Lint and summarize the report
cleanRun gradle clean
get_apk_pathLocate the most recent APK without building
stop_gradleStop the project's Gradle daemons
get_coverage_reportRun Kover/Jacoco and summarize line coverage per package
get_file_coverageShow covered/uncovered lines of one source file

Devices and emulators

ToolDescription
list_devicesList devices with serial, state, model, Android version, API level
list_avdsList AVDs and which are running
boot_emulatorBoot an AVD and wait for full boot; returns the serial
kill_emulatorShut down a running emulator
create_avdCreate an AVD from an installed system image
delete_avdDelete an AVD
set_emulator_locationSet GPS location
set_appearanceSwitch dark/light mode
statusbar_demo_modeClean status bar for screenshots

App lifecycle

ToolDescription
install_appInstall an APK (adb install -r)
launch_appLaunch by application id, resolving the launcher activity
stop_appForce-stop a running app
uninstall_appUninstall an app
clear_app_dataReset an app to fresh-install state
get_app_infoVersion, target/min SDK, install path, running PID

UI automation

ToolDescription
snapshot_uiDump the UI as named elements with exact tap coordinates
screenshotCapture the screen; annotate: true draws numbered boxes
tap_elementTap element #N from the last annotated screenshot
tapTap at pixels or screen percentages
scrollScroll in a direction with a safe computed swipe
swipeSwipe between two points
dragDrag from one point to another
long_pressLong-press, holding 1000 ms
type_textType into the focused field, waiting for the keyboard
key_pressPress BACK, HOME, ENTER, DPAD_*, or any keycode
key_sequencePress several keys in order
wait_for_uiPoll until an element appears

Logs and recording

ToolDescription
get_logsOne-shot logcat dump, filterable by app and tag
get_crash_logsCrash buffer: Java exceptions, native crashes, ANRs
start_log_captureStart background logcat capture to a file
stop_log_captureStop capture and return the file plus the last lines
record_video_startStart screen recording (max 3 minutes)
record_video_stopStop recording and pull the MP4

Scaffolding

ToolDescription
scaffold_android_projectCreate a minimal Compose app that builds out of the box

Tapping accurately

Everything adb-side shares one coordinate space (device pixels), but MCP clients often display screenshots scaled — estimating pixel positions by eye from the image sends taps to the wrong place. Three safe ways to hit the target:

  1. snapshot_ui — returns exact device-pixel centers for every named element. Preferred.
  2. screenshot { annotate: true } + tap_element { element: N } — tap by the number drawn on the image; the mapping is resolved on the original PNG, so client-side scaling cannot distort it.
  3. tap { xPct, yPct } — screen percentages (0-1), also available on long_press/swipe/drag. Resolution-independent.

Raw tap { x, y } still works when you have real pixel coordinates.

Reliability

Every tool was exercised against real emulators and real projects — happy paths and corner cases — before release; the scenario-by-scenario evidence is in qa-results.md. Some of the details that keep agent flows from misfiring:

  • type_text waits for the soft keyboard before injecting (typing right after focusing a field silently drops the first characters otherwise).
  • scroll computes a long, slow swipe from the screen size — short fast swipes get ignored by some lists. long_press holds 1000 ms, which launchers require.
  • Taps outside the screen are rejected with the actual screen size instead of silently doing nothing.
  • Text-heavy screens (e-book WebViews and the like) are capped and searchable with snapshot_ui { filter } instead of flooding the context.
  • Build/test/device failures come back as short, actionable messages with the next tool to call.

Optional extras

  • Google's Android CLI enables screenshot { annotate: true }. doctor prints the one-line installer for your OS.
  • The ADBKeyboard IME enables non-ASCII type_text (adb alone is ASCII-only). Install its APK once; the server uses it automatically.

Development

bash
npm installnpm test            # unit tests (no real processes spawned)npm run dev         # run the server from sourcenpm run build       # compile to dist/

License

MIT — see LICENSE.

Conceptually inspired by XcodeBuildMCP; independent implementation built around the Android toolchain.

来源:README.md,提交 98055b2

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.1.1最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分