Android MCP Server offers a powerful solution for managing Android devices through ADB. It enables seamless command execution, screenshot capture, and package management, allowing for enhanced control and automation. Ideal for developers and tools that rely on effective device management.
The Android MCP Server is a powerful Model Context Protocol (MCP) server designed to facilitate programmatic control over Android devices through the Android Debug Bridge (ADB). It exposes a range of device management functionalities that can be utilized by MCP clients, including desktop applications like Claude and code editors such as Cursor.
To get started, ensure the following are installed and configured on your system:
The server employs a straightforward YAML configuration file (config.yaml) to determine the target Android device. Follow these steps to customize your configuration:
touch config.yaml
device:
name: "google-pixel-7-pro:5555" # Device identifier from 'adb devices'
To utilize the server with an MCP client like Claude Desktop, include the Android MCP server configuration in the client’s settings. Locate your Claude Desktop configuration file and add the following under the mcpServers section:
{
"mcpServers": {
"android": {
"command": "path/to/uv",
"args": ["--directory", "path/to/android-mcp-server", "run", "server.py"]
}
}
}
Make sure to replace path/to/uv and path/to/android-mcp-server with the correct paths.
The server provides the following functions for interacting with the connected Android device:
def get_packages() -> str:
"""
Get all installed packages on the device.
Returns:
str: A list of all installed packages as a string
"""
def execute_adb_command(command: str) -> str:
"""
Executes an ADB command and returns the output.
Args:
command (str): The ADB command to execute
Returns:
str: The output of the ADB command
"""
def get_uilayout() -> str:
"""
Retrieves clickable UI elements' information.
Returns:
str: A formatted list of clickable elements
"""
def get_screenshot() -> Image:
"""
Takes a screenshot of the device and returns it.
Returns:
Image: The screenshot
"""
def get_package_action_intents(package_name: str) -> list[str]:
"""
Retrieve all non-data actions for a package.
Args:
package_name (str): The target package name
Returns:
list[str]: Non-data actions from the Activity Resolver Table
"""
Contributions to the Android MCP Server are encouraged and welcomed, allowing for continuous improvement and enhancement of the project.
No comments yet.
Sign in to be the first to comment.