Logotipo de Ghost in the Droid

Ghost in the Droid

Organización
ghost-in-the-droid

Open-source framework to drive a real phone with AI agents: Android over ADB, iPhone over WebDriverAgent, 62 MCP tools, Python skills, a Vue dashboard, and swappable local or cloud LLMs

Editorghost-in-the-droid
Repositorioandroid-agent
IdiomaPython
Forks
37
Estrellas
361
Herramientas disponibles
0
Tipo de transportestdio
Categorías
LicenciaMIT
Enlaces
  • Conecta herramientas a flujos de trabajo con IA

    Ghost in the Droid ofrece funciones MCP que pueden usar los clientes y agentes de IA compatibles.

  • 0 herramientas disponibles

    Explora a continuación las acciones que se pueden invocar, con sus nombres y descripciones cuando el servidor los proporcione.

  • Configuración lista para copiar

    Usa los ejemplos de instalación para configurar este servidor en tu cliente MCP preferido.

  • Indicadores de interés en el código abierto

    361 estrellas y 37 forks en el repositorio enlazado.



The pitch, in one breath

Every AI agent can think. Almost none can touch a phone.

Ghost is the body. It gives any LLM agent a real Android phone or iPhone: it reads the screen, taps, swipes, and types through a clean tool surface, and it scales from one device on your desk to a whole phone farm. Point Claude Code, Codex, Antigravity, Cursor, your LangChain app, or a model running inside the phone itself at it, and your agent grows hands.

Bring your own brain. Keep the same body. MIT, forever.


Mix and match: the Ghost matrix

Ghost 1.3 is the only Android + iOS agent framework where platform, brain, and driver are all swappable. Pick one from each column. They all compose.

Pick a platformPick a brainPick a driver
Android over USB ADBClaude Code (free with your Max/Pro sub)MCP client (Claude Code, Codex, Antigravity, Cursor, Opencode)
Android over Wi-Fi ADBAnthropic APILangChain toolkit
Android in a Docker + KVM emulator poolOpenRouter (any model, one key)LlamaIndex tool spec
iPhone over Appium + WebDriverAgentOllama (fully local)Ghost CLI (ghost "book a table" --device pixel)
iPhone over Tailscale + WebDriverAgent (wireless)vLLM (your own GPU)Web dashboard chat with a live phone stream
On-device — llama.cpp (.gguf, any quant), MediaPipe (.task, Gemma mobile bundles), MLX (Apple Silicon, opt-in). The model runs in the phone, airplane-mode worksREST API (/docs OpenAPI)

The Docker + KVM emulator pool is Android-only; iOS uses Apple's own simulator and Xcode signing, which are macOS-native.

The body stays the same 62 MCP tools no matter what you plug in. Every new model release is a free upgrade to your phone agent.


See it in action

Nine demos, one per feature, each recorded on real devices. Click any clip for the full mp4.


What It Does

Open-source Python framework for controlling Android and iOS devices from one agent harness. Android runs through ADB. iOS runs through Appium XCUITest and WebDriverAgent, with real iPhones as the target path and simulators for development and CI.

Define skills for any app, run them from the dashboard or API, scale across a phone farm.

The ghost taps what you'd tap

  • Android control through ADB: tap, swipe, type, clipboard, shell, intents, and stealth variants
  • iOS control through WebDriverAgent: screenshot, accessibility tree, tap, swipe, type, app launch, clipboard, browser actions
  • Live phone screen streaming: Android MJPEG/WebRTC, iOS WDA MJPEG with screenshot fallback
  • Interactive touch-to-tap on the streamed screen
  • Multi-device phone farm with per-device job queues

Forge reusable skills for any app

  • YAML-based UI element definitions per app
  • Platform-specific selectors with elements.yaml for Android and elements_ios.yaml for iOS
  • Python action classes with precondition checks
  • Multi-step workflows that chain actions together
  • Built-in skills for TikTok and Play Store
  • iOS browser/news demo skill and smoke-level TikTok iOS workflows
  • Skill Hub: browse, search, and install skills from the community registry
  • Install from CLI: android-agent skill install tiktok

Teach the ghost new tricks

  • BFS-based auto app explorer: discovers every screen and transition
  • LLM-assisted Skill Creator: chat with AI while viewing the live device stream
  • The AI identifies UI elements and generates action/workflow code

