Repository navigation
Releases
Releases · Draklyfg/android-mcp
v0.1.1
[0.1.1] - 2026-12-05
Fixed
input_textnow types percent signs correctly. Verified against the
AOSPInput.javasendTextsource: it rewrites only the exact
sequence%sinto a space; a%followed by anything else (or at
the end of the string) passes through unchanged, and%%is not
an escape. The old encoder doubled every%, so100%was typed as
100%%,50%salecame out as50% ale, and a URL such as
https://example.com/a%20bgained a spurious percent. Percent signs
are now sent as-is, spaces still go through%s, and a literal%s
in the user's text is split across twoinput textcalls (between
the%and thes) so it is typed literally instead of becoming a
space. Control characters (newlines, tabs, ...) are now rejected
with an explanation, sinceinput texthas no encoding for them.dump_ui_treerace: every call shared the remote file
/sdcard/window_dump.xml, so concurrent dumps could overwrite or
delete each other's output (the first caller could get an empty or
foreign hierarchy). Each call now uses a unique remote filename
(pid + counter + random token), removes only its own file, and a
cleanup failure can no longer mask the dump result.- The output cap is now enforced while output streams in, not after
the fact. Both pipes are drained concurrently under a hard byte
limit and the process is stopped as soon as a stream exceeds it;
previously the whole output was buffered first, so a runaway
command could consume unbounded memory before the 4 MiB cap was
applied (a one-second stdout flood grew the server process to
roughly 1 GB). Normal outputs are byte-for-byte unchanged, and
timeouts behave as before. screenshotnow validates that the capture is a complete PNG: the
full PNG signature and the final IEND chunk are both required, so a
truncated capture is reported as an error instead of being returned
as an image. Screenshots get their own larger capture limit
(32 MiB), and binaryexec-outoutput in general now raises when it
exceeds its limit instead of silently returning partial data.- Over-limit output is no longer returned as success through the text
and binary paths. The streaming cap already flagged the stream that
overflowed, but_run_textignored the flags andexec_outchecked
only stdout — so a command whose stderr overflowed (including one
that also exited non-zero behind the cap) came back with partial
output as if it had succeeded, and anexec-outcapture could
return partial binary when only its stderr had flooded. Both paths
now raise a clear error naming the stream that overflowed and the
limit, whichever stream it was. Normal commands and screenshots are
byte-for-byte unchanged.
v0.1.0
[0.1.0] - 2026-12-05
Initial release.
Added
- MCP server over stdio, built on the official
mcpPython SDK. Runs as
theandroid-mcpconsole script orpython -m android_mcp. - Device tools:
list_devicesandget_device_info(model, manufacturer,
Android version, SDK level, build id, battery level).list_devices
returns an empty list with an explanatory error instead of crashing when
theadbbinary is missing. - Screen tools:
screenshotreturns the current screen as a PNG image;
dump_ui_treerenders the uiautomator hierarchy as a compact text tree
with short class and resource-id names, bounds, and flags such as
[clickable]and[disabled], capped at 500 nodes. - Input tools:
tap,swipe,press_key(by name or numeric keycode),
andinput_textwith shell metacharacters escaped, spaces encoded as
%s, and newlines rejected. - App tools:
launch_app,list_packages(optionally third-party only),
install_apk, anduninstall_package. Package names are validated
before they reach the device. logcatreturning the last 1–1000 lines, with an optional substring
filter.shell_readonly, a deliberately small read-only command surface. The
allowlist isgetprop [name],dumpsys battery,df [path], and
ps [-A|-e]; every token is character-checked and anything else is
rejected before it reaches the device.- ADB wrapper that only ever builds argument lists, never shell strings.
Every call has a timeout (30 s by default, 60 s for screenshots and
logcat, 180 s for installs) and captured output is capped at 4 MiB.
When more than one usable device is attached, an explicit serial is
required so a command can never land on the wrong device. - Test suite (52 tests) that runs without a real device against a fake
adbexecutable, including an end-to-end test that spawns the server
over stdio and drives it with a real MCP client.