// mcp
MCP & Claude Code
Keynobi exposes an MCP server so Claude Code (and other stdio MCP clients) can trigger builds, read logcat, inspect UI, run guarded UI automation, and manage devices using the same state as the GUI. Transport is local stdio to the Keynobi binary—not a Keynobi-hosted proxy.
Setup (headless, recommended)
Register the app once with the exact path to your installed binary. Prefer the command from Health Center or Copy MCP Setup Command in the command palette.
claude mcp add --transport stdio keynobi -- "/Applications/Keynobi.app/Contents/MacOS/keynobi" --mcp
The server uses whichever project is currently open in Keynobi. To pin a folder regardless of the GUI selection, append --project /path/to/MyAndroidProject.
GUI mode: open Keynobi, load a project, press Cmd+Shift+M for the MCP panel, and use the same copy command if needed.
Status indicator
The status bar MCP pill reflects server/client state: idle, server alive (stdio), in progress, or client connected (e.g. Claude). Click it for the activity panel.
Built-in prompts
diagnose-crash— Crash logs, memory, and app info for root-cause analysisfull-deploy— Build, find APK, install, and launch in one workflowbuild-and-fix— Run build and explain each error with suggested fixes
Resources
Readable project files exposed to the client:
android://health— System health summaryandroid://manifest— AndroidManifest.xmlandroid://app-build-gradle— app/build.gradle.ktsandroid://build-gradle— root build.gradle.ktsandroid://gradle-settings— settings.gradle.ktsandroid://project-info— Project name and path
Workflow example
- Ask Claude Code to build and list errors.
- It calls
get_project_info, thenrun_gradle_task, thenget_build_errors. - For deploy:
list_devices,install_apk,launch_app. - For UI automation:
find_ui_elementsorlist_clickable_elements, thenui_tap_elementon returned tree paths; usescreenHash/expect_screen_hashto avoid stale screens.
Safety model
MCP tools validate external input before acting: Gradle tasks, package names, device serials, APK paths, deep links, runtime permissions, UI key names, coordinates, and tree paths are checked. File paths are limited to the effective project root or, for APK installs, the project build output directory.
Tools reference
| Tool | Description |
|---|---|
| run_gradle_task | Run a Gradle task (e.g. assembleDebug); returns result + structured errors |
| get_build_status | Current build status (idle, running, success, failed, cancelled) |
| get_build_errors | Structured compiler errors and warnings from the last build (JSON) |
| get_build_log | Raw Gradle output lines (last N lines, capped) |
| cancel_build | Cancel the running Gradle build |
| list_build_variants | List variants and active variant (JSON) |
| set_active_variant | Set the active build variant (persists in settings) |
| find_apk_path | Output APK path for a variant after a build |
| get_build_config | Parse build.gradle(.kts) for SDK levels, applicationId, types, flavors (no Gradle run) |
| run_tests | Run unit tests (testDebug), connected tests, or a custom test task |
| get_crash_stack_trace | Parsed crash from logcat buffer; needs logcat streaming |
| restart_app | Force-stop or clear data, relaunch, wait for display |
| get_app_runtime_state | Processes, threads, RSS for an app package |
| start_logcat | Start logcat streaming (required in headless before reads) |
| stop_logcat | Stop the logcat stream |
| get_logcat_entries | Recent logcat entries with filters (JSON) |
| get_crash_logs | FATAL EXCEPTION, ANR, and native crash entries (JSON) |
| clear_logcat | Clear the in-memory logcat buffer |
| get_logcat_stats | Logcat statistics (counts by level, crashes, packages) |
| list_devices | Connected ADB devices (JSON) |
| get_ui_hierarchy | Focused window UI tree from UI Automator (JSON; interactive_only option) |
| find_ui_elements | Fresh dump + search by text, content-desc, resource-id, class, or package |
| list_clickable_elements | Fresh dump + list actionable UI elements with tree paths and centers |
| find_ui_parent | Direct parent of a node from find_ui_elements / Layout tab treePath |
| ui_tap | Tap device pixel coordinates; optional expect_screen_hash |
| ui_tap_element | Tap an element by treePath with optional screen-hash verification |
| ui_type_text | adb shell input text (ASCII-oriented); optional screen hash |
| ui_fill_input | Focus, clear, and type into an input by treePath or coordinates |
| clear_focused_input | Clear the currently focused input field |
| ui_type_text_unicode | Send Unicode text through the device input path when plain adb text is not enough |
| hide_soft_keyboard | Hide the Android soft keyboard |
| ui_swipe | Swipe or long-press in device pixels |
| ui_scroll_until_element | Scroll until a matching element appears, returning the last screen hash on failure |
| send_ui_key | Allowlisted keyevent (Back, Home, Enter, …) |
| wait_for_element | Wait for a UI element matching text, content-desc, resource-id, class, or package filters |
| ui_wait_for_idle | Wait until the UI appears stable before the next automation step |
| ui_assert_element | Assert that a matching element is present for test-style checks |
| open_deep_link | Open a deep link, optionally scoped to an app package |
| open_app_settings | Open Android app info, permissions, or notifications settings |
| set_device_orientation | Change device orientation for automation flows |
| set_network_state | Toggle supported Wi-Fi/mobile data states for test flows |
| compare_ui_state | Compare captured UI state to detect screen changes |
| grant_runtime_permission | pm grant for android.permission.* on a package |
| revoke_runtime_permission | pm revoke for android.permission.* on a package |
| screenshot | Capture a screenshot (inline image) |
| get_device_info | SDK level, model, screen, battery |
| dump_app_info | App version, install path, activities |
| get_memory_info | Memory breakdown (PSS, heap, native, graphics) |
| install_apk | Install an APK (path-validated) |
| launch_app | Launch an app (am start) |
| stop_app | Force-stop an app |
| list_avds | List AVDs (JSON) |
| launch_avd | Start an emulator |
| stop_avd | Stop a running emulator |
| get_project_info | Project name, path, Gradle root |
| run_health_check | Java, SDK, ADB, Gradle wrapper, disk, app dir (JSON) |