Android ADB MCP server

Provides a bridge to Android devices through ADB, enabling device management, shell command execution, app installation, screenshot capture, and file transfer across connected Android devices.
Back to servers
Provider
Landice Fu
Release date
Mar 01, 2025
Language
TypeScript
Package
Stats
580 downloads
14 stars

The Android ADB MCP Server enables AI assistants to interact with Android devices through the Android Debug Bridge (ADB). This powerful tool bridges the gap between AI capabilities and Android device management, allowing for seamless automation of Android development and testing operations.

Quick Setup

Add the server to your MCP configuration file:

{
  "mcpServers": {
    "android-adb": {
      "command": "npx",
      "args": ["-y", "@landicefu/android-adb-mcp-server"],
      "env": {},
      "disabled": false,
      "alwaysAllow": []
    }
  }
}

Configuration Locations

  • Claude Desktop: ~/Library/Application Support/Claude/claude_desktop_config.json (macOS)
  • Cline/Roo Code: ~/Library/Application Support/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/cline_mcp_settings.json (macOS)
  • For Windows/Linux, check the equivalent application support directories

After configuring, restart your AI assistant to load the new server configuration.

Prerequisites

Before using the Android ADB MCP Server, ensure you have:

  • ADB (Android Debug Bridge) installed and available in your system PATH
  • For clipboard functionality:
    • macOS: osascript (built-in)
    • Windows: PowerShell (built-in)
    • Linux: xclip (install via apt-get install xclip or equivalent)
  • Node.js 16.x or higher

Available Tools

The server provides the following tools to manage Android devices:

Tool Description Required Parameters Optional Parameters
adb_devices List connected devices None None
adb_shell Execute shell commands command device_id
adb_install Install APK files path device_id
adb_uninstall Uninstall applications package_name device_id
adb_list_packages List installed packages None device_id, filter
adb_pull Pull files from device remote_path, local_path device_id
adb_push Push files to device local_path, remote_path device_id
launch_app Launch an application package_name device_id
take_screenshot_and_save Take and save screenshot output_path device_id, format
take_screenshot_and_copy_to_clipboard Take screenshot to clipboard None device_id, format

Usage Examples

Listing Connected Devices

// Use the adb_devices tool to list all connected Android devices
const devices = await mcp.invoke("android-adb:adb_devices");
console.log(devices);

Executing Shell Commands

// Execute a shell command on the connected device
const result = await mcp.invoke("android-adb:adb_shell", {
  command: "ls /sdcard"
});

// For multiple devices, specify the device ID
const result = await mcp.invoke("android-adb:adb_shell", {
  command: "ls /sdcard",
  device_id: "emulator-5554"
});

Installing and Managing Apps

// Install an APK file
await mcp.invoke("android-adb:adb_install", {
  path: "/path/to/app.apk"
});

// List installed packages with an optional filter
const packages = await mcp.invoke("android-adb:adb_list_packages", {
  filter: "google"
});

// Launch an app
await mcp.invoke("android-adb:launch_app", {
  package_name: "com.example.app"
});

// Uninstall an app
await mcp.invoke("android-adb:adb_uninstall", {
  package_name: "com.example.app"
});

File Management

// Push a file to the device
await mcp.invoke("android-adb:adb_push", {
  local_path: "~/Documents/test.txt",
  remote_path: "/sdcard/test.txt"
});

// Pull a file from the device
await mcp.invoke("android-adb:adb_pull", {
  remote_path: "/sdcard/screenshot.png",
  local_path: "~/Downloads/screenshot.png"
});

Taking Screenshots

// Take a screenshot and save it to a file
await mcp.invoke("android-adb:take_screenshot_and_save", {
  output_path: "~/Screenshots/android_screen.png",
  format: "png" // Optional: png or jpg
});

// Take a screenshot and copy it to clipboard
await mcp.invoke("android-adb:take_screenshot_and_copy_to_clipboard");

Device Management

The server intelligently handles device selection:

  • If only one device is connected, it will be used automatically
  • If multiple devices are connected, you must specify a device_id parameter
  • If no devices are connected, an error will be returned

Alternative Installation Methods

Option 1: Install from npm

# Install globally
npm install -g @landicefu/android-adb-mcp-server

# Or install locally in your project
npm install @landicefu/android-adb-mcp-server

Option 2: Manual Installation from Source

  1. Clone the repository:

    git clone https://github.com/landicefu/android-adb-mcp-server.git
    cd android-adb-mcp-server
    
  2. Install dependencies and build:

    npm install
    npm run build
    
  3. Configure with direct path:

    {
      "mcpServers": {
        "android-adb": {
          "command": "node",
          "args": ["/path/to/android-adb-mcp-server/build/index.js"],
          "env": {},
          "disabled": false,
          "alwaysAllow": []
        }
      }
    }
    

Troubleshooting

Common Issues

  1. "ADB is not available" error

    • Ensure ADB is installed and in your system PATH
    • Verify by running adb version in your terminal
  2. "No Android devices connected" error

    • Check if your device is properly connected with adb devices
    • Ensure USB debugging is enabled on your device
    • Try restarting ADB with adb kill-server followed by adb start-server
  3. "Multiple devices connected" error

    • Specify the device_id parameter in your tool call
    • Get the list of available devices with the adb_devices tool
  4. Screenshot to clipboard not working

    • Ensure the required platform-specific tools are installed

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later