Skip to main content
Glama
Android MCP

Android MCP

by Steph-ux

Android MCP

모든 AI 에이전트에서 Android 완벽 제어 — Claude, OpenCode, Windsurf, Cursor 등 7개의 범주별 MCP 도구 · 90fps 라이브 뷰어 · WiFi ADB · 설치할 앱 없음


빠른 데모

android_screen(action="screenshot")                          # PNG capture
android_screen(action="ocr")                                 # visible text
android_interact(action="tap", params={"x": 540, "y": 960}) # tap
android_interact(action="find", params={"text": "Send"})     # find + tap
android_system(action="battery")                             # battery info
android_screen(action="viewer")                              # 90fps interactive window on PC

Related MCP server: phone-eye

아키텍처

AI Agent (Claude / OpenCode / Windsurf / Cursor…)
        ↓  MCP Protocol (stdio)
    server.py          ← 7 categorical tools
        ↓
    device_manager.py  ← device selection, multi-device
        ↓
    backends/
        ├── adb_backend.py       ← PRIMARY  : uiautomator2 + direct ADB
        └── companion_backend.py ← FALLBACK : Flutter app WebSocket
        ↓
    N Android phones / emulators

ADB 백엔드 (기본) — 개발자 모드가 활성화된 모든 기기에서 작동합니다. 휴대폰에 설치할 것이 없습니다. uiautomator2 + ADB 명령어를 사용합니다.

컴패니언 백엔드 (대체) — 네트워크에서 ADB를 사용할 수 없을 때 사용하는 선택적 Flutter 앱입니다.


요구 사항

  • Python 3.10+

  • ADB (PATH에 포함되어야 함, winget install Google.PlatformTools)

  • Android: 개발자 모드 + USB 디버깅 (또는 WiFi 디버깅)


설치

git clone https://github.com/Steph-ux/android-mcp
cd android-mcp
pip install -r requirements.txt

# Initialize uiautomator2 (once per device)
python -m uiautomator2 init

라이브 뷰어 90fps (선택 사항)

winget install Genymobile.scrcpy
python viewer.py

MCP 구성

# Generate the correct JSON for your AI client
python mcp_config.py --client claude     # Claude Desktop
python mcp_config.py --client opencode  # OpenCode
python mcp_config.py --client windsurf  # Windsurf
python mcp_config.py --client cursor    # Cursor
python mcp_config.py --write            # write directly to config files

Claude Desktop 예시 (claude_desktop_config.json):

{
  "mcpServers": {
    "android-mcp": {
      "command": "C:/Python312/python.exe",
      "args": ["D:/path/to/android-mcp/server.py"],
      "type": "stdio"
    }
  }
}

USB 없는 WiFi 연결 (Android 11+)

# On the phone: Settings → Developer options → Wireless debugging → Pair device
adb pair 192.168.1.42:38765    # enter the code shown on the phone
adb connect 192.168.1.42:5555

전체 가이드 → WIFI_PAIRING.md


7가지 MCP 도구

호출 규칙: android_xxx(action="...", params={...}, device_id="serial") device_id는 항상 선택 사항입니다 (현재 선택된 기기를 사용).


android_device — 기기 관리

작업

매개변수

설명

list

—

연결된 모든 기기 (USB, WiFi, 에뮬레이터)

select

serial

기본 기기 설정

connect

host, port

WiFi ADB 연결

disconnect

—

현재 WiFi 기기 연결 해제

info

—

모델, OS, 해상도, 밀도

status

—

기기가 연결되어 있고 준비되었는지 확인

setup

—

애니메이션, 화면 켜짐 유지, ATX 에이전트 구성


android_screen — 캡처 및 스트리밍

작업

매개변수

설명

screenshot

—

PNG 캡처 (FLAG_SECURE 우회) → 이미지

region

x y width height

특정 영역 캡처 → 이미지

size

—

{width, height}

is_on

—

화면이 켜져 있는지 확인

wake

—

화면 깨우기

start_stream

—

ADB 스트림 시작 (~16fps)

stop_stream

—

스트림 중지

live_frame

—

최신 스트림 프레임 → 이미지

ocr

lang

표시된 텍스트 추출 (Tesseract)

find_image

template_b64 threshold

템플릿 매칭 (OpenCV)

viewer

fps bitrate no_control

PC에서 scrcpy 90fps 창 실행


android_interact — 터치, 키보드, UI

작업

매개변수

설명

tap

x y

탭

double_tap

x y

더블 탭

long_press

x y duration_ms

길게 누르기

swipe

x1 y1 x2 y2 duration_ms

스와이프

drag

x1 y1 x2 y2 duration_ms

드래그 앤 드롭

pinch

x y scale duration_ms

핀치 줌

multi_touch

points

다중 손가락 제스처

type

text

텍스트 입력

clear

—

활성 필드 지우기

submit

text

입력 + Enter

key

key

시스템 키 (HOME, BACK, ENTER, VOLUME_UP 등)

combo

keys

키 조합 (키코드)

hierarchy

—

전체 UI XML 트리 (uiautomator2)

find

text partial_match

요소 찾기 및 탭

wait

text timeout partial_match

요소 대기

scroll

text direction max_swipes

요소로 스크롤

