mcadb
A Model Context Protocol server that gives AI assistants direct control over Android devices through ADB. Point any MCP-compatible client at a phone plugged into USB, and it can take screenshots, tap buttons, launch apps, inspect UI elements, transfer files, and run shell commands — all through structured, type-safe tool calls.
Built on FastMCP with a modular mixin architecture. 65 tools across 8 domains. Tested on real hardware.
Quick Start
# Run directly (no install)
uvx mcadb
# Or install and run
uv add mcadb
mcadb
MCP Client Configuration
Add to your MCP client's config (Claude Desktop, Claude Code, etc.):
{
"mcpServers": {
"mcadb": {
"command": "uvx",
"args": ["mcadb"]
}
}
}
For Claude Code:
claude mcp add mcadb -- uvx mcadb
For local development:
claude mcp add mcadb -- uv run --directory /path/to/mcp-adb mcadb
Prerequisites
- Python 3.11+
- ADB installed and on
PATH(adb devicesshould work) - USB debugging enabled on the Android device
- Device connected via USB (or
adb connectfor network)
What Can It Do?
Standard Tools (always available)
| Domain | Tool | What it does |
|---|---|---|
| Devices | devices_list |
Discover connected devices (USB + network) |
devices_use |
Select a device by serial or by name ("power armor"); explains clearly when it is absent | |
devices_current |
Show which device is selected | |
device_info |
Battery, WiFi, storage, Android version, model | |
devices_discover |
Find wireless-debugging devices via mDNS (by serial), optionally connect; list devices seen before | |
| Connectivity | adb_connect |
Connect to device over TCP/IP |
adb_disconnect |
Disconnect a network device | |
adb_pair |
Wireless debugging pairing (Android 11+) | |
device_properties |
Batch getprop (model, SoC, versions, serial, ABI) | |
| Input | input_tap |
Tap at screen coordinates |
input_swipe |
Swipe between two points | |
input_scroll_down |
Scroll down (auto-detects screen size) | |
input_scroll_up |
Scroll up (auto-detects screen size) | |
input_back |
Press Back | |
input_home |
Press Home | |
input_recent_apps |
Open app switcher | |
input_key |
Send any key event (VOLUME_UP, ENTER, etc.) |
|
input_text |
Type text into focused field | |
clipboard_set |
Set clipboard (handles special chars), optional auto-paste | |
| Apps | app_launch |
Launch app by package name |
app_open_url |
Open URL in default browser | |
app_close |
Force stop an app | |
app_current |
Get the foreground app and activity | |
| Screen | screenshot |
Capture screen as PNG |
screen_size |
Get display resolution | |
screen_density |
Get display DPI | |
screen_on / screen_off |
Wake or sleep the display | |
| UI | ui_dump |
Dump accessibility tree (all visible elements) |
ui_find_element |
Search for elements by text, ID, class, or description | |
wait_for_text |
Poll until text appears on screen | |
wait_for_text_gone |
Poll until text disappears | |
tap_text |
Find an element by text and tap it | |
| Settings | settings_get |
Read any system/global/secure setting |
settings_changes |
Settings mcadb changed and has not restored, with drift detection | |
notification_list |
List recent notifications (title, text, package) | |
clipboard_get |
Read clipboard contents | |
media_control |
Play/pause/next/previous/stop/volume | |
| Look | screen_inspect |
Screenshot returned as an image, with numbered marks on every button, field, toggle and scroll area, plus which window really has input focus |
tap_mark |
Tap a mark by number; refuses if focus moved since the inspect, or a crash/ANR dialog or lock screen has focus | |
| Chrome | chrome_tabs |
List tabs: which is on screen, which mcadb opened |
chrome_tab_open |
Open a URL in a new tab that mcadb tracks | |
chrome_tab_close |
Close tabs mcadb opened; refuses the user's own tabs | |
chrome_tab_activate |
Bring a tab to the front | |
chrome_detach |
Remove mcadb's DevTools forward (also automatic on shutdown) | |
| Logs | logs_query |
Read the live log buffer by level, tag, package, pid, regex or time; page with a cursor |
logs_wait_for |
Block until a matching log line appears | |
crashes_list |
Java crashes, native crashes and ANRs detected so far | |
crash_get |
Full crash report plus the process's own lines leading up to it | |
logs_start / logs_stop / logs_status |
Manage the per-device background readers | |
| Config | config_status |
Show current settings |
config_set_developer_mode |
Toggle developer tools | |
config_set_screenshot_dir |
Set where screenshots are saved |
Developer Mode Tools
Enable with config_set_developer_mode(true) to unlock power-user tools. Destructive operations (uninstall, clear data, reboot, delete) require user confirmation via MCP elicitation.
| Domain | Tool | What it does |
|---|---|---|
| Shell | shell_command |
Run any shell command on device |
| Settings | settings_restore |
Put back what mcadb changed: one key, a namespace, or everything |
animation_scale |
Set all three animation scales at once (0 = off), recorded for restore | |
| Web | web_eval |
Evaluate JavaScript in the visible (or a given) Chrome tab |
| Input | input_long_press |
Press and hold gesture |
| Apps | app_list_packages |
List installed packages (with filters) |
app_install |
Install APK from host | |
app_uninstall |
Remove an app (with confirmation) | |
app_clear_data |
Wipe app data (with confirmation) | |
activity_start |
Launch activity with full intent control | |
broadcast_send |
Send broadcast intents | |
| Screen | screen_record |
Record screen to MP4 |
screen_set_size |
Override display resolution | |
screen_reset_size |
Restore original resolution | |
| Device | device_reboot |
Reboot device (with confirmation) |
logcat_capture |
Capture system logs | |
logcat_clear |
Clear log buffer | |
| Files | file_push |
Transfer file to device |
file_pull |
Transfer file from device | |
file_list |
List directory contents | |
file_delete |
Delete file (with confirmation) | |
file_exists |
Check if file exists | |
| Connectivity | adb_tcpip |
Switch USB device to TCP/IP mode |
| Settings | settings_put |
Write system/global/secure setting |
wifi_toggle |
Enable/disable WiFi | |
bluetooth_toggle |
Enable/disable Bluetooth | |
airplane_mode_toggle |
Toggle airplane mode (with confirmation) | |
screen_brightness |
Set brightness 0-255 | |
screen_timeout |
Set screen timeout duration |
Resources
| URI | Description |
|---|---|
adb://devices |
Connected device list |
adb://device/{id} |
Detailed device properties |
adb://apps/current |
Currently focused app |
adb://screen/info |
Screen resolution and DPI |
adb://help |
Tool reference and tips |
Usage Examples
Screenshot + UI inspection loop (how an AI assistant typically navigates):
1. screenshot() → See what's on screen
2. ui_dump() → Get element tree with tap coordinates
3. tap_text("Settings") → Tap the "Settings" element
4. wait_for_text("Wi-Fi") → Wait for the screen to load
5. screenshot() → Verify the result
Look, then act by number (no pixel guessing):
1. screen_inspect() → Image with numbered marks + list:
3 button "Save" @ 540,1820
2. tap_mark(3, then_inspect=True) → Taps "Save", returns the new screen
In Chrome, the marks include the page's own links, buttons, fields and menu items, read through Chrome DevTools and mapped to screen pixels. Tapping a page mark re-checks the live page first and refuses if it scrolled or the tab changed.
Every input tool also accepts expect_package=["com.example.app"] and refuses
to send anything unless that app's window has input focus. A crash dialog can
hold focus while the screenshot still shows your app; this catches it.
Debug a crash (no setup needed, the log reader starts on first use):
1. logs_query(level="E", limit=1) → Starts the reader; note next_seq
2. tap_text("Checkout") → Reproduce the problem
3. crashes_list(since_seq=<next_seq>) → What crashed since then?
4. crash_get(<id>) → Stack trace, root cause, and the
app's last log lines before it died
Confirm a handler actually ran:
1. tap_text("Sync now")
2. logs_wait_for("sync complete", package="com.example.app", timeout_s=20)
Open a URL and check what loaded:
1. app_open_url("https://example.com")
2. wait_for_text("Example Domain")
3. screenshot()
Install and launch an APK (developer mode):
1. config_set_developer_mode(true)
2. app_install("/path/to/app.apk")
3. app_launch("com.example.myapp")
4. logcat_capture(filter_spec="MyApp:D *:S")
Connect to a WiFi device:
1. adb_connect("192.0.2.25") → Connect to network device
2. devices_list() → Verify it appears
3. screenshot() → Capture from network device
Multi-device workflow:
1. devices_list() → See all connected devices
2. devices_use("SERIAL_NUMBER") → Select target device
3. device_info() → Check battery, WiFi, storage
4. screenshot() → Capture from selected device
Read settings and control media:
1. settings_get("global", "wifi_on") → Check WiFi state
2. notification_list() → See recent notifications
3. media_control("pause") → Pause media playback
4. clipboard_get() → Read clipboard contents
Architecture
The server uses FastMCP's MCPMixin pattern to organize 84 tools into focused, single-responsibility modules:
src/mcadb/
server.py ← create_server(), ADBServer (thin orchestrator)
config.py ← Persistent config (~/.config/adb-mcp/config.json)
models.py ← Pydantic models (DeviceInfo, CommandResult, ScreenshotResult)
mixins/
base.py ← ADB command execution, injection-safe shell quoting
devices.py ← Device discovery, info, logcat, reboot
connectivity.py ← TCP/IP connect/disconnect, wireless pairing, properties
input.py ← Tap, swipe, scroll, keys, text, clipboard, shell
apps.py ← Launch, close, install, intents, broadcasts
screenshot.py ← Capture, recording, display settings
ui.py ← Accessibility tree, element search, text polling
files.py ← Push, pull, list, delete, exists
settings.py ← System settings, radios, brightness, notifications, media
logs.py ← Live logs, waits, crash reports (tools)
inspect.py ← screen_inspect, tap_mark (tools)
chrome.py ← Chrome tabs, page marks, web_eval (tools)
cdp/
forwards.py ← adb forwards mcadb creates, tracks and removes
client.py ← DevTools HTTP endpoints + one-shot Runtime.evaluate
collector.py ← In-page JS: visible, unobstructed interactive elements
geometry.py ← Page CSS px → device px (compositor bounds, visual viewport)
screen/
marks.py ← uiautomator dump → numbered actionable marks
overlay.py ← Draws marks, scales and encodes the image
focus.py ← Which window really receives input
logcat/
parser.py ← `logcat -v epoch -v uid` line parser
crashes.py ← Java crash, native crash and ANR reconstruction
buffer.py ← Ring buffer with seq cursors and filters
stream.py ← Background reader per device, reconnect + resume
ADBServer inherits all eleven mixins. Each mixin calls run_shell_args() (injection-safe) or run_adb() on the base class. The base handles device targeting, subprocess execution, and timeouts.
Security Model
All tools that accept user-provided values use injection-safe command execution:
run_shell_args()quotes every argument withshlex.quote()before sending to the device shell. This is the default for all tools.run_shell()(string form) is only used by the developer-modeshell_commandtool, where the user intentionally provides a raw command.input_text()rejects special characters ($ ( ) ; | & < >etc.) and directs users toclipboard_set()instead.input_key()strips non-alphanumeric characters from key codes.- Input focus guard: every input tool takes
expect_package, andtap_markalways checks that focus has not moved since its marks were taken. Focus is read frommCurrentFocusin the display section ofdumpsys window, notmFocusedApp, because crash dialogs, ANR dialogs and system windows can hold input while the app is still on top. - Shared adb state: DevTools forwards are created with
tcp:0(adb picks the port), recorded, and removed onchrome_detachor shutdown. mcadb never removes a forward it did not create, and never runsforward --remove-all. - Settings are restorable:
settings_putandanimation_scalerecord the value from before mcadb's first change in~/.config/adb-mcp/settings-journal.json(it survives restarts), andsettings_restoreputs it back, deleting keys that did not exist before. - User tabs:
chrome_tab_closeonly closes tabs opened bychrome_tab_openin the same server. - Destructive operations (uninstall, clear data, delete, reboot) require user confirmation via MCP elicitation.
- Developer mode is off by default and must be explicitly enabled. While it is off, developer tools are hidden from the tool list entirely rather than listed and refused. Turning it on with
config_set_developer_modeupdates the session's tool list immediately (clients gettools/list_changed). Settings persist at~/.config/adb-mcp/config.json.
Docker
The container uses your host's adb server by default, so it needs no
--privileged, no USB passthrough, and never competes with other adb users
for the phone. It reaches the server over host networking
(ADB_SERVER_SOCKET=tcp:127.0.0.1:5037).
make env # create .env (mode, port, uid/gid)
make up # build and start; HTTP on 127.0.0.1:8475
make health # {"ok":true,"adb_server":"127.0.0.1:5037","adb_protocol":41}
make help # everything else
Connect a client to the running container:
claude mcp add --transport http mcadb-docker http://127.0.0.1:8475/mcp
Or run one stdio container per session, with no compose at all:
docker build --target runtime -t mcadb:local .
claude mcp add mcadb-docker -- docker run -i --rm --network host mcadb:local
Modes (COMPOSE_PROFILES in .env):
| Profile | adb server | Use |
|---|---|---|
prod |
host's | Default. Read-only filesystem, non-root, health-checked |
dev |
host's | make dev: src/ syncs into the container and it restarts on change |
usb |
the container's own, with USB passthrough | Hosts with no adb installed. Stop any host adb server first: two servers cannot share one phone |
Safety. An adb client whose protocol version differs from the running
server's kills that server on first contact, dropping every forward and
session using it. mcadb checks the server's version over the adb wire
protocol before starting and refuses on a mismatch (override:
MCADB_ALLOW_ADB_RESTART=1). The image's adb reports protocol 1.0.41, like
current platform-tools.
The HTTP endpoint has no authentication and controls a phone, so it binds to
127.0.0.1 only and is deliberately not put behind a reverse proxy.
The settings journal and known-devices list are shared with mcadb on the host
through a bind mount of ~/.config/adb-mcp.
Development
# Clone and install
git clone https://git.supported.systems/MCP/mcp-adb.git
cd mcp-adb
uv sync --group dev
# Run locally
uv run mcadb
# Lint
uv run ruff check src/
# Format
uv run ruff format src/
# Type check
uv run mypy src/
Configuration
Settings are stored at ~/.config/adb-mcp/config.json (override with ADB_MCP_CONFIG_DIR env var):
{
"developer_mode": false,
"default_screenshot_dir": null,
"auto_select_single_device": true
}
| Setting | Default | Description |
|---|---|---|
developer_mode |
false |
Unlock advanced tools (shell, install, reboot, etc.) |
default_screenshot_dir |
null |
Directory for screenshots/recordings (null = cwd) |
auto_select_single_device |
true |
Skip device selection when only one is connected |
License
MIT
Metadata
Release files for mcadb 2026.11.28
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mcadb-2026.11.28.tar.gz | 165.6 kB | Without provenance | Details for mcadb-2026.11.28.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mcadb-2026.11.28-py3-none-any.whl | Python 3 | none | any | Details for mcadb-2026.11.28-py3-none-any.whl |
Total release size: 261.8 kB
Release files / mcadb-2026.11.28.tar.gz
| Download URL | mcadb-2026.11.28.tar.gz |
|---|---|
| Size | 165.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bdf584ae91c25c47a8edd265d0aaf7f64895997e685c2efac3f3be70696d2d47
|
|
BLAKE2b-256 checksum How to use checksums |
f846d38d01f061675cbba069f72e42b43b958566192a8dd360866b9eec87ee0a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"EndeavourOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / mcadb-2026.11.28-py3-none-any.whl
| Download URL | mcadb-2026.11.28-py3-none-any.whl |
|---|---|
| Size | 96.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8088156f72b018dd3d73faa153778867c98f0e758f14bb6468925a03e3ab6746
|
|
BLAKE2b-256 checksum How to use checksums |
479d80f5097090c48b8c3094758ea00197fbbd5c210bc96cb798abc48122df71
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"EndeavourOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for mcadb 2026.11.28
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.