Scale the haunting

  • Multi-device phone farm with per-device job queues
  • Bot runner: queue, schedule, and monitor automation jobs
  • Per-device integration tests with Android screen recording or iOS WDA MJPEG recording

Platform Support

SurfaceAndroidiOS
Device refADB serial, e.g. emulator-5554ios:<udid>
BackendADB + optional Portal companion appAppium XCUITest + WebDriverAgent
Real device supportYesYes, with Mac/Xcode/WDA signing
Simulator/emulator supportAndroid emulator toolingBooted iOS simulators via Appium/WDA
Live streamPortal WebRTC, MJPEG, screencapWDA MJPEG, screenshot polling fallback
Screen treeAndroid UIAutomator XMLNormalized XCTest accessibility tree
Skillselements.yaml, Android packageselements_ios.yaml, iOS bundle IDs
Android-only todayADB shell, intents, wireless ADB, Play Store helpers, Portal overlayUnsupported with stable platform errors

Why it is built this way

Skills cost $0. Thinking costs tokens. An agent should not pay an LLM to tap a button it has tapped a thousand times. Known workflows compile to skills: deterministic YAML + Python recipes that replay in seconds with zero LLM calls. Use AI for the unknown task, replay for the known one.

The phone is the easiest sandbox there is. Give the ghost an old Android with its own SIM and its own accounts, physically separate from your life. You already know how to set up a phone.

Zero-app by default. A fresh install touches nothing on the Android device: screen reads go through uiautomator, actions through adb shell input, no root, no accessibility service. Want it faster? The optional Portal companion app gives roughly 30x quicker UI reads. Want it private? On-device mode runs the whole loop inside the phone, nothing leaves it. All opt-in.

Local-first, cloud-optional. The server and dashboard run on your machine. With a local or on-device brain, your screenshots never leave your network. Pick a cloud brain and prompts go to that provider, same as any tool. Your call, always.


Requirements

  • Python 3.10+
  • Android: Android phone with USB debugging enabled and ADB on PATH (adb devices should list your phone)
  • iOS: macOS with Xcode, Appium 2 + XCUITest driver, and a trusted iPhone or booted simulator
  • Node.js 18+ (for the frontend dev server)

iOS Support

Ghost drives iPhones through Appium/WebDriverAgent with the same tool surface: ios:<udid> device refs route tap/swipe/type/screenshot to WDA, and iOS-aware browser primitives (open_url, read_news, extract_visible_text) cover web tasks. Android-only tools (shell, launch_intent, Portal overlay) return a clear platform error instead of failing silently.

iOS is opt-in: enable it with GITD_ENABLE_IOS=1 (or ios_platform_enabled=true in .env). Wireless drive rides your Tailscale tailnet, so treat the tailnet as the trust boundary. See docs/SETUP_IOS.md for Appium/WDA setup, and on-device on iPhone to run the model on the iPhone itself.


Quick Start

Zero-install with uvx (or pipx):

bash
uvx ghost-in-the-droid doctor   # green/red preflight: python, adb on PATH, devices, ports, LLM keys
uvx ghost-in-the-droid login    # sign in with your Claude subscription, no API key needed
uvx ghost-in-the-droid up       # server + dashboard at http://localhost:5055  (API docs at /docs)

doctor prints a checklist with fix hints instead of a stack trace when something is missing (e.g. adb not on PATH). Prefer pipx? pipx install ghost-in-the-droid gives you the ghost-in-the-droid / android-agent commands.

Sign in with your Claude subscription (no API key)

If you have a Claude Max/Pro subscription, you don't need an API key. android-agent login signs you in through the claude CLI's own Anthropic OAuth flow and points Ghost at the claude-code provider:

bash
android-agent login       # opens Anthropic sign-in via the claude CLI

Ghost never handles or stores your token; the claude CLI owns it, refresh included. doctor shows a green Claude subscription check once you are signed in. To use an API key instead, set ANTHROPIC_API_KEY (or OPENAI_API_KEY / OPENROUTER_API_KEY) and pick that provider.

Select Ollama in the Phone Agent tab. Runs entirely on your machine with Ollama:

