Skip to main content

Android device control through MCP and a deterministic CLI

Project description

opdroid

Android device control through MCP and a deterministic CLI.

opdroid exposes a connected Android device as a set of practical tools: capture a gridded screen, inspect UI hierarchy, tap cells, swipe, type text, press Android navigation keys, and launch apps. Bring your own MCP-capable agent.

Requirements

  • Python 3.10+
  • ADB installed and running
  • Android device or emulator with USB debugging enabled

Installation

pip install opdroid

You can also run it without installing into the current environment:

uvx opdroid --help
uvx opdroid devices

For local development:

uv sync
uv run opdroid --help

MCP Server

Run the MCP server over stdio:

opdroid mcp

Run it directly from PyPI with uvx:

uvx opdroid mcp

Target a specific device:

opdroid mcp --serial emulator-5554
uvx opdroid mcp --serial emulator-5554

Print a ready-to-copy MCP config snippet:

opdroid mcp-config

Example config:

{
  "mcpServers": {
    "opdroid": {
      "command": "opdroid",
      "args": ["mcp"]
    }
  }
}

Alternative config that runs through uvx without a prior install:

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

Project-local Codex config example in .codex/config.toml:

[mcp_servers.opdroid]
command = "uvx"
args = ["opdroid", "mcp"]
enabled = true

Agent Skill

Print the recommended skill text for another agent:

opdroid skill

The MCP server also exposes this through get_android_use_skill.

CLI

List devices:

opdroid devices

Capture the current screen with a grid and UI hierarchy:

opdroid screen --output artifacts/screen.png

Operate the device:

opdroid tap E10
opdroid tap-sequence B16 E16 H16
opdroid swipe E18 E6
opdroid input-text "hello world"
opdroid press back
opdroid launch-app com.android.settings

MCP Tools

  • get_screen: returns a gridded screenshot and compact interactive element list.
  • tap: tap a grid cell.
  • tap_sequence: tap multiple grid cells.
  • swipe: swipe between two grid cells.
  • input_text: type text into the focused field.
  • press_home, press_back, press_enter, press_recent_apps: Android key actions.
  • launch_app: launch an app by package name.
  • wait: wait for loading or animation.
  • list_devices: list connected Android devices.
  • get_android_use_skill: return the recommended agent skill text.

Configuration

By default opdroid connects to ADB at 127.0.0.1:5037.

Environment variables:

  • OPDROID_ADB_HOST: ADB server host.
  • OPDROID_ADB_PORT: ADB server port.
  • OPDROID_CELL_SIZE: grid cell size in analysis screenshots.

Equivalent CLI options are available where device access is needed:

opdroid devices --adb-host 127.0.0.1 --adb-port 5037
opdroid mcp --adb-host 127.0.0.1 --adb-port 5037

Development Checks

uv run python -m compileall src tests
uv run opdroid --help

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

opdroid-1.0.1.tar.gz (79.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

opdroid-1.0.1-py3-none-any.whl (19.9 kB view details)

Uploaded Python 3

File details

Details for the file opdroid-1.0.1.tar.gz.

File metadata

  • Download URL: opdroid-1.0.1.tar.gz
  • Upload date:
  • Size: 79.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for opdroid-1.0.1.tar.gz
Algorithm Hash digest
SHA256 701b2309d58a0156e2b8dae1efbd8946a8ae5620211f9e8ffe1db546e4293216
MD5 c23a8bc634b56ad39562fb1631003fbc
BLAKE2b-256 56c38825a6c70929ce2db49a9db6483bbca9c650f49f10330e81b349a772a864

See more details on using hashes here.

File details

Details for the file opdroid-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: opdroid-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 19.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for opdroid-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 46d70a1dcf600e67fbc106bb3585f5650011cf96ddc42e23137608fde0d55f43
MD5 c0a75f9d3c9a9eaf7c18145aa11876c4
BLAKE2b-256 47253607f8c2d9237094b2abb6c6b8778ff7c9a827dd7741eafbb0b48056296b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page