Sponsored by Deepsite.site

Mcp Android Agent Python

Created By
nim4447 months ago
This project provides an **MCP (Model Context Protocol)** server for automating Android devices using [uiautomator2](https://github.com/openatx/uiautomator2). It's designed to be easily plugged into AI agents like GitHub Copilot Chat, Claude, or Open Interpreter to control Android devices through natural language.
Overview

🛠️ Setup

1. Clone the repo

git clone https://github.com/nim444/mcp-android.git
cd mcp-android

2. Create and activate virtual environment

# Using uv (https://github.com/astral-sh/uv)
uv venv
source .venv/bin/activate

3. Install dependencies (from pyproject.toml)

uv pip install
uvicorn server:app --factory --host 0.0.0.0 --port 8000

Alternatively, run with MCP stdio (for AI agent integration):

python server.py

🤖 Available MCP Tools

Tool NameDescription
mcp_healthCheck if the MCP server is running properly
connect_deviceConnect to an Android device and get basic info
get_installed_appsList all installed apps with version and package info
get_current_appGet info about the app currently in the foreground
start_appStart an app by its package name
stop_appStop an app by its package name
stop_all_appsStop all currently running apps
screen_onTurn on the screen
screen_offTurn off the screen
get_device_infoGet detailed device info: serial, resolution, battery, etc.
press_keySimulate hardware key press (e.g. home, back, menu, etc.)
unlock_screenUnlock the screen (turn on and swipe if necessary)
check_adbCheck if ADB is installed and list connected devices
wait_for_screen_onWait asynchronously until the screen is turned on
clickTap on an element by text, resourceId, or description
long_clickPerform a long click on an element
send_textInput text into currently focused field (optionally clearing before)
get_element_infoGet info on UI elements (text, bounds, clickable, etc.)
swipeSwipe from one coordinate to another
wait_for_elementWait for an element to appear on screen
screenshotTake and save a screenshot from the device
scroll_toScroll until a given element becomes visible
dragDrag an element to a specific screen location
get_toastGet the last toast message shown on screen
clear_app_dataClear user data/cache of a specified app
wait_activityWait until a specific activity appears

Server Config

{
  "mcpServers": {
    "mcp-android": {
      "type": "stdio",
      "command": "bash",
      "args": [
        "-c",
        "cd <DIRECTORY> && source .venv/bin/activate && python -m server"
      ]
    }
  }
}
Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Playwright McpPlaywright MCP server
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
Tavily Mcp
WindsurfThe new purpose-built IDE to harness magic
DeepChatYour AI Partner on Desktop
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
ChatWiseThe second fastest AI chatbot™
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
CursorThe AI Code Editor
Amap Maps高德地图官方 MCP Server
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Serper MCP ServerA Serper MCP Server
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。