Phone Control (Android ADB) logo

Phone Control (Android ADB)

Community
hao-cyber

A phone control plugin for MCP that allows you to control your Android phone through ADB commands to connect any human

Publisherhao-cyber
Repositoryphone-mcp
LanguagePython
Forks
38
Stars
231
Available tools
21
Transport typestdio
Categories
LicenseApache-2.0
Links
  • Connect tools to AI workflows

    Phone Control (Android ADB) exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 21 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    231 stars and 38 forks from the linked repository.

πŸ“± Phone MCP Plugin

Downloads

🌟 A powerful MCP plugin that lets you control your Android phone with ease through ADB commands.

Example

  • Based on today's weather by browser, automatically select and play netease music, no confirmation needed play_mucic_x2

  • Call Hao from the contacts. If he doesn't answer, send a text message telling him to come to Meeting Room 101. call_sms_x2

δΈ­ζ–‡ζ–‡ζ‘£

⚑ Quick Start

πŸ“₯ Installation

bash
# Run directly with uvx (recommended, part of uv, no separate installation needed)
uvx phone-mcp

# Or install with uv
uv pip install phone-mcp

# Or install with pip
pip install phone-mcp

πŸ”§ Configuration

AI Assistant Configuration

Configure in your AI assistant configuration (Cursor, Trae, Claude, etc.):

json
{
    "mcpServers": {
        "phone-mcp": {
            "command": "uvx",
            "args": [
                "phone-mcp"
            ]
        }
    }
}

Alternatively, if you installed with pip:

json
{
    "mcpServers": {
        "phone-mcp": {
            "command": "/usr/local/bin/python",
            "args": [
                "-m",
                "phone_mcp"
            ]
        }
    }
}

Important: The path /usr/local/bin/python in the configuration above is the path to the Python interpreter. You need to modify it according to the actual Python installation location on your system. Here's how to find the Python path on different operating systems:

Linux/macOS: Run the following command in terminal:

bash
which python3

or

bash
which python

Windows: Run in Command Prompt (CMD):

cmd
where python

Or in PowerShell:

powershell
(Get-Command python).Path

Make sure to replace /usr/local/bin/python in the configuration with the full path, for example on Windows it might be C:\Python39\python.exe

Note: For Cursor, place this configuration in ~/.cursor/mcp.json

Usage:

  • Use commands directly in Claude conversation, for example:
    Please call contact hao

⚠️ Before using, ensure:

  • ADB is properly installed and configured
  • USB debugging is enabled on your Android device
  • Device is connected to computer via USB

🎯 Key Features

  • πŸ“ž Call Functions: Make calls, end calls, receive incoming calls
  • πŸ’¬ Messaging: Send and receive SMS, get raw messages
  • πŸ‘₯ Contacts: Access phone contacts, create new contacts with automated UI interaction
  • πŸ“Έ Media: Screenshots, screen recording, media control
  • πŸ“± Apps: Launch applications, launch specific activities with intents, list installed apps, terminate apps
  • πŸ”§ System: Window info, app shortcuts
  • πŸ—ΊοΈ Maps: Search POIs with phone numbers
  • πŸ–±οΈ UI Interaction: Tap, swipe, type text, press keys
  • πŸ” UI Inspection: Find elements by text, ID, class or description
  • πŸ€– UI Automation: Wait for elements, scroll to find elements
  • 🧠 Screen Analysis: Structured screen information and unified interaction
  • 🌐 Web Browser: Open URLs in device's default browser
  • πŸ”„ UI Monitoring: Monitor UI changes and wait for specific elements to appear or disappear

πŸ› οΈ Requirements

  • Python 3.7+
  • Android device with USB debugging enabled
  • ADB tools

πŸ“‹ Basic Commands

Device & Connection

bash
# Check device connection
phone-cli check

# Get screen size
phone-cli screen-interact find method=clickable

Communication

bash
# Make a call
phone-cli call 1234567890

# End current call
phone-cli hangup

# Send SMS
phone-cli send-sms 1234567890 "Hello"

# Get received messages (with pagination)
phone-cli messages --limit 10

# Get sent messages (with pagination)
phone-cli sent-messages --limit 10

# Get contacts (with pagination)
phone-cli contacts --limit 20

# Create a new contact with UI automation
phone-cli create-contact "John Doe" "1234567890"

Media & Apps

bash
# Take screenshot
phone-cli screenshot