assert

text partial_match

텍스트가 보이는지 확인


android_app — 애플리케이션

작업

매개변수

설명

launch

package

앱 실행

close

package

앱 강제 종료

list

include_system

설치된 앱 목록

install

apk_path

PC에서 APK 설치

uninstall

package

앱 제거

current

—

포그라운드 앱 패키지

url

url

URL 열기

intent

action uri package extras

Android 인텐트 전송

settings

section

시스템 설정 열기 (main wifi bluetooth display 등)


android_files — 파일

작업

매개변수

설명

push

local_path remote_path

PC → 휴대폰

push_b64

remote_path data

Base64 → 휴대폰

pull

remote_path local_path

휴대폰 → PC

pull_b64

remote_path

휴대폰 → base64

list

directory

디렉토리 내용 나열


android_system — 시스템 및 네트워크

작업

매개변수

설명

shell

command

ADB 쉘 명령어

logs

lines package

Logcat

battery

—

배터리 잔량 및 충전 상태

clipboard_get

—

클립보드 읽기

clipboard_set

text

클립보드에 쓰기

volume

level stream

볼륨 설정

rotation

rotation

화면 회전 (0-3)

wifi

enabled

WiFi 켜기/끄기

bluetooth

enabled

Bluetooth 켜기/끄기

mobile_data

enabled

모바일 데이터 켜기/끄기

notifications

—

활성 알림

gps

lat lng

GPS 위치 모의 설정

sensors

sensor

가속도계, 자이로, 조도 등

wifi_list

—

사용 가능한 WiFi 네트워크

wifi_connect

ssid password

WiFi 연결

contacts

search limit

연락처 읽기

sms

to message

SMS 전송 (휴대폰에서 확인 필요)


android_automation — 배치 및 매크로

작업

매개변수

설명

batch

actions stop_on_error

한 번의 호출로 N개의 작업 실행

macro_start

name

매크로 녹화 시작

macro_record

action …params

매크로에 작업 추가

macro_stop

—

매크로 저장

macro_list

—

저장된 매크로 목록

macro_replay

name delay_ms

매크로 재생

macro_delete

name

매크로 삭제


라이브 뷰어 — scrcpy 90fps

python viewer.py                  # auto-detect device, 90fps, interactive
python viewer.py --fps 60         # 60fps
python viewer.py --record         # record to .mp4
python viewer.py --record out.mp4 # named output file
python viewer.py --multi          # one viewer per connected device
python viewer.py --no-control     # read-only mode

제어

작업

왼쪽 클릭

탭

드래그

스와이프

오른쪽 클릭

BACK

스크롤

스크롤

Alt+H

HOME

Alt+S

스크린샷 → PC 클립보드

Alt+F

전체 화면

Alt+R

회전


테스트

# Unit tests (no device required)
pytest tests/test_server_unit.py -v      # 94 tests

# Integration tests (ADB device required)
pytest tests/test_integration.py -v

프로젝트 구조

android-mcp/
├── server.py              # MCP server — 7 tools
├── viewer.py              # scrcpy 90fps interactive viewer
├── mcp_config.py          # JSON config generator
├── device_manager.py      # Multi-device management
├── relay.py               # ⚠️ LEGACY — companion fallback only
├── requirements.txt
├── pyproject.toml
├── WIFI_PAIRING.md
├── backends/
│   ├── adb_backend.py     # Primary backend (uiautomator2 + ADB)
│   └── companion_backend.py  # Fallback backend (Flutter app)
├── examples/
│   ├── agent_loop.py      # Autonomous automation loop
│   └── whatsapp_auto.py   # WhatsApp automation example
└── tests/
    ├── conftest.py
    ├── test_server_unit.py   # 94 unit tests
    └── test_integration.py   # Real device tests

예시

# WhatsApp — send a message
await android_app("launch", {"package": "com.whatsapp"})
await android_interact("find", {"text": "Alice"})
await android_interact("type", {"text": "Hello!"})
await android_interact("key",  {"key": "ENTER"})

# Batch in a single call
await android_automation("batch", {"actions": [
    {"action": "key",  "key": "HOME"},
    {"action": "tap",  "x": 540, "y": 200},
    {"action": "type", "text": "search query"},
    {"action": "key",  "key": "ENTER"},
]})

# Macro: record + replay
await android_automation("macro_start",  {"name": "login"})
await android_automation("macro_record", {"action": "tap",  "x": 540, "y": 400})
await android_automation("macro_record", {"action": "type", "text": "password"})
await android_automation("macro_stop")
await android_automation("macro_replay", {"name": "login"})

전체 사용 사례는 examples/whatsapp_auto.py 및 examples/agent_loop.py를 참조하세요.


라이선스

MIT

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to remotely control a real Android phone over MCP with no ADB, root, or emulator, by connecting a broker server to a sideloaded APK. Exposes tools to list devices, capture screenshots, read the UI tree, open links and deep links, and perform taps, swipes, typing, and global navigation actions.
      1
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables MCP-compatible AI agents to perceive and control an Android phone through tools for screenshots, visible text and coordinates, app/screen queries, taps, swipes, text input, key events, app launching, and interrupt/resume, closing the perception-action loop.
      6
      MIT