bash
brew install ollama       # or: curl -fsSL https://ollama.com/install.sh | sh
ollama serve &
ollama pull llama3.2:3b   # 2GB, fast, good tool-use
bash
git clone https://github.com/ghost-in-the-droid/android-agent.git
cd android-agent
pip install -e ".[all]"

android-agent doctor        # preflight
android-agent up            # start server + dashboard on :5055

# Frontend (separate terminal)
cd frontend && npm install && npx vite --host 0.0.0.0 --port 6175
# Dashboard at http://localhost:6175

iOS Quick Start

iOS support requires a Mac because Appium uses Xcode's XCUITest/WebDriverAgent stack. Real iPhones also require trust, Developer Mode, UI Automation permission when prompted, and WDA signing with an Apple development team.

bash
# 1. Install and run Appium XCUITest
npm install -g appium
appium driver install xcuitest
appium --base-path /

# 2. Find your iPhone or booted simulator UDID
xcrun xctrace list devices
xcrun simctl list devices booted

# 3. Configure the backend for iOS
export IOS_DEVICE_UDID="<udid>"
export IOS_APPIUM_URL="http://127.0.0.1:4723"
export IOS_BUNDLE_ID="com.google.chrome.ios"       # or com.apple.mobilesafari
export IOS_MJPEG_SERVER_PORT="9100"                # use unique ports per iOS device

# 4. Run a product-path smoke workflow
uv run python scripts/ios_chrome_news_smoke.py \
  --device "ios:<udid>" \
  --bundle-id "$IOS_BUNDLE_ID" \
  --url https://text.npr.org/ \
  --max-headlines 5 \
  --max-articles 3 \
  --fix-health \
  --out-dir data/ios_chrome_news_smoke

For full real-device signing, simulator, WDA MJPEG, health recovery, scheduler, and MCP setup details, see docs/SETUP_IOS.md.

Environment Variables

Copy .env.example to .env (if provided) or create a .env file in the project root. The server reads configuration via Pydantic Settings. Optional variables include:

VariablePurpose
OPENAI_API_KEYLLM features (Skill Creator, Agent Chat)
ANTHROPIC_API_KEYAlternative LLM provider
OPENROUTER_API_KEYOpenRouter LLM provider
DEFAULT_DEVICEADB serial (auto-detected if empty)
IOS_DEVICE_UDIDiPhone or simulator UDID; devices are addressed as ios:<udid>
IOS_APPIUM_URLAppium server URL, default http://127.0.0.1:4723
IOS_BUNDLE_IDDefault iOS app/browser bundle, e.g. com.google.chrome.ios or com.apple.mobilesafari
IOS_DEVICES_JSONPer-device iOS config for multiple phones/simulators, WDA ports, bundle IDs, and MJPEG ports
IOS_MJPEG_SERVER_PORTWDA MJPEG stream port; use one unique port per iOS device

Give any AI agent a mobile body (MCP)

Ghost ships an MCP server with 62 tools for real-device control. Any MCP-compatible client can use them. Android serials receive the Android implementation; ios:<udid> refs route to the iOS backend where supported and return stable unsupported-platform errors for Android-only tools. One command wires it up:

bash
# Claude Code (same shape for Codex, Cursor, VS Code Copilot, Windsurf)
claude mcp add android-agent -- uvx --from ghost-in-the-droid android-agent-mcp

uvx installs the package, builds an isolated env, and runs the server. No clone, no venv.

bash
# Codex (OpenAI)
codex mcp add android-agent -- uvx --from ghost-in-the-droid android-agent-mcp

Claude Desktop (claude_desktop_config.json), Cursor (.cursor/mcp.json), Windsurf (mcp_config.json):

json
{
  "mcpServers": {
    "android-agent": {
      "command": "uvx",
      "args": ["--from", "ghost-in-the-droid", "android-agent-mcp"]
    }
  }
}

VS Code Copilot (.vscode/mcp.json) uses the same block under a "servers" key. Contributors who clone the repo get a ready .mcp.json, all 62 tools live on first claude launch.

The 62 tools, by category:

