Skip to main content
Glama

Android MCP ๐Ÿค–โœจ

npm node adb ci

Friendly MCP stdio server that chats with Android devices over ADB using @devicefarmer/adbkit, speaking newline-delimited JSON-RPC via @modelcontextprotocol/sdk (no Content-Length headers needed). Plug it into Cursor/Claude MCP and start poking at devices.

โœจ What is this?

  • MCP transport that forwards handy ADB actions (tap, text, screenshot, UI dump, etc).

  • Uses newline-delimited JSON on stdin/stdout; one request per line, one response per line.

  • Prototype-friendly: swap out the minimal JSON-RPC loop for a full MCP SDK later if you want.

๐Ÿ“ฆ Requirements

  • ADB server running on your host (adb start-server).

  • Node.js 18+.

  • At least one device or emulator attached (adb devices).

๐Ÿš€ Quickstart

git clone <repo-url> android-mcp cd android-mcp npm install npm run dev

Keep adb devices happy, then fire JSON-RPC lines at stdin and watch stdout for replies.

๐Ÿงฐ MCP config (Cursor/Claude)

Example ~/.cursor/mcp.json entry:

{ "mcpServers": { "android-mcp": { "type": "stdio", "command": "npx", "args": ["--yes", "tsx", "/home/ivan/code/android-mcp/src/server.ts"], "cwd": "/home/ivan/code/android-mcp" } } }

๐ŸŽฎ Tools exposed

  • selectDevice { serial } โ†’ set default device for subsequent calls.

  • keyEvent { keyCode, serial? } โ†’ send input keyevent.

  • tap { x, y, serial? }

  • text { text, serial? } โ†’ uses input text (spaces become %s).

  • startActivity { component, serial? } โ†’ e.g. "org.example/.MainActivity".

  • screenshot { serial? } โ†’ { mimeType: "image/png", base64 }.

  • uiDump { serial? } โ†’ parsed uiautomator dump tree (text, contentDesc, resourceId, bounds).

  • findAndTap { text?, contentDesc?, serial? } โ†’ finds the first matching node and taps its center.

  • listDevicesDetailed โ†’ lists attached devices with model/manufacturer/sdk info.

๐Ÿ“ธ Notes & limits

  • Screenshot and UI dump are periodic snapshots (no streaming yet).

  • UI dump depends on uiautomator being present on the device.

  • Prototype transport; you can wire in a richer MCP SDK without changing the ADB helpers.

๐Ÿงช Tests

npm test
-
security - not tested
F
license - not found
-
quality - not tested

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/hamen/android-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server