ADB安卓设备
STDIO通过MCP协议实现AI驱动的安卓设备交互管理
通过MCP协议实现AI驱动的安卓设备交互管理
An MCP (Model Context Protocol) server for interacting with Android devices through ADB. This TypeScript-based tool provides a bridge between AI models and Android device functionality.
To install ADB Android Device Server for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @srmorete/adb-mcp --client claude
# Clone the repository git clone https://github.com/srmorete/adb-mcp.git cd adb-mcp # Install dependencies npm install # Build the TypeScript code npm run build # Run the server npx adb-mcp
The server uses default ADB paths. For custom ADB location:
export ADB_PATH=/path/to/adb npx adb-mcp
Add the ADB MCP server configuration:
{ "mcpServers": { "adb": { "command": "npx", "args": [ "adb-mcp" ] } } }
IMPORTANT: The server must be running before using any ADB tools.
Start the server using:
npx adb-mcp
You should see:
[INFO] ADB MCP Server connected and ready
Keep this terminal window open while using the ADB tools.
All tools are available with the following naming convention:
adb_devices - List connected devicesadb_shell - Execute shell commands on a deviceadb_install - Install an APK file using a local file pathadb_package_manager - Execute Package Manager (pm) commands - list packages, grant/revoke permissions, manage appsadb_activity_manager - Execute Activity Manager (am) commands - start activities, broadcast intents, control app behavioradb_logcat - View device logs with optional filteringadb_pull - Pull files from a deviceadb_push - Push files to a devicedump_image - Take a screenshot of the current screeninspect_ui - Get UI hierarchy in XML format (most useful for AI interaction)If tools aren't working:
Server Issues:
npx adb-mcp)LOG_LEVEL=3 npx adb-mcpps aux | grep "adb-mcp" | grep -v grepkill -9 [PID]Device Connection:
adb_devicesadb kill-server && adb start-serverADB Issues:
adb versionDevice Setup:
vibe-coded so if you spot some weird stuff... well now you know 🙂This project is licensed under the MIT License - see the LICENSE file for details.