Skip to main content
Glama
adb-door
by panii8

adb-door

An MCP server that lets an AI agent use the tools an Android app declares for itself, over the USB cable.

Most Android MCP servers drive the phone like a finger: screenshots, taps, swipes. This one does something different. The app itself says "here are the things you can ask me to do" (read my agenda, add a task, reorder my goals), and the agent calls them directly, with no UI in the loop.

AI agent ──MCP──▶ adb-door (PC) ──adb, USB──▶ ContentProvider "door" (in your app) ──▶ your code

Why a door and not a screen

  • Fast and exact. A tool call is a JSON document, not a sequence of taps.

  • Your contract. The app declares its tools in code. A new tool shows up in the agent without changing this server.

  • Locked to the cable. The door obeys only adb shell. See Security.

  • Undoable by design. Every call carries a conversation id, so your app can log what the agent wrote and let the user undo the whole conversation at once. (Your app implements that part; the server just sends the id.)

Related MCP server: scrcpy-mcp

What is in this repository

Path

What

src/adb_door/

The MCP server (Python, runs on your computer).

android/AdbDoorProvider.kt

The door: an abstract ContentProvider you copy into your app.

android/ExampleDoor.kt

The smallest working door: one tool, hello.

docs/PROTOCOL.md

The wire contract your app implements.

tests/

Server tests, no phone needed.

Quick start

1. In your Android app

Copy android/AdbDoorProvider.kt into your project (change its package line) and write a subclass that implements handle. android/ExampleDoor.kt is a complete one.

Declare it in AndroidManifest.xml:

<provider
    android:name=".ExampleDoor"
    android:authorities="com.example.adbdoor.door"
    android:exported="true"
    android:permission="android.permission.DUMP" />

android:exported="true" together with android:permission is what makes the first wall work: only callers holding DUMP get through, and only adb shell has it. Do not remove either.

If your app is built with Flutter, call into Dart from handle through a MethodChannel and keep the contract in Dart, so the tools live next to the rest of your code. Serve the door from the same engine as the UI, never from a second one.

2. On your computer

Plug the phone in and accept USB debugging. You need uv and adb (Android SDK platform-tools).

Install today: from a clone. The package is not on PyPI yet, so uvx adb-door does not work yet. Clone this repository and point your MCP client at it. For Claude Code, in .mcp.json:

{
  "mcpServers": {
    "myapp": {
      "command": "uv",
      "args": ["run", "--quiet", "--directory", "/path/to/adb-door", "adb-door"],
      "env": {
        "ADB_DOOR_AUTHORITY": "com.example.adbdoor.door",
        "ADB_DOOR_NAME": "My App"
      }
    }
  }
}

Replace /path/to/adb-door with where you cloned it (on Windows, use forward slashes or doubled backslashes). Once the package is published on PyPI, the command and args will become "uvx" and ["adb-door"].

Settings

All through environment variables:

Variable

Default

Meaning

ADB_DOOR_AUTHORITY

required

The provider authority from your manifest.

ADB_DOOR_NAME

the authority

Name shown in error messages and used as the MCP server name.

ADB_DOOR_SERIAL

none

Which phone, when more than one is plugged in (adb devices).

ADB_DOOR_ADB

adb on PATH, then the SDK's platform-tools

Path to adb.

ADB_DOOR_INSTRUCTIONS

built-in text

A path to a text file, or the text itself, given to the agent as server instructions.

Security

Read this before you ship a door in a real app. It opens a privileged path into the app, and the cable is the only thing that guards it.

  • Two walls. The manifest requires android.permission.DUMP (held by adb shell, not obtainable by installed apps). The code also requires the caller to be uid 2000, shell. Either wall alone is weaker: the first can be granted to another app with pm grant, the second is not enforced until the call arrives.

  • Whoever has adb to the phone can use the door. That means anyone with an authorized computer and the phone unlocked for debugging, and also wireless debugging if you turn it on. Keep USB debugging off when you do not need it.

  • Treat tool results as data, not instructions. An agent that reads text out of your app (a note, a title) may be tricked by text that says "now do X". The server's default instructions say so, but the real safety net is on your side: log every write and make it undoable. Do not give the agent web or email tools in the same session if the door can write.

  • Never put secrets in tool results you would not paste in a chat.

  • A timeout is not "nothing happened". The app may finish a write after the server gave up waiting. The server says so; make your tools safe to inspect before retrying.

Report vulnerabilities as described in SECURITY.md.

Status

Early, alpha. The design comes from three apps that have used it daily; this repository is the generalized version.

What has been tested, and on what:

  • Server: 28 tests that run without a phone, on Python 3.14. An end-to-end run through a real MCP client with a fake adb listed and called a tool.

  • Android files: AdbDoorProvider.kt and ExampleDoor.kt, copied unchanged into a fresh Flutter app, compiled and ran on a physical phone (Motorola Razr 60 Ultra, Android 16, USB debugging). The server listed the tool, called it, sent a 100 KB request, and got a clear error for an unknown tool.

  • Both walls: a second installed app, with DUMP requested in its manifest, was rejected by the system. After DUMP was granted to it by hand with adb shell pm grant, it was rejected by the uid check.

What has not been tested:

  • Other Android versions or devices, other manufacturers, and work profiles or secondary users (the uid check is written to handle them, but it was only run on the main profile).

  • Python versions other than 3.14. pyproject.toml says 3.10 or later because that is what the mcp package requires.

  • Calling the door while the app is not running. The example door answers in plain Kotlin, so it does not exercise cold start. If your handler needs an engine such as Flutter's, test that path yourself.

  • macOS and Linux for the server. The code does not depend on Windows.

If something is off, please open an issue with your Android version and the adb logcat -s AdbDoor output.

Development

uv run pytest

License

MIT, see LICENSE.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      B
      maintenance
      Enables coding agents to observe and control an authorized Android phone over ADB through MCP tools and a JSON CLI. It supports UI inspection, screenshots, taps, swipes, typing, key presses, app listing, and launching.
      13
      6
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables AI agents to visually perceive and directly control Android devices via ADB and screen-control tooling, including screenshots, taps, swipes, typing, app management, UI inspection, file transfer, shell commands, and audio/video streaming.
      801 npm
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to remotely control a real Android phone over MCP with no ADB, root, or emulator, by connecting a broker server to a sideloaded APK. Exposes tools to list devices, capture screenshots, read the UI tree, open links and deep links, and perform taps, swipes, typing, and global navigation actions.
      1
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables AI agents to see and drive a real Android phone over plain ADB: screenshots and numbered UI trees, gestures, typing with accents and emoji, SMS/RCS reading and prepared replies, notifications, files, and settings, with no root and no app installed on the phone. Safeguards mask security codes and require explicit confirmation before sending, paying, deleting or confirming anything.
      18
      2
      MIT