Skip to content
Projects

About

uiautodev official repo

Productivity & Automation

How these counts are measured

Measured star growth

in 24h
0
in 7 days
Collecting history
in 15 days
Collecting history
in 1 month
Collecting history

Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.

README.en.md

Original

uiautodev

A desktop app and web server for controlling Android, iOS and HarmonyOS phones from your computer, with support for controlling multiple devices at once.

Key features:

  • View and control Android / iOS / HarmonyOS phone screens from your computer, with multi-device group control
  • Embed a device screen into another page with an iframe, either read-only or controllable
  • UI hierarchy tree, XPath queries, app management with package upload and install, and device clipboard
  • MCP server: let AI and automation clients operate devices directly
  • Plugin extensibility and a web server you can use from any browser
  • Cluster aggregation, multi-user device presence, Chinese/English UI and dark mode

Android, iOS and HarmonyOS demo

Download and usage

The desktop app (macOS / Windows) and the server binaries for every platform can be downloaded from https://get.uiauto.dev. The server can also be started directly with npx uiautodev run.

Repository layout

Directory Description
Root Desktop app and server source: desktop/ (desktop entry), webserver/, cmd/, internal/, frontend/, build/
npm/ The uiautodev npm package that downloads and runs the server binary, i.e. npx uiautodev run
images/ Documentation images
docs/ Documentation assets, update notes and design documents

Pushing an x.y.z tag builds and publishes the desktop app and server via .github/workflows/release.yml; the npm package keeps its own version (independent of app tags) and is released by .github/workflows/npm-release.yml when npm/ changes.

Device helper binaries

The desktop app ships the adb, ios and hdc helpers (under Contents/MacOS/ on macOS and in the tools/ directory on Windows), so no extra download is needed there. The macOS hdc is merged into a universal binary during packaging.

The server (uiautodev-server and the npm package) does not embed them. The first time a platform feature is used, the matching archive is downloaded from https://dl.uiauto.dev/binaries/<helper>/<version>/<helper>-<platform>.zip, unpacked and cached:

Helper Archives
adb adb/36.0.2/adb-darwin.zip, adb/36.0.2/adb-windows-amd64.zip
ios ios/2025.10.20/ios-darwin.zip, ios/2025.10.20/ios-windows-amd64.zip
hdc hdc/3.1.0b/hdc-darwin-arm64.zip, hdc/3.1.0b/hdc-darwin-amd64.zip, hdc/3.1.0b/hdc-windows-amd64.zip

The cache lives in ~/Library/Application Support/uiautodev/<helper>/<version>/ (%LOCALAPPDATA%\uiautodev\<helper>\<version> on Windows); the version makes installed clients pick up refreshed archives, and older version directories are removed once the current one resolves. A helper already present on the system PATH takes precedence. Linux servers still need to install adb themselves.

Each archive's sha256 is pinned in code (*ArchiveSHA256 in webserver/device/{adb,ios,hdc}_binary.go); a mismatch is never unpacked or executed, and both per-file and total unpacked size are capped so a corrupt or hostile archive cannot fill the disk. Downloads time out after two minutes; on failure the helper falls back to PATH and the download is retried after five minutes without restarting the server.

iOS simulators

Booted iOS simulators on macOS appear in the device list next to physical devices, with the same i-<UDID> device ID. Simulators are driven by the prebuilt devicekit-ios XCUITest runner, so no WebDriverAgent, Xcode build or code signing is involved.

  • Start the simulator with Device Hub or xcrun simctl boot <UDID>; only booted simulators are listed.
  • The first interaction downloads the pinned runner from GitHub Releases (about 10 MB, FSL-1.1, fetched at runtime and not bundled with the installer), installs it and caches it under ~/Library/Application Support/uiautodev/devicekit-ios/sim/. The download goes through the gh-proxy.com mirror first, then other public mirrors, and only then github.com directly; the archive is checked against the pinned per-architecture size and SHA-256, and a mismatch is discarded in favour of the next source. The background WDA watcher never downloads the runner for a simulator; that only happens on real interaction. Offline, simulators can be listed but not controlled.
  • With several booted simulators the ports are allocated automatically from 8100 in UDID order and stay fixed for the life of the process. Set the WDA port in the device settings to override it. A simulator serves JSON-RPC and MJPEG on that one port, so the MJPEG port setting does not apply to simulators.
  • Physical devices still use WebDriverAgent (the ios helper); the simulator path does not change it.

uiautodev-server command line flags

Flag Default Description
-addr :33299 HTTP listen address (all interfaces by default)
-open Open the home page in a browser after the server starts (when -addr is of the form :port, opens http://localhost:port/)
-auth <user:pass> Basic auth credentials (can be specified multiple times)
-proxy-log <file> Proxy log path (no logging when empty)
-config-dir <dir> ~/.config/uiautodev Config directory holding config.json and the default plugin directory <config-dir>/plugins; use it to isolate state when running several servers
-plugin-dir <dir> <config-dir>/plugins Directory where user plugins are installed and loaded (highest priority; a plugin with the same name overrides older/bundled ones)
-tls-addr <addr> HTTPS listen address (an HTTP redirect listener is started on -addr at the same time)
-tls-cert <file> TLS certificate file (PEM)
-tls-key <file> TLS private key file (PEM)
-ngrok Expose the server publicly through ngrok
-ngrok-authtoken <token> ngrok authtoken (can also be set with the NGROK_AUTHTOKEN environment variable)
-master-url <url> HTTP(S) address of the upstream master, e.g. https://master.example.com; when set, this node joins it as a slave but is still a master itself. Only the origin is needed, the path is filled in automatically
-token <token> Slave token generated by the master; can also be set with the UIAUTODEV_CLUSTER_TOKEN environment variable
-name <name> machine hostname Display name of the slave (optional)
-master-insecure Skip master certificate verification (when the master uses a self-signed certificate)
-disable-device-listing Disable the device listing API (security hardening)
-whitelist-file <file> Device whitelist file, one ID per line (# comments and blank lines ignored); empty means all devices
-blacklist-file <file> Device blacklist file, one ID per line; a blacklisted device is invisible to the list, details, operations, MCP and cluster aggregation
-verbose Enable debug logging
-version Print the version and exit
# Start the server and open the browser
uiautodev-server -open

# Use a specific port
uiautodev-server -addr :8080 -open

Device access lists

-whitelist-file and -blacklist-file point at plain text files with one full device ID per line (e.g. a-SERIAL, i-UDID). # starts a comment and blank lines are ignored. The files are read once at startup, so a change requires a restart; a missing or unreadable file makes the server exit instead of silently running without the restriction.

  • An empty whitelist means no restriction; an empty blacklist hides nothing.
  • IDs are matched exactly and the blacklist wins over the whitelist.
  • The lists cover the device list, device details, operations, screenshots and screen streams, /proxy/devices/..., the MCP tools and the cluster snapshot; a hidden device returns 403.
  • A slave with a list only reports the permitted devices to its master. On a master, filter remote devices with their global ID r-<slave>-<local>.
# whitelist.txt
a-1234567890        # Pixel 8
i-00008101-000A1B2C # iPhone

Cluster mode

Every node is a master by default and aggregates devices from its slaves; a node can also join an upstream master as a slave, using the classic tunnel, direct connection or remote adb connect.

See docs/cluster.en.md for flags, cascading, ADB relay and deployment notes.

Multi-user access and device presence

When several people share one server, uiautodev can reuse the identity provided by oauth2-proxy / nginx auth_request, show who is controlling or observing each device, and support takeover, read-only observing and idle release.

  • Identity: trusted proxy headers > built-in login > anonymous (per browser session)
  • Occupancy is renewed by activity and released after the idle timeout; takeover permission is No takeover, Admin only, or Allow everyone
  • Observers can watch the screen, take screenshots and read the UI tree, but cannot control the device
  • Configure it under Settings → Access & Presence, or edit config.json directly
  • For CI that needs a stable adb endpoint: PUT .../presence to claim the device (optionally with a ttl lease, capped at 24h, that survives the idle timeout), GET .../connect for the address (unchanged while occupied), renew it more often than idle_timeout, then DELETE .../presence to release. See Using a device from CI for the full script

The desktop app is a single-user client and always runs without device presence; its settings page hides the presence options. The feature only applies to a standalone server. See docs/access-and-presence.md for the full reference (configuration, permission matrix, oauth2-proxy example).

Embedding a device view

A device screen can be embedded into another page with an iframe at /device/<device ID>/embed:

<iframe
  src="https://uiautodev.example.com/device/a-1234567890/embed?mode=readonly"
  style="width: 360px; height: 640px; border: 0">
</iframe>

The device ID is the full ID shown in the device list (a- Android, i- iOS, h- HarmonyOS, d- demo). The embedded page has no navigation bar or footer and fits the iframe size.

Parameter Default Description
mode readonly readonly only streams the screen; control lets visitors operate the device inside the iframe
  • mode=readonly holds a read-only session for the device, renewed by a heartbeat and released when the page is closed.
  • Read-only is also enforced by the server: input events sent over scrcpy / frames are dropped for observers.
  • A read-only embed never shows "take over" / "request control" buttons; use the full device page to gain control.
  • When someone else controls the device and observers are not allowed, the embed shows "device is in use" with the current occupant.
  • presence.allow_observers=false makes read-only embeds unavailable for every device (idle ones too) and the page says observing is unavailable.

API tokens and MCP authentication

A token represents one user identity and can call MCP and other APIs.

  • Create tokens on the "Tokens" settings tab: give each a name and an admin / user role, and delete them when no longer needed. The server generates the value (ua- prefix) and the list lets you copy it.
  • Call the API with Authorization: Bearer <token>; MCP clients may also append ?token=<token> to a /mcp/* URL (the query form is not accepted by other APIs).
  • The takeover permission decides who may take over: none (No takeover) lets nobody take over; admin (Admin only) lets only admin tokens take over; all (Allow everyone) lets every identity take over, including user tokens, browser users, trusted-proxy identities and anonymous callers. A busy device can still be observed read-only when allow_observers=true.
  • Without a token: once any API token is configured, MCP requests need a login identity (-auth JWT / Basic or a trusted proxy) and otherwise return 401 (/mcp/tools stays public); with no tokens configured, -auth keeps using login auth, otherwise the API and MCP stay open.
  • A legacy mcp_token in config.json is migrated at startup into an admin token named MCP, and the old field is cleared.
  • Tokens are stored in plain text under api_tokens in config.json. Removing the last admin token leaves nobody able to take over under the admin-only permission, while the allow-everyone permission still lets every identity take over. Changes take effect immediately, no restart needed.

MCP requests authenticated with a token act as token:<id> with the token name as the display name and follow the same occupancy, takeover and idle rules as the Web UI. Use acquire_device / release_device to claim and release devices; other device tools acquire a session automatically. See docs/access-and-presence.md.

Sponsor

If this project helps you, you are welcome to buy me a coffee ☕

Development

See DEVELOP.md for building, debugging, packaging, signing and release (in Chinese).

LICENSE

This project is licensed under the MIT License.

Explore related projects

Loading…