CategoryWhat the ghost can do
Seescreenshot, get_elements, get_screen_tree, get_screen_xml, screenshot_annotated, screenshot_cropped
Touchtap, tap_element, swipe, long_press, type_text, type_unicode, press_back, press_home, press_key
Appslaunch_app, search_apps, list_apps, launch_intent, force_stop, list_packages
Understandget_phone_state, classify_screen, find_on_screen, ocr_screen, ocr_region, extract_visible_text
Browser / iOSopen_url, browser_back, get_current_url, read_news, extract_articles, wait_for_text
Devicelist_devices, clipboard_get, clipboard_set, get_notifications, open_notifications, toggle_overlay, device_health
Skillslist_skills, run_workflow, run_action, create_skill, explore_app
Batchrun_flow / chain: one call runs a whole multi-step recipe server-side, N round-trips collapse to 1
Diagnosticslist_crashes, get_crash, web_search, screen recording, camera + TTS

toggle_overlay, launch_intent, Android shell helpers, wireless ADB, and Play Store helpers remain Android-only and return stable platform errors on iOS.


Run the brain inside the phone

New in 1.3: the model can live on the device. The Ghost companion app embeds real inference engines, so the phone is both the body and the brain. Airplane mode on, agent still working, nothing leaving the device.

PlatformEngineModel formatBest for
Androidllama.cpp (JNI).ggufAny GGUF: Gemma, Llama, Mistral, Qwen, DeepSeek
AndroidMediaPipe.taskSmall Gemma models, fastest Android integration
iPhonellama.cpp (Metal).ggufSame GGUF as Android, Qwen2.5 1.5B on Metal
iPhoneMLXApple SiliconFaster decode on newer chips, opt-in

On iPhone, Qwen2.5 1.5B runs through llama.cpp on Metal and drives the phone's own UI, with an opt-in MLX engine for faster decode on Apple Silicon. Small models are kept honest with grammar-constrained decoding so tool calls always parse. Full detail on the on-device LLM page.


Skill Hub CLI

bash
android-agent skill search tiktok        # search the public registry
android-agent skill install tiktok       # install a skill
android-agent skill install github.com/someone/their-skill
android-agent skill list                 # what is installed
android-agent skill update tiktok        # update a skill
android-agent skill validate ./my-skill/ # check before publishing

The skill registry lives in registry/ in this repo. Community skills are auto-discovered nightly from repos tagged android-agent-skill.

Teach the Ghost a New App

Two ways to forge a skill:

Community skill (your own repo): create a repo with skill.yaml, elements.yaml, actions, and workflows, tag it android-agent-skill, and it appears on the Skill Hub automatically (nightly scraper).

Official skill (PR to this repo): build and test as a community skill first, then open a PR adding it to registry/. CI validates, a maintainer reviews, and it gets the "Official" badge.

Each skill needs:

  • skill.yaml: metadata (name, version, app package or iOS bundle ID, supported platforms, actions, workflows)
  • elements.yaml: Android UI element resource IDs and descriptions
  • elements_ios.yaml: optional iOS selectors for XCTest accessibility trees
  • actions/: Python classes extending Action with precondition() and execute()
  • workflows/: Python classes extending Workflow with steps()

Prefer to let AI do it? The Skill Creator watches a live device stream and generates the action and workflow code while you narrate. Full guide in CONTRIBUTING.md.


The dashboard

A local-first control room at http://localhost:5055 (or :6175 in dev). WebRTC and MJPEG live streams, tap-on-screen, tracing, and every tab below.

TabWhat it does
Phone AgentLive device stream (MJPEG/WebRTC), tap/swipe on screen, multi-device view
SchedulerCron-style job scheduling with queue management
Skill HubBrowse installed skills, run actions and workflows, export/delete
Skill CreatorLLM-assisted skill builder with live device stream
Skill MinerAuto app explorer: BFS state discovery with screenshots
Manual RunStart/stop bot jobs, queue management, logs
TestsPer-device test runner with screen recording playback
EmulatorsCreate, boot, snapshot, and manage Android emulators
TracingPer-turn traces, token accounting, tool-call visibility

Architecture

android-agent/
  run.py                    # Uvicorn entry point on :5055
  gitd/
    app.py                  # FastAPI app factory + plugin hook
    models/  schemas/       # SQLAlchemy 2.0 ORM + Pydantic v2
    routers/  services/     # Route handlers + business logic
    skills/                 # Skill packages (tiktok, play_store, safari [iOS], tiktok_ios)
    bots/common/adb.py      # Android Device class: tap, swipe, dump tree, wait_for
    bots/common/ios.py      # iOS Device class: Appium/WDA session, UI tree, gestures
    mcp_server.py           # MCP server: 62 tools for any LLM agent
  frontend/                 # Vue 3 + Vite + TypeScript + Tailwind
  portal/                   # Kotlin companion app (WebRTC, on-device inference)
  site/                     # Docs site (Astro + Starlight)