# Record screen
phone-cli record --duration 30

# Launch app (may not work on all devices)
phone-cli app camera

# Alternative app launch method using open_app (if app command doesn't work)
phone-cli open_app camera

# Close app
phone-cli close-app com.android.camera

# List installed apps (basic info, faster)
phone-cli list-apps

# List apps with pagination
phone-cli list-apps --page 1 --page-size 10

# List apps with detailed info (slower)
phone-cli list-apps --detailed

# Launch specific activity (reliable method for all devices)
phone-cli launch com.android.settings/.Settings

# Launch app by package name (may not work on all devices)
phone-cli app com.android.contacts

# Alternative launch by package name (if app command doesn't work)
phone-cli open_app com.android.contacts

# Launch app by package and activity (most reliable method)
phone-cli launch com.android.dialer/com.android.dialer.DialtactsActivity

# Open URL in default browser
phone-cli open-url google.com

Screen Analysis & Interaction

bash
# Analyze current screen with structured information
phone-cli analyze-screen

# Unified interaction interface
phone-cli screen-interact <action> [parameters]

# Tap at coordinates
phone-cli screen-interact tap x=500 y=800

# Tap element by text
phone-cli screen-interact tap element_text="Login"

# Tap element by content description
phone-cli screen-interact tap element_content_desc="Calendar"

# Swipe gesture (scroll down)
phone-cli screen-interact swipe x1=500 y1=1000 x2=500 y2=200 duration=300

# Press key
phone-cli screen-interact key keycode=back

# Input text
phone-cli screen-interact text content="Hello World"

# Find elements
phone-cli screen-interact find method=text value="Login" partial=true

# Wait for element
phone-cli screen-interact wait method=text value="Success" timeout=10

# Scroll to find element
phone-cli screen-interact scroll method=text value="Settings" direction=down max_swipes=5

# Monitor UI for changes
phone-cli monitor-ui --interval 0.5 --duration 30

# Monitor UI until specific text appears
phone-cli monitor-ui --watch-for text_appears --text "Welcome"

# Monitor UI until specific element ID appears
phone-cli monitor-ui --watch-for id_appears --id "login_button"

# Monitor UI until specific element class appears
phone-cli monitor-ui --watch-for class_appears --class-name "android.widget.Button"

# Monitor UI changes with output as raw JSON
phone-cli monitor-ui --raw

Location & Maps

bash
# Search nearby POIs with phone numbers
phone-cli get-poi 116.480053,39.987005 --keywords restaurant --radius 1000

πŸ“š Advanced Usage

App and Activity Launch

The plugin provides multiple ways to launch apps and activities:

  1. By App Name (Two Methods):

    bash
    # Method 1: Using app command (may not work on all devices)
    phone-cli app camera
    
    # Method 2: Using open_app command (alternative if app command fails)
    phone-cli open_app camera
  2. By Package Name (Two Methods):

    bash
    # Method 1: Using app command (may not work on all devices)
    phone-cli app com.android.contacts
    
    # Method 2: Using open_app command (alternative if app command fails)
    phone-cli open_app com.android.contacts
  3. By Package and Activity (Most Reliable Method):

    bash
    # This method works on all devices
    phone-cli launch com.android.dialer/com.android.dialer.DialtactsActivity

Note: If you encounter issues with the app or open_app commands, always use the launch command with the full component name (package/activity) for the most reliable operation.

Contact Creation with UI Automation

The plugin provides a way to create contacts through UI interaction:

bash
# Create a new contact with UI automation
phone-cli create-contact "John Doe" "1234567890"

This command will:

  1. Open the contacts app
  2. Navigate to the contact creation interface
  3. Fill in the name and phone number fields
  4. Save the contact automatically

Screen-Based Automation

The unified screen interaction interface allows intelligent agents to easily:

  1. Analyze screens: Get structured analysis of UI elements and text
  2. Make decisions: Based on detected UI patterns and available actions
  3. Execute interactions: Through a consistent parameter system

UI Monitoring and Automation

