Android ADB Controller MCP Server
Overview
This MCP server enables AI agents to control Android devices via ADB commands. It provides tools for:
- Listing connected devices
- Executing screen taps
- (Extensible for more ADB commands)
Setup Guide
Prerequisites
- Android device with USB debugging enabled
- ADB installed and working (
adb devicesshould show your device) - Node.js v16+
Installation Steps
- Create MCP Server:
npx @modelcontextprotocol/create-server android-adb-controller
cd android-adb-controller
- Install Dependencies:
npm install adbkit @types/adbkit
- Configure MCP Settings:
Add to
mcp_settings.json:
{
"mcpServers": {
"android-adb": {
"command": "node",
"args": ["android-adb-controller/build/index.js"]
}
}
}
Implementation Details
Key Components
- ADB Client Initialization:
this.adbClient = adb.createClient();
- Command Execution:
private async executeADBCommand(deviceId: string, command: string) {
const device = this.adbClient.getDevice(deviceId);
return await device.shell(command);
}
- Tool Definitions:
list_devices: Lists connected Android devicestap_screen: Executes screen taps at specified coordinates
Troubleshooting Guide
Common Issues & Solutions
- ADB Command Not Found:
- Ensure ADB is installed and in system PATH
- Verify platform-tools are extracted correctly
- Device Not Detected:
- Check USB debugging is enabled
- Verify USB cable connection
- Run
adb devicesto confirm detection
- TypeScript Errors:
Solution: Added proper type definitions in
adbkit.d.ts:
declare module 'adbkit' {
interface Device {
id: string;
type: string;
}
// ... other type definitions
}
- MCP Server Connection Issues:
- Verify server is running (
node build/index.js) - Check MCP settings configuration
Extending Functionality
To add new commands:
- Define new tool in
ListToolsRequestSchema - Implement handler in
CallToolRequestSchema - Add corresponding ADB command execution
Example for text input:
{
name: "input_text",
description: "Input text on device",
inputSchema: {
type: "object",
properties: {
deviceId: { type: "string" },
text: { type: "string" }
}
}
}
Development Workflow
- Make code changes
- Rebuild:
npm run build
- Restart server:
node build/index.js
Architecture
MCP Server (Node.js) ↔ ADB Interface ↔ Android Device
↑
|
AI Control System
Future Improvements
- Add swipe gestures
- Implement screenshot capability
- Add device monitoring
- Support multiple simultaneous devices
Recommend MCP Servers 💡
UnityMCPIntegration
Enable AI Agents to Control Unity through MCP integration
@playwright/mcp
A Model Context Protocol (MCP) server providing browser automation capabilities using Playwright, enabling LLMs to interact with web pages through structured accessibility snapshots.
mcp-containerd
An MCP server implemented in Rust that provides an interface to manage Containerd's CRI (Container Runtime Interface) operations, including runtime and image services.
mcp-remote-macos-use
Enables AI to fully control remote macOS systems via MCP protocol
mcp-browser-agent
A Model Context Protocol (MCP) integration that provides Claude Desktop with autonomous browser automation capabilities. This agent enables Claude to interact with web content, manipulate DOM elements, execute JavaScript, and perform API requests.
mcp-server-js
YepCode's MCP server enables AI agents to securely execute AI-generated Node.js or Python code snippets in cloud sandboxes, integrating with APIs and services as MCP tools.