The flow: FastAPI backend on :5055 exposes device control, skills, bots, scheduling, and streaming. The Vue SPA talks to it over /api/*. Skills define per-app interaction (elements + actions + workflows). Device backends route by ref: bare serials use bots/common/adb.py, ios:<udid> refs use bots/common/ios.py and Appium/WDA. State lives in SQLite via SQLAlchemy 2.0 and Alembic.

Benchmark (sneak peek)

Early result, with the full methodology writeup still cooking: driven by Claude Code, Ghost completes 115 of 116 tasks (99.1%) on AndroidWorld, Google Research's benchmark for Android agents, on the unmodified upstream harness. Treat this as a preview rather than a citable number. The detailed writeup and trajectories are coming. Watch the releases.


Tech Stack

LayerTechnology
BackendFastAPI, Uvicorn, Python 3.10+
DataSQLAlchemy 2.0, Alembic, Pydantic v2, SQLite (WAL)
FrontendVue 3, TypeScript, Vite, Tailwind CSS 4
Device controlADB for Android; Appium XCUITest/WebDriverAgent for iOS
StreamingAndroid MJPEG/WebRTC via Portal; iOS WDA MJPEG plus screenshot fallback
On-devicellama.cpp, MediaPipe (Android); llama.cpp on Metal, MLX (iOS)
QualityRuff, pytest, Playwright

Running Tests

Most tests are unit/API tests and run without a live device. Live Android and iOS integration tests require the relevant device stack.

bash
# Run all tests on a specific device
DEVICE=<serial> python3 -m pytest tests/ -v --tb=short

For iOS live smoke tests:

bash
IOS_LIVE_NEWS_TEST=1 \
IOS_DEVICE_UDID="<udid>" \
IOS_APPIUM_URL="http://127.0.0.1:4723" \
IOS_BUNDLE_ID="com.google.chrome.ios" \
uv run --extra test python -m pytest tests/test_browser_news.py::test_live_ios_chrome_news_workflow

Get your Android device serial from adb devices.


Database Migrations

The project uses Alembic for schema migrations:

bash
alembic revision --autogenerate -m "add new_field to my_table"   # after editing a model
alembic upgrade head                                              # apply pending
alembic downgrade -1                                              # rollback one

Contributing

The ghost gets stronger with every skill. See CONTRIBUTING.md for adding app skills (highest impact), writing actions and workflows, backend architecture, and the PR process. Join the community on the Skill Hub.


License

MIT. The ghost is free. The ghost is open source. The ghost is yours.

Instalación

TypingMind
{
  "mcpServers": {
    "android-agent": {
      "command": "ghost-in-the-droid",
      "args": []
    }
  }
}

Usa el MCP de Ghost in the Droid con varios modelos de IA

TypingMind conecta las herramientas MCP a nivel del espacio de trabajo, por lo que, una vez conectado Ghost in the Droid, puedes usarlo con distintos modelos de IA en TypingMind sin tener que configurarlo por separado para cada modelo. Esta integración MCP se ejecuta localmente en tu dispositivo a través del conector MCP de TypingMind.

Guía de configuración para usar el conector local

Usa esta opción si el servidor MCP necesita acceder a archivos locales, aplicaciones o recursos privados de tu ordenador.

1

Abre los ajustes de MCP

En TypingMind, ve a Ajustes, luego a Ajustes avanzados y a Model Context Protocol, y elige Configurar conector.

  1. Abre TypingMind en tu navegador.
  2. Haz clic en el icono de Ajustes.
  3. Ve a Ajustes avanzados.
  4. Abre la sección Model Context Protocol.
  5. Haz clic en Configurar conector y elige Este dispositivo.
Pantalla de configuración del conector MCP de TypingMind con «Este dispositivo» seleccionado
2

Ejecuta el comando del conector

Elige Este dispositivo, copia el comando de TypingMind y ejecútalo en Terminal. Mantén el proceso en ejecución mientras uses MCP.

  1. Copia el comando de configuración que muestra TypingMind.
  2. Abre Terminal en macOS o Windows Terminal en Windows.
  3. Pega y ejecuta el comando.
  4. Acepta la instalación del paquete si Terminal te pide confirmación para continuar.
  5. Mantén el proceso en ejecución en la ventana de Terminal mientras uses las herramientas MCP.
3

Añade Ghost in the Droid como servidor

Cuando el estado del conector sea «Listo», haz clic en «Edita servidores» y pega la configuración del servidor MCP.

  1. Espera hasta que el estado del conector indique «Listo».
  2. Haz clic en Edita servidores.
  3. Pega la configuración del servidor MCP de Ghost in the Droid.
  4. Guarda la lista de servidores.
  5. Actualiza para comprobar que el conector sigue listo.
Ajustes de MCP de TypingMind con un servidor activo y el botón «Edita servidores»
{
  "mcpServers": {
    "android-agent": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

Úsala con distintos modelos

Guarda la lista de servidores, abre Plugins, activa las herramientas MCP de Ghost in the Droid y selecciona cualquier modelo de IA compatible en TypingMind para usar las herramientas en el chat o asignárselas a un agente de IA.

  1. Abre la página Plugins en TypingMind.
  2. Activa las herramientas MCP de Ghost in the Droid.
  3. Inicia un chat y elige el modelo de IA que quieras usar.
  4. Usa las herramientas MCP en el chat o asígnalas a un agente de IA.
  5. Cambia a otro modelo de IA cuando lo necesites sin volver a conectar MCP.
Chat de TypingMind que usa herramientas MCP activadas con un modelo de IA seleccionado
¿Puedes usar Ghost in the Droid para ayudarme con esta tarea?
Ghost in the Droid
Claro. Lo he leído.
Esto he encontrado usando Ghost in the Droid.

Preguntas frecuentes

¿Para qué sirve el servidor MCP Ghost in the Droid?

Ghost in the Droid es un servidor MCP que permite a los clientes de IA compatibles conectarse a herramientas y contexto externos. En TypingMind, basta con añadir este servidor MCP una vez para que sus herramientas estén disponibles en tu espacio de trabajo de IA.

¿Puedo usar el servidor MCP Ghost in the Droid con varios modelos de IA en TypingMind?

Sí. TypingMind conecta las herramientas MCP a nivel del espacio de trabajo, por lo que puedes usar Ghost in the Droid con distintos modelos de IA, como Claude, ChatGPT, Gemini u otros que hayas configurado en TypingMind, sin configurar el servidor MCP por separado para cada modelo.

¿Por qué usar el conector MCP de Ghost in the Droid con TypingMind?

TypingMind es una de las mejores interfaces de chat con LLM porque reúne varios modelos de IA, prompts, plugins, agentes de IA, claves de API y herramientas MCP en un solo espacio de trabajo. Con Ghost in the Droid conectado, puedes usar sus herramientas MCP con tus modelos preferidos y mantener organizado tu flujo de trabajo de chat en TypingMind.

¿Cómo conecto el servidor MCP Ghost in the Droid a TypingMind?

Ghost in the Droid funciona a través del conector MCP local de TypingMind. Es la mejor opción cuando el servidor MCP necesita acceder a archivos locales, aplicaciones de escritorio, herramientas de línea de comandos o recursos privados de tu ordenador.

¿Qué herramientas ofrece el servidor MCP Ghost in the Droid en TypingMind?

Ghost in the Droid ofrece funciones MCP que puedes activar desde la página Plugins de TypingMind y usar en el chat o asignar a agentes de IA.

¿Tengo que compartir mis claves de API con TypingMind para usar el servidor MCP Ghost in the Droid?

No. TypingMind prioriza el funcionamiento local y te permite mantener el control de tus proveedores de modelos, claves de API, prompts y configuración MCP. Si Ghost in the Droid requiere autenticación, añade las cabeceras, los ajustes de OAuth o la configuración local necesarios para ese servidor MCP al crear la conexión.

Servidores MCP relacionados

Ver todos

Crea ya tu propio espacio de trabajo IA

Suscríbete a nuestro boletín para recibir avisos sobre nuevas funciones y próximos sorteos 👇