The plugin provides powerful UI monitoring capabilities to detect interface changes:

  1. Basic UI monitoring:

    bash
    # Monitor any UI changes with custom interval (seconds)
    phone-cli monitor-ui --interval 0.5 --duration 30
  2. Wait for specific elements to appear:

    bash
    # Wait for text to appear (useful for automated testing)
    phone-cli monitor-ui --watch-for text_appears --text "Login successful"
    
    # Wait for specific ID to appear
    phone-cli monitor-ui --watch-for id_appears --id "confirmation_dialog"
  3. Monitor elements disappearing:

    bash
    # Wait for text to disappear
    phone-cli monitor-ui --watch-for text_disappears --text "Loading..."
  4. Get detailed UI change reports:

    bash
    # Get raw JSON data with all UI change information
    phone-cli monitor-ui --raw

Tip: UI monitoring is especially useful for automation scripts to wait for loading screens to complete or confirm that actions have taken effect in the UI.

πŸ“š Detailed Documentation

For complete documentation and configuration details, visit our GitHub repository.

🧰 Tool Documentation

Screen Interface API

The plugin provides a powerful screen interface with comprehensive APIs for interacting with the device. Below are the key functions and their parameters:

interact_with_screen

python
async def interact_with_screen(action: str, params: Dict[str, Any] = None) -> str:
    """Execute screen interaction actions"""
  • Parameters:
    • action: Type of action ("tap", "swipe", "key", "text", "find", "wait", "scroll")
    • params: Dictionary with parameters specific to each action type
  • Returns: JSON string with operation results

Examples:

python
# Tap by coordinates
result = await interact_with_screen("tap", {"x": 100, "y": 200})

# Tap by element text
result = await interact_with_screen("tap", {"element_text": "Login"})

# Swipe down
result = await interact_with_screen("swipe", {"x1": 500, "y1": 300, "x2": 500, "y2": 1200, "duration": 300})

# Input text
result = await interact_with_screen("text", {"content": "Hello world"})

# Press back key
result = await interact_with_screen("key", {"keycode": "back"})

# Find element by text
result = await interact_with_screen("find", {"method": "text", "value": "Settings", "partial": True})

# Wait for element to appear
result = await interact_with_screen("wait", {"method": "text", "value": "Success", "timeout": 10, "interval": 0.5})

# Scroll to find element
result = await interact_with_screen("scroll", {"method": "text", "value": "Privacy Policy", "direction": "down", "max_swipes": 8})

analyze_screen

python
async def analyze_screen(include_screenshot: bool = False, max_elements: int = 50) -> str:
    """Analyze the current screen and provide structured information about UI elements"""
  • Parameters:
    • include_screenshot: Whether to include base64-encoded screenshot in result
    • max_elements: Maximum number of UI elements to process
  • Returns: JSON string with detailed screen analysis

create_contact

python
async def create_contact(name: str, phone: str) -> str:
    """Create a new contact with the given name and phone number"""
  • Parameters:
    • name: The contact's full name
    • phone: The phone number for the contact
  • Returns: JSON string with operation result
  • Location: This function is found in the 'contacts.py' module and implements UI automation to create contacts

launch_app_activity

python
async def launch_app_activity(package_name: str, activity_name: Optional[str] = None) -> str:
    """Launch an app using package name and optionally an activity name"""
  • Parameters:
    • package_name: The package name of the app to launch
    • activity_name: The specific activity to launch (optional)
  • Returns: JSON string with operation result
  • Location: This function is found in the 'apps.py' module

launch_intent

python
async def launch_intent(intent_action: str, intent_type: Optional[str] = None, extras: Optional[Dict[str, str]] = None) -> str:
    """Launch an activity using Android intent system"""
  • Parameters:
    • intent_action: The action to perform
    • intent_type: The MIME type for the intent (optional)
    • extras: Extra data to pass with the intent (optional)
  • Returns: JSON string with operation result
  • Location: This function is found in the 'apps.py' module

πŸ“„ License

Apache License, Version 2.0

Contact Creation Tool

This tool provides a simple way to create contacts on an Android device using ADB.

Prerequisites

  • Python 3.x
  • ADB (Android Debug Bridge) installed and configured
  • Android device connected and authorized for ADB

Usage

Basic Usage

Simply run the script:

bash
python create_contact.py

This will create a contact with default values:

  • Account name: "δ½ ηš„θ΄¦ζˆ·ε"
  • Account type: "com.google"

Advanced Usage

You can provide custom account name and type using a JSON string:

bash
python create_contact.py '{"account_name": "your_account", "account_type": "com.google"}'

Output

The script outputs a JSON object with:

  • success: boolean indicating if the operation was successful
  • message: any output or error message from the command

Example success output:

json
{"success": true, "message": ""}

Error Handling

  • If ADB is not available or device is not connected, the script will return an error
  • Invalid JSON input will result in an error message
  • Any ADB command errors will be captured and returned in the message field

Notes

  • Make sure your Android device is connected and authorized for ADB use
  • The device screen should be unlocked when running the command
  • Some devices might require additional permissions to modify contacts

Apps & Shortcuts

bash
# Get app shortcuts (with pagination)
phone-cli shortcuts --package "com.example.app"

Installation

TypingMind
Prerequisites:

Node.js 18+

{
  "mcpServers": {
    "phone-mcp": {
      "command": "uvx",
      "args": [
        "phone-mcp"
      ]
    }
  }
}

Available Tools

  • call_number

    Make a phone call to the specified number.

    Initiates a call using Android's dialer app through ADB. The number
    will be dialed immediately without requiring user confirmation.
    
    Args:
        phone_number (str): The phone number to call. Country code
                          will be automatically added if not provided.
    
    Returns:
        str: Success message with the number being called, or an error message
             if the call could not be initiated.
    
  • end_call

    End the current phone call.

    Terminates any active phone call by sending the end call keycode
    through ADB.
    
    Returns:
        str: Success message if the call was ended, or an error message
             if the end call command failed.
    
  • check_device_connection

    Check if an Android device is connected via ADB.

    Verifies that an Android device is properly connected and recognized
    by ADB, which is required for all other functions to work.
    
    Returns:
        str: Status message indicating whether a device is connected and
             ready, or an error message if no device is found.
    
  • send_text_message

    Send a text message to the specified number.

    Uses the phone's messaging app with UI automation to send SMS.
    Process: Opens messaging app, fills recipient and content, automatically clicks send button, then auto-exits app.
    
    Args:
        phone_number (str): Recipient's phone number. Country code will be automatically added if not included.
                          Example: "13812345678" or "+8613812345678"
        message (str): SMS content. Supports any text, including emojis.
                     Example: "Hello, this is a test message"
    
    Returns:
        str: String description of the operation result:
             - Success: "Text message sent to {phone_number}"
             - Failure: Message containing error reason, like "Failed to open messaging app: {error}"
                       or "Failed to navigate to send button: {error}"
    
  • receive_text_messages

    Get recent text messages from the phone.

    Retrieves recent SMS messages from the device's SMS database
    using ADB and content provider queries to get structured message data.
    
    Args:
        limit (int): Maximum number of messages to retrieve (default: 5)
                    Example: 10 will return the 10 most recent messages
    
    Returns:
        str: JSON string containing messages or an error message:
             - Success: Formatted JSON string with list of messages, each with fields:
                       - address: Sender's number
                       - body: Message content
                       - date: Timestamp
                       - formatted_date: Human-readable date time (like "2023-07-25 14:30:22")
             - Failure: Text message describing the error, like "No recent text messages found..."
    
  • get_sent_messages

    Get recently sent text messages from the phone.

    Retrieves sent SMS messages from the device's SMS database.
    This provides a complete list of messages that were successfully sent from this device.
    
    Args:
        limit (int): Maximum number of sent messages to retrieve (default: 5)
    
    Returns:
        str: JSON string containing sent messages with:
             - from: Sender phone number (device owner)
             - to: Recipient phone number
             - text: Message content
             - date: Timestamp
             - formatted_date: Human-readable date time (like "2023-07-25 14:30:22")
    
  • start_screen_recording

    Start recording the phone's screen.

    Records the screen activity for the specified duration and saves
    the video to the phone's storage. Automatically creates directories
    if they don't exist.
    
    Args:
        duration_seconds (int): Recording duration in seconds (default: 30,
                               max: 180 seconds due to ADB limitations)
    
    Returns:
        str: Success message with the path to the recording, or an error
             message if the recording could not be started.
    
  • play_media

    Simulate media button press to play/pause media.

    This function sends a keyevent that simulates pressing the media
    play/pause button, which can control music, videos, or podcasts
    that are currently playing.
    
    Returns:
        str: Success message, or an error message if the command failed.
    
  • set_alarm

    Set an alarm on the phone.

    Creates a new alarm with the specified time and label using the default
    clock application.
    
    Args:
        hour (int): Hour in 24-hour format (0-23)
        minute (int): Minute (0-59)
        label (str): Optional label for the alarm (default: "Alarm")
    
    Returns:
        str: Success message if the alarm was set, or an error message
             if the alarm could not be created.
    
  • receive_incoming_call

    Handle an incoming phone call.

    Checks for any incoming calls and provides options to answer
    or reject the call. This function first checks if there's an
    incoming call, then can either answer it or reject it based
    on the action parameter.
    
    Returns:
        str: Information about any incoming call including the caller
             number, or a message indicating no incoming calls.
    
  • get_contacts

    Retrieve contacts from the phone.

    Core function for accessing the contacts database on the device.
    Fetches contact information including names and phone numbers.
    Returns data in structured JSON format.
    
    Args:
        limit (int): Number of contacts to retrieve, defaults to 20
    
    Returns:
        str: JSON string with contact data or error message
    
  • create_contact

    Create a new contact on the phone.

    Opens the contact creation UI with pre-filled name and phone number,
    allowing the user to review and save the contact.
    
    Args:
        name (str): The contact's full name
        phone_number (str): The contact's phone number (For testing, 10086 is recommended)
        email (str, optional): The contact's email address
    
    Returns:
        str: Success message if the contact UI was launched, or an error message
             if the operation failed.
    
    Note:
        When testing this feature, it's recommended to use 10086 as the test phone number.
        This is China Mobile's customer service number, which is suitable for testing
        environments and easy to recognize.
    
  • get_current_window

    Get information about the current active window on the device.

    Retrieves details about the currently focused window, active application,
    and foreground activities on the device using multiple methods for reliability.
    
    Returns:
        str: JSON string with current window details or error message
    
  • get_app_shortcuts

    Get application shortcuts for installed apps.

    Retrieves shortcuts (quick actions) available for Android apps.
    If package_name is provided, returns shortcuts only for that app,
    otherwise lists all apps with shortcuts.
    
    Args:
        package_name (str, optional): Specific app package to get shortcuts for
    
    Returns:
        str: JSON string with app shortcuts information or error message
    
  • launch_app_activity

    $2e

  • list_installed_apps

    $2f

  • terminate_app

    Force stop an application on the device.

    Args:
        package_name (str): Package name of the app to terminate
    
    Returns:
        str: Success or error message
    
  • open_url

    Open a URL in the device's default browser.

    Args:
        url (str): URL to open
    
    Returns:
        str: Success or error message
    
  • analyze_screen

    $30

  • interact_with_screen

    $31

  • mcp_monitor_ui_changes

    Monitor the UI for changes with MCP compatible parameters.

    This is a simplified version of monitor_ui_changes that doesn't use callback functions,
    making it compatible with MCP's JSON schema requirements.
    
    Args:
        interval_seconds (float): Time between UI checks (seconds)
        max_duration_seconds (float): Maximum monitoring time (seconds)
        watch_for (str): What to watch for - "any_change", "text_appears", "text_disappears", 
                        "id_appears", "id_disappears", "class_appears", "content_desc_appears"
        target_text (str): Text to watch for (when watch_for includes "text")
        target_id (str): ID to watch for (when watch_for includes "id")
        target_class (str): Class to watch for (when watch_for includes "class")
        target_content_desc (str): Content description to watch for (when watch_for includes "content_desc")
    
    Returns:
        str: JSON string with monitoring results
    

Use Phone Control (Android ADB) MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once Phone Control (Android ADB) is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add Phone Control (Android ADB) as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the Phone Control (Android ADB) MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "phone-control-android-adb": {
      "command": "npx",
      "args": [
        "-y",
        "phone-mcp"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the Phone Control (Android ADB) MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the Phone Control (Android ADB) MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use Phone Control (Android ADB) to help me with this task?
Phone Control (Android ADB)
Sure. I read it.
Here is what I found using Phone Control (Android ADB).

Frequently asked questions

What is the Phone Control (Android ADB) MCP server used for?

Phone Control (Android ADB) is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use Phone Control (Android ADB) MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use Phone Control (Android ADB) with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use Phone Control (Android ADB) MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With Phone Control (Android ADB) connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect Phone Control (Android ADB) MCP to TypingMind?

Phone Control (Android ADB) runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does Phone Control (Android ADB) MCP provide in TypingMind?

Phone Control (Android ADB) exposes 21 MCP tools that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use Phone Control (Android ADB) MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If Phone Control (Android ADB) requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter πŸ‘‡