Language models are good at deciding what to do next on a screen. What they lack is a safe, narrow way to actually do it. adb-mcp is my answer for Android: an MCP server that turns adb, the tool every Android developer already has, into a small set of actions an agent can call.
Why adb
adb already does everything an agent needs. It captures the screen, injects taps and swipes, types text, sends key events, installs and launches apps, and reads logs. It works over USB or WiFi, it ships with the platform tools on every desktop OS, and in Termux it's one pkg install android-tools away. Building on it meant no companion app on the phone, no accessibility hooks and no root.
Eleven narrow tools, not one shell
The tempting shortcut is a single adb_shell tool that runs any command. I didn't ship that. A model with a raw shell is hard to reason about, hard to review and easy to misuse. Instead the server exposes eleven tools, each with one job:
list_devices, screencap, tap, swipe, input_text and keyevent for seeing and driving the screen.
list_packages, install_apk and launch for apps.
battery and logcat for diagnostics.
Narrow tools make the transcript readable. When an agent taps, you see exactly where, and a client can ask for approval per tool rather than per arbitrary string.
Local by default
The server speaks MCP over stdio, so the client starts it as a local process and talks to it through pipes. There's no port to expose and no service in the middle. Screenshots and logs go from the phone to your machine and into the client you already use. That's what "zero cloud" means here: adb-mcp itself never sends anything anywhere.
Testing without a phone
Hardware-dependent code is miserable to test, so the server has a --mock mode that answers every tool with canned device responses. The test suite runs against it: five passing tests, zero hardware needed. It also makes the server easy to try in a client before anything is plugged in.
Install
# isolated install that puts the server on your PATH
pipx install adb-mcp
Then add it to Claude Desktop or Cursor as a stdio server. The README on GitHub has the exact client configuration.
What's next
Two things are on the roadmap: streaming logcat instead of fixed reads, and a wireless pairing wizard so connecting a phone over WiFi doesn't mean typing pairing codes by hand.
If you build something with it, or want a tool it doesn't have yet, open an issue on the repo.
Most of what's on this site was written, run and tested on an Android phone. Not as a stunt: a modern phone has more CPU than the laptops I learned on, and working inside its limits keeps my software honest. Here's the setup.
Termux is the base
Termux gives Android a real Linux userland with its own package manager. The core of my toolchain is a handful of packages:
pkg install python nodejs git
pkg install android-tools # adb and fastboot
When I need a full distribution, for software that assumes glibc or a standard filesystem layout, proot runs one in user space without root. Most days I don't need it.
adb, pointed at the same phone
This is the part people don't expect. On Android 11 and later, Wireless debugging lets adb pair with a device over the local network, and that includes the phone talking to itself. Pair once with adb pair using the code from Developer options, then adb connect, and Termux has adb access to the device it's running on. That's how adb-mcp gets exercised on the same hardware it controls.
Hardware on a cable
An ESP32 connects through a USB-OTG adapter and shows up as a serial device, or talks over Bluetooth LE when I don't want a cable. The phone becomes the controller, the logger and the place the code is written.
Constraints as a feature
- Performance is visible. If something is slow on a phone with no cloud behind it, I find out immediately.
- Small tools win. CLIs and single-file builds beat heavy toolchains, which is why this site ships as one HTML file.
- Local first. When the workstation is the device, sending data elsewhere is a choice I have to make on purpose.
None of this replaces a desktop for everything. But for agents, Android tooling and small hardware, the phone has turned out to be the right bench.
My Nothing Phone (3a) got stuck in a boot loop: logo, restart, logo, restart. The obvious fix is a factory reset, which erases everything. I got it back with a single stock boot image flash instead, and lost nothing. The full write-up is on GitHub; this is the short version and the reasoning.
Why one image can fix it
Android splits storage into partitions. The boot image holds the kernel and the early ramdisk that start the system. Your apps and files live on a separate userdata partition. If the boot image is broken or doesn't match the rest of the firmware, the phone can't get far enough to start Android, so it restarts and tries again. Replacing just that image with the correct stock one fixes start-up without touching userdata.
The shape of the fix
With the phone in its bootloader (fastboot) mode and connected over USB:
fastboot devices # confirm the phone is seen
fastboot getvar current-slot # A/B devices: which slot is active
fastboot flash boot boot.img # stock image, exact same build
fastboot reboot
On A/B devices, flashing boot writes to the active slot, which is why it's worth checking the slot first.
Rules I'd follow again
- Match the build exactly. The image has to come from the same firmware version the phone is running. Close enough can make things worse.
- Check which image your firmware ships. On newer devices the generic ramdisk lives in a separate
init_boot partition. Flash the one that's actually broken.
- Never wipe by reflex. Commands like
fastboot -w or erasing userdata are the factory reset you were trying to avoid.
- This needs an unlocked bootloader. Flashing requires it, and unlocking a locked bootloader wipes the phone. If yours is locked, this route won't save your data.
The best recovery is the one you don't need: keep a copy of the stock boot image for your exact build before you modify anything.