Karagöz

v0.5.1
io.github.yagizdo/karagoz-mcp Checked 8 hours ago Published 9 days ago

Device automation for Android emulators and phones, iOS simulators and iPhones.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

devices List devices

List Android devices and emulators, running iOS simulators, and iPhones connected to this Mac.

screenshot Take a screenshot

Save a full-resolution PNG of the screen and return its path with size, scale and safe area. Use ui_tree to read the screen; inline only to look at the image.

ParameterTypeDescription
devicestringId or name.
inlinebooleanAlso return the image. Take coordinates from ui_tree, not from the image.
outstringAbsolute PNG path, ending in .png. Default: a new temp file.

ui_tree Read the UI tree

Return the focused window's accessibility tree as JSON, compact by default: nodes with no text, label or action and nodes off screen are left out. Node bounds [left, top, right, bottom] are the physical pixels tap and swipe take. On an iPhone it needs karagoz's runner: install it once with install_runner.

ParameterTypeDescription
detailstringfull: every node.
devicestringId or name.

tap Tap

Tap x, y in physical pixels, or the center of the node whose text or contentDesc (iOS: label or value) equals text, or whose resource id (iOS: identifier) matches id. An iPhone needs install_runner once.

ParameterTypeDescription
devicestringId or name.
idstringResource id, full or the part after :id/ (iOS: identifier).
textstringExact text or contentDesc (iOS: label or value), case-sensitive.
timeoutintegerWith text or id: ms to keep reading the tree until the node appears; the call can run up to 6 s longer.
treebooleanAlso return the screen once it settles, as ui_tree does. treeError means only that read failed; the action ran.
xnumber
ynumber

long_press Long-press

Long-press x, y in physical pixels, or the center of the node whose text or contentDesc (iOS: label or value) equals text, or whose resource id (iOS: identifier) matches id. An iPhone needs install_runner once.

ParameterTypeDescription
devicestringId or name.
durationintegerHold time in ms. Default 1000.
idstringResource id, full or the part after :id/ (iOS: identifier).
textstringExact text or contentDesc (iOS: label or value), case-sensitive.
timeoutintegerWith text or id: ms to keep reading the tree until the node appears; the call can run up to 6 s longer.
treebooleanAlso return the screen once it settles, as ui_tree does. treeError means only that read failed; the action ran.
xnumber
ynumber

double_tap Double-tap

Double-tap x, y in physical pixels, or the center of the node whose text or contentDesc (iOS: label or value) equals text, or whose resource id (iOS: identifier) matches id. An iPhone needs install_runner once.

ParameterTypeDescription
devicestringId or name.
idstringResource id, full or the part after :id/ (iOS: identifier).
textstringExact text or contentDesc (iOS: label or value), case-sensitive.
timeoutintegerWith text or id: ms to keep reading the tree until the node appears; the call can run up to 6 s longer.
treebooleanAlso return the screen once it settles, as ui_tree does. treeError means only that read failed; the action ran.
xnumber
ynumber

swipe Swipe

Swipe from x1, y1 to x2, y2 in physical pixels. An iPhone needs install_runner once.

ParameterTypeDescription
x1 *number
x2 *number
y1 *number
y2 *number
devicestringId or name.
durationintegerms from start to end. Default 300.
treebooleanAlso return the screen once it settles, as ui_tree does. treeError means only that read failed; the action ran.

text Type text

Type into the focused field. Any text; on Android, text beyond ASCII is pasted through the clipboard and the old clip put back. An iPhone needs install_runner once.

ParameterTypeDescription
text *string
devicestringId or name.
treebooleanAlso return the screen once it settles, as ui_tree does. treeError means only that read failed; the action ran.

key Press a key

Press one key.

ParameterTypeDescription
key *stringKeyEvent name (HOME, BACK, KEYCODE_7) or code 1-340; "7" is code 7 (KEYCODE_0), not the digit. iOS takes HOME, POWER, VOLUME_UP/DOWN and keyboard keys; an iPhone only keys that type a character, and n…
devicestringId or name.
treebooleanAlso return the screen once it settles, as ui_tree does. treeError means only that read failed; the action ran.

install Install an app

Install an .apk, or a .app or .ipa on an iOS simulator or iPhone, or replace the installed version of the same app. An iPhone takes only a build signed for it; karagoz does not re-sign. Times out after 30 s plus 1 s per MB.

ParameterTypeDescription
apk *stringAbsolute path to the .apk, .app or .ipa.
devicestringId or name.

launch Launch an app

Start an app as its launcher icon does. On iOS it returns before the app is in front.

ParameterTypeDescription
package *string
devicestringId or name.

open_url Open a URL

Open a URL in the app that handles it, or in the app named by app. On iOS it returns before the app is in front, and a simulator may first ask "Open in <app>?".

ParameterTypeDescription
url *string
appstringPackage name or bundle id; not on an iOS simulator.
devicestringId or name.

terminate Stop an app

Force-stop every process of an app.

ParameterTypeDescription
package *string
devicestringId or name.

uninstall Uninstall an app

Remove an app.

ParameterTypeDescription
package *string
devicestringId or name.

logs Read device logs

Read the newest device log records, oldest first. On iOS without since: the last minute, or the last hour with package. An iPhone read takes about 10 s.

ParameterTypeDescription
devicestringId or name.
linesintegerNumber of newest records. Default 30.
packagestringOnly this app's records.
sincenumberUnix seconds on the device clock; only later records. Pass a record's time to continue.

doctor Check adb and Xcode

Report which adb and Xcode tools karagoz uses, their versions, and how to fix one that is missing, old or broken.

install_runner Install karagoz's iPhone runner

Build karagoz's runner with your Apple team and install it on a paired iPhone over USB; ui_tree, tap, swipe, text and key need it there.

ParameterTypeDescription
devicestringId or name.
teamstringApple team ID; needed only when Xcode lists several.

uninstall_runner Remove karagoz's iPhone runner

Remove karagoz's runner and its provisioning profile from an iPhone.

ParameterTypeDescription
devicestringId or name.