Android Builder MCP Server

Android Builder MCP Server

Enables AI agents to act as local Android developers with compilation, emulator, asset management, and diagnostics capabilities for a closed-loop build cycle.

Category
访问服务器

README

Android Builder MCP Server

An advanced Model Context Protocol (MCP) server that empowers AI coding agents (like Claude or Antigravity) to act as fully capable local Android developers.

By exposing compilation, emulator, asset management, and diagnostics capabilities directly to the agent, the MCP enables a closed-loop build cycle where the agent can build, run, visually inspect, debug, and sign release-ready Android applications.


🚀 Key Features

  • Project Initialization: Spin up templates (Empty Activity or Jetpack Compose) out-of-the-box.
  • Safe Gradle Runner: Execute build tasks (e.g. assembleDebug, assembleRelease) in a secure, non-hanging execution wrapper with automatic timeout safeguards and disabled background compilation daemons (preventing thread deadlocks).
  • Live Visual Inspection: Capture screenshots of the running emulator screen directly to your host's artifacts directory so vision-based AI models can inspect the UI layout.
  • Logcat Diagnostics: Stream filtered logs from active devices to diagnose app crashes.
  • Android Resource Importer: Automatically sanitizes asset names to comply with Android's strict naming rules ([a-z0-9_]) and places files in the correct module res/ folders.
  • Manifest & Build Editors: Safely inject manifest permissions, set app names in XML resources, and update Gradle build versions without breaking formatting.
  • Signing Pipeline: Generate JKS keystores and run zip alignments (zipalign) followed by private key signing (apksigner) to produce Play Store-ready APKs.

🛠️ Prerequisites

To run this MCP server, the host machine must have the following tools installed and configured:

  1. Python 3.10 to 3.12
    • Install Python and ensure it is added to your environment PATH.
  2. Node.js
    • Required if you are running the server via the Javascript launcher bridge.
  3. Android SDK
    • Ensure the Android SDK is installed (typically installed with Android Studio).
    • Set the ANDROID_HOME or ANDROID_SDK_ROOT environment variable pointing to your SDK folder (e.g., C:\Users\<YourUser>\AppData\Local\Android\Sdk).
  4. Java Development Kit (JDK 17 or 21)
    • Ensure a compatible JDK is installed (e.g. OpenLogic JDK or OpenJDK).
    • Set the JAVA_HOME environment variable pointing to your JDK folder.

📦 Setup & Installation

  1. Clone the repository to your local machine (e.g. at C:\Android-Builder-MCP).
  2. Install Python dependencies: Open a terminal in the project directory and run:
    pip install -r requirements.txt
    
    Note: If you encounter a TypeError: cannot specify both default and default_factory when importing fastmcp, ensure Pydantic is downgraded to 2.11.x by running:
    pip install "pydantic<2.12.0"
    

⚙️ Client Integration (Claude Desktop Configuration)

To connect this MCP server to Claude Desktop, open your configuration file (%APPDATA%\Claude\claude_desktop_config.json) and add the server inside the mcpServers object.

Choose one of the following launcher options:

Option 1: Direct CMD Execution (Recommended for Windows Store Python)

This bypasses Node.js entirely and executes Python 3.12 inside a command shell context, which is required to resolve Windows Store execution aliases:

{
  "mcpServers": {
    "android-builder": {
      "command": "cmd.exe",
      "args": [
        "/c",
        "C:\\Users\\admin\\AppData\\Local\\Microsoft\\WindowsApps\\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\\python.exe",
        "-u",
        "C:/Android-Builder-MCP/server.py"
      ]
    }
  }
}

(Make sure to adjust the path to your specific Python 3.12 executable if it differs).

Option 2: JS Launcher Bridge

Uses Node.js to launch the script wrapper, which routes commands through a shell context automatically:

{
  "mcpServers": {
    "android-builder": {
      "command": "node",
      "args": [
        "C:/Android-Builder-MCP/mcp_launcher.js"
      ],
      "env": {
        "MCP_PYTHON_PATH": "C:\\Users\\admin\\AppData\\Local\\Microsoft\\WindowsApps\\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\\python.exe"
      }
    }
  }
}

(You can omit the MCP_PYTHON_PATH environment variable if your default system python command already maps to the Python environment where mcp is installed).


📖 MCP Tool Reference

Tool Name Type Description
verify_sdk_setup Diagnostic Inspects and reports SDK, JDK, and build tool configurations.
list_projects Project Lists all Android projects created inside the workspace directory.
create_project Project Initializes a new project from templates (empty_activity, compose).
build_project Gradle Compiles your project using local Gradle configurations.
list_emulators Emulator Lists virtual device definitions (AVDs) and their current state.
start_emulator Emulator Launches an AVD and blocks until the Android boot cycle finishes.
list_devices ADB Lists all active device interfaces connected to ADB.
install_apk ADB Installs a built APK file onto a target running emulator or device.
import_image_resource Asset Sanity-checks image names and copies them to drawing/mipmap resource folders.
capture_screenshot Diagnostic Captures the emulator screen and saves it as a local PNG in the artifacts folder.
get_device_logs Diagnostic Streams filtered logcat outputs from active emulators to inspect app crashes.
add_manifest_permission Manifest Injects security permissions (e.g. Internet) safely into AndroidManifest.xml.
set_app_name Manifest Safely updates the app's user-facing display label in strings.xml.
update_gradle_versions Gradle Adjusts numeric version codes and semantic strings in build files.
generate_keystore Signing Generates JKS keystore files non-interactively using JDK's keytool.
sign_apk Signing Performs zip boundary alignment and signs the APK using a generated keystore.

🤖 Closed-Loop Visual UI Development Workflow

With this MCP installed, you can upload screenshots of app screens or mockups directly into your chat with Claude and say:

"Build me an Android application that looks like this mockup image."

Claude will proceed to:

  1. Analyze the mockup image using visual model reasoning.
  2. Create a Compose project using create_project.
  3. Implement the screens in Kotlin.
  4. Compile the APK using build_project.
  5. Start the emulator and install the APK (start_emulator -> install_apk).
  6. Take a screenshot of the running app using capture_screenshot.
  7. Review the screenshot visually, compare it to your design, and automatically patch the code to fix layout discrepancies, repeating the loop until it matches perfectly!

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选