Skip to content
karagöz
Star4npm0.5.1

Drive Android and iOS devices from your AI agent.

Karagöz is a CLI and an MCP server for Android emulators and phones, iOS simulators and iPhones. Your agent reads the screen as text, taps by label, and gets one line of JSON back for every command.

Use the CLI from a shell, or connect your AI agent over MCP.

CLI

Install the CLI with npm, then list your devices. Or without installing: npx -y karagoz-mcp devices

npm install -g karagoz-mcp
karagoz devices

Claude Code

Run this in a terminal.

Tested with Claude Code.

claude mcp add karagoz -- npx -y karagoz-mcp mcp

Codex

Run this in a terminal. Then add env_vars and tool_timeout_sec under [mcp_servers.karagoz] in ~/.codex/config.toml, as the MCP server page shows.

Tested with Codex.

codex mcp add karagoz -- npx -y karagoz-mcp mcp

Cursor

Add to CursorAdd to Cursor

The button needs Cursor 3.15.12 or newer. Or add this to .cursor/mcp.json in your project, or to ~/.cursor/mcp.json.

Tested with Cursor.

{
"mcpServers": {
"karagoz": {
"type": "stdio",
"command": "npx",
"args": ["-y", "karagoz-mcp", "mcp"]
}
}
}

VS Code

Run this in a terminal, or add the server to .vscode/mcp.json in the workspace.

Follows VS Code's documentation; not run.

code --add-mcp '{"name":"karagoz","command":"npx","args":["-y","karagoz-mcp","mcp"]}'

Claude Desktop

Download karagoz.mcpb

Open it, and Desktop asks to install the extension. It does not update the extension: install the new file after each release.

Tested with Claude Desktop.

Or add this to ~/Library/Application Support/Claude/claude_desktop_config.json, set ANDROID_HOME to your Android SDK, then quit and restart Desktop.

Follows Claude Desktop's documentation; not run.

{
"mcpServers": {
"karagoz": {
"command": "npx",
"args": ["-y", "karagoz-mcp", "mcp"],
"env": { "ANDROID_HOME": "/Users/me/Library/Android/sdk" }
}
}
}

Needs Node 22 or newer, plus adb for Android or Xcode on a Mac for iOS.

From the screen to a tap

ui-tree prints what is on the screen as text: each element with its box in screen pixels. tap --text finds the element by its label and taps the center of that box.

Android emulator

emulator-55541080 × 2400

ui-treeFinds the Chrome element and its box, [left, top, right, bottom].
…{"class":"TextView","text":"Chrome",…,"bounds":[581,1905,754,2100]}…
exit 0
tap --text ChromeTaps the center of that box.
{"device":"emulator-5554","x":667.5,"y":2002.5,"element":{…}}
exit 0
tap --text SaveNothing on the screen says Save: ELEMENT_NOT_FOUND, exit 1.
{"error":{"code":"ELEMENT_NOT_FOUND",…}}
exit 1

Center of the bounds: x = (581 + 754) / 2 = 667.5 y = (1905 + 2100) / 2 = 2002.5

iOS simulator

27024DC1-…1206 × 2622

tap resultThe same tap on an iOS simulator: the button's center and box.
{"device":"27024DC1-EDB0-4BF2-8010-08FE3936BAB6","x":603,"y":1015,"element":{"role":"Button","label":"Tap me 0","identifier":"tap-button","bounds":[48,937,1158,1093]}}
exit 0

Center of the bounds: x = (48 + 1158) / 2 = 603 y = (937 + 1093) / 2 = 1015

adb, simctl and devicectl run the command; Karagöz tells you what it actually did.

Karagöz runs them for you and checks first.

  • With adb, simctl and devicectl: Different tools and commands for Android and iOS.

    With Karagöz: One tool and the same commands on all four targets.

  • With adb, simctl and devicectl: am force-stop on an app that is not installed says nothing.

    With Karagöz: APP_NOT_FOUND

  • With adb, simctl and devicectl: simctl and devicectl report success for removing an app that is not there.

    With Karagöz: APP_NOT_FOUND

  • With adb, simctl and devicectl: adb reports a failed install inside a line of text.

    With Karagöz: INSTALL_FAILED, with the platform's own code in reason.

  • With adb, simctl and devicectl: adb takes a serial, simctl a UDID.

    With Karagöz: Either one, or the device's name. Never a guess between two.

Four targets, and what each one needs

Early development. Every command runs on all four targets, except install-runner (iPhones only) and uninstall-runner (iPhones, and simulators of a Mac that never had Xcode 27). No device command has been run on Windows or Linux yet.

  • Android emulator

    • adb from Android platform-tools, and a running emulator.
  • Android device

    • adb from Android platform-tools, and a phone with USB debugging on.
  • iOS simulator

    • macOS and Xcode, opened once, and a booted simulator.
    • tap, long-press, double-tap, swipe, text and key need Xcode 27 or newer, or a Mac that never had Xcode 27, where they go through Karagöz's runner.
  • iOS device

    • macOS, Xcode 15 or newer (27 for screenshot), and the iPhone paired with the Mac.
    • screenshot, install, launch, open-url, terminate and uninstall need Developer Mode on.
    • logs needs a USB cable.
    • ui-tree, tap, long-press, double-tap, swipe, text and key need both, plus UI Automation on and Karagöz's runner, which install-runner installs.

Full requirements, and how to check your setup

What your agent gets over MCP

Your agent's app starts karagoz mcp itself and talks to it over stdio; it opens no port. The 18 commands are its tools, and each returns the JSON line the CLI prints.

Same output
Your agent calls the devices tool and gets the CLI's JSON line:{"devices":[{"id":"emulator-5554","platform":"android","kind":"emulator","state":"device","name":"Medium_Phone_API_37.0","os":"17","api":37}]}
Approval
install, uninstall and uninstall_runner are marked destructive, so your client can ask you first.
Installs
Karagöz installs nothing on a device by itself. One exception: on a Mac that never had Xcode 27, the first tap, long-press, double-tap, swipe, text or key on a simulator installs its runner there.
Token cost
In Claude Code, with tool search on (the default), the server adds 386 tokens to a session. Token cost

Install the CLI

The agent setups above run the published package with npx. To run karagoz from a shell, install it with npm, then list your devices.

npm install -g karagoz-mcp
karagoz devices

Or without installing: npx -y karagoz-mcp devices

18 commands

Each command does one thing and exits.

See the screen

screenshot
Save a full-size screenshot
ui-tree
Read what is on the screen

Touch and type

tap
Tap a button or a point
long-press
Press and hold a button or a point
double-tap
Tap a button or a point twice
swipe
Swipe between two points
text
Type text into the focused field
key
Press a key

Apps

install
Install or update an app
launch
Open an app
open-url
Open a link in the app that handles it
terminate
Close an app completely
uninstall
Remove an app

Device and setup

devices
List connected devices
logs
Read the device log. Pass the largest time of one result as the next --since to get only newer records.
doctor
Check that adb and Xcode are set up
install-runner
Put Karagöz's runner on an iPhone to read and tap its screen
uninstall-runner
Remove Karagöz's runner from an iPhone or a simulator

karagöz

kara
black
göz
eye

Named after a shadow play

Karagöz is the Turkish shadow theatre, named after its hero, Karagöz, who trades jokes with Hacivat. The figures are cut from hide, painted, and moved with rods behind a lit cloth screen. The puppeteer works behind the screen, and the audience watches the figures' colored shadows on it.

UNESCO added it to its list of intangible cultural heritage in 2009.

In the theatreIn Karagöz
The puppeteerYou, or your AI agent
The rodsCommands like tap and swipe
The lit screenThe device screen
The audienceEveryone watching the app move

This tool works the same way, from behind the device screen.

Karagöz is free and open source. If it saves you time, you can buy the puppeteer a coffee.

Buy me a coffee