Android Control MCP Server
Android Control MCP Server
Node.js로 구축된 프로덕션 레디 Model Context Protocol (MCP) 서버로, AI 어시스턴트(Claude Desktop, Cursor, 커스텀 에이전트 워크플로우 등)가 연결된 Android 기기를 관찰하고, 추론하고, 제어할 수 있게 해줍니다.
🌟 주요 기능
👀 컴퓨터 사용 관찰(Computer-Use Observation): 고해상도 PNG 화면 캡처를 기기 메타데이터와 함께 MCP 이미지 블록으로 직접 반환합니다.
🔍 UIAutomator 계층 구조 파싱: 장황한 Android UI 트리를 간결하고 구조화된 JSON으로 변환하는 지능형 XML 덤프 파서입니다.
🎯 의미 기반 요소 클릭: 수동 픽셀 계산 없이 표시된 텍스트, 접근성 설명 또는 리소스 ID로 버튼과 컨트롤을 클릭합니다.
⚡ 빠른 제스처 및 입력: 픽셀 정확도의 탭, 다중 좌표 스와이프, 방향별 스크롤, 하드웨어 키 에뮬레이션, 셸 이스케이프 처리된 텍스트 입력을 지원합니다.
📱 앱 수명주기 관리: 패키지 이름으로 애플리케이션을 실행하고 현재 포커스된 포그라운드 액티비티를 확인합니다.
🛡️ 안전 및 샌드박싱: 실제 화면 경계에 대한 입력 좌표 검증, 엄격한 허용 목록 키코드, 인자 정화, 명령 타임아웃, 엄격한
stderr로깅을 통해 stdio MCP 스트림 무결성을 보장합니다.🔄 다중 기기 지원: 연결된 기기를 자동 감지하거나
ANDROID_DEVICE_ID를 통해 특정 기기를 대상으로 지정합니다.
Related MCP server: autoglm-mcp-server
🏗️ 아키텍처
AI Client (Claude Desktop, Cursor, Agent)
│
│ stdio transport (JSON-RPC)
▼
Node.js MCP Server
│
├── Stderr Structured Logger
├── Zod Schema Validation
│
├── ADB Controller Layer
│ ├── Device Resolver (auto-detect or target serial)
│ ├── Input Engine (tap, swipe, keyevent, text, scroll)
│ ├── Screenshot Manager (exec-out binary stream)
│ └── App Manager (launch, foreground inspection)
│
└── UIAutomator Engine
├── XML Hierarchy Dump & Normalizer
├── Bounds & Center Coordinate Extractor
└── Semantic Element Finder & Click Resolver
│
▼
Android Device / Emulator📋 사전 요구사항
Node.js:
v20.0.0이상 (node -v)Android SDK Platform-Tools: ADB(
adb)가 설치되어 시스템PATH에 있어야 합니다(또는ADB_PATH로 구성).Android 기기 또는 에뮬레이터:
물리적 기기: USB로 연결하고 개발자 옵션과 USB 디버깅을 활성화합니다.
에뮬레이터: Android Studio AVD, Genymotion 또는 헤드리스 에뮬레이터.
기기 연결 확인
adb devices -l기기가 device로 표시되어야 합니다:
List of devices attached
emulator-5554 device product:sdk_gphone64_arm64 model:sdk_gphone64_arm64🚀 설치 및 빠른 시작
# Clone or navigate to the repository
cd c:/Users/Abhishek/Code/mcp
# Install dependencies
npm install
# Run unit tests
npm test
# Start the MCP server
npm start⚙️ 구성
.env 파일을 생성하거나 환경 변수를 전달합니다:
# Target device ID (serial number). If omitted and 1 device is connected, it auto-selects.
ANDROID_DEVICE_ID=
# Custom path to ADB executable if not in PATH
# Windows: C:\Users\<user>\AppData\Local\Android\Sdk\platform-tools\adb.exe
# macOS: /Users/<user>/Library/Android/sdk/platform-tools/adb
ADB_PATH=adb
# Log level: debug | info | warn | error
LOG_LEVEL=info
# Default ADB timeout in milliseconds
ADB_TIMEOUT_MS=15000🔌 MCP 클라이언트에 연결
1. Claude Desktop 구성
claude_desktop_config.json에 다음을 추가합니다:
Windows:
%APPDATA%\Claude\claude_desktop_config.jsonmacOS:
~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"android-control": {
"command": "node",
"args": ["C:/Users/Abhishek/Code/mcp/src/index.js"],
"env": {
"ANDROID_DEVICE_ID": "",
"ADB_PATH": "adb",
"LOG_LEVEL": "info"
}
}
}
}2. Cursor / Windsurf MCP 구성
Cursor의 Features > MCP Servers 또는 Windsurf 설정에서:
이름(Name):
android-control유형(Type):
command명령어(Command):
node C:/Users/Abhishek/Code/mcp/src/index.js
🛠️ MCP 도구 참조
1. android_device_info
포괄적인 기기 하드웨어 및 OS 메타데이터를 가져옵니다.
매개변수:
deviceId(선택적 문자열): 대상 기기 시리얼 번호.
응답 예시:
{ "deviceId": "emulator-5554", "model": "Pixel 8", "manufacturer": "Google", "androidVersion": "15", "sdk": 35, "resolution": { "width": 1080, "height": 2400 }, "connectionState": "connected" }
2. android_screenshot
Android 화면을 MCP 이미지 콘텐츠 블록(image/png)으로 캡처합니다.
매개변수:
deviceId(선택적 문자열): 대상 기기 시리얼 번호.
반환값: PNG base64 이미지 데이터 블록 + 크기 메타데이터.
3. android_ui_dump
현재 화면의 UIAutomator 계층 구조를 간결하고 AI 친화적인 JSON 형식으로 덤프합니다.
매개변수:
deviceId(선택적 문자열): 대상 기기 시리얼 번호.
출력 예시:
{ "package": "com.android.settings", "activity": "com.android.settings.Settings", "totalElements": 24, "interactiveElementsCount": 8, "elements": [ { "index": 0, "text": "Network & internet", "resourceId": "android:id/title", "className": "TextView", "clickable": true, "bounds": [196, 340, 1016, 400], "center": [606, 370] } ] }
4. android_find_element
현재 화면에서 특정 기준과 일치하는 UI 요소를 검색합니다.
매개변수:
text(선택적 문자열): 표시된 텍스트(정확히 일치 또는 부분 일치).contentDescription(선택적 문자열): 접근성 레이블.resourceId(선택적 문자열): 리소스 ID.className(선택적 문자열): 위젯 클래스 이름.clickable(선택적 불리언): 클릭 가능 여부로 필터링.exactMatch(선택적 불리언, 기본값false): 정확한 문자열 일치.
5. android_click_element
요소를 찾아 한 단계로 해당 중심점을 클릭합니다.
매개변수:
text(선택적 문자열): 요소 텍스트.contentDescription(선택적 문자열): 요소 콘텐츠 설명.resourceId(선택적 문자열): 요소 리소스 ID.className(선택적 문자열): 요소 클래스.
6. android_tap
화면 경계 검증과 함께 정확한 (x, y) 좌표를 탭합니다.
매개변수:
x(숫자): X 좌표.y(숫자): Y 좌표.
7. android_swipe
두 지점 사이에서 드래그/스와이프 제스처를 수행합니다.
매개변수:
x1,y1(숫자): 시작 좌표.x2,y2(숫자): 끝 좌표.duration(선택적 숫자, 기본값: 300): 밀리초 단위의 지속 시간.
8. android_type_text
현재 포커스된 입력 필드에 텍스트를 입력합니다. 공백 인코딩(%s) 및 셸 문자 이스케이프를 처리합니다.
매개변수:
text(문자열): 입력할 텍스트.
9. android_press_key
하드웨어 또는 내비게이션 키를 누릅니다.
지원 키:
HOME,BACK,ENTER,TAB,ESC,DELETE,SPACE,VOLUME_UP,VOLUME_DOWN,POWER,APP_SWITCH,CAMERA등.매개변수:
key(문자열): 키 이름 또는 숫자 키코드.
10. android_scroll
실제 화면 크기를 기준으로 계산된 방향별 스크롤입니다.
매개변수:
direction(문자열:up|down|left|right)amount(선택적 숫자): 픽셀 단위의 스크롤 거리.
11. android_launch_app
패키지 이름으로 애플리케이션을 실행합니다.
매개변수:
packageName(문자열): 예:com.android.settings,com.google.android.youtube.activity(선택적 문자열): 특정 액티비티 이름.
12. android_current_app
현재 포커스된 포그라운드 패키지와 액티비티를 확인합니다.
13. android_execute_action (통합 컴퓨터 사용 도구)
tap, swipe, type, press_key, click_element, scroll, launch_app 등 모든 액션을 지원하는 단일 통합 액션 디스패처입니다.
{
"action": "click_element",
"text": "Wi-Fi"
}🤖 권장 AI 워크플로우: 관찰 → 추론 → 실행 → 검증
1. OBSERVE:
AI calls `android_screenshot` and `android_ui_dump`.
2. REASON:
AI inspects visual and UI structure to identify target elements.
3. ACT:
AI calls `android_click_element`, `android_type_text`, or `android_scroll`.
4. VERIFY:
AI captures another screenshot/dump to confirm desired state change.🧪 테스트
자동화된 테스트 스위트를 실행합니다:
npm test테스트는 Vitest를 사용하고 ADB 실행 계층을 모킹하므로, CI/CD 중에 실제 Android 기기가 연결되어 있지 않아도 전체 단위 검증이 가능합니다.
🔒 보안 모범 사례
임의 셸 실행 없음: 서버는 원시
adb shell실행 도구를 노출하지 않습니다.안전한 프로세스 호출: 모든 명령은 셸 인젝션을 방지하기 위해 명시적 인자 배열과 함께
child_process.execFile을 사용합니다.입력 정화: 패키지 이름, 키코드, 좌표 매개변수는 Zod 스키마와 경계 검사를 통해 엄격하게 검증됩니다.
Stderr 격리 로깅: 모든 로그는
stdout에서 엄격한 JSON-RPC 프로토콜 준수를 유지하기 위해stderr로만 전달됩니다.
📄 라이선스
MIT
Available Tools
13 toolsandroid_click_elementB
Find and click a UI element on the current Android screen by its visible text, content description, or resource ID. Computes the center of the element and executes a precise tap.
Inputs: text, deviceId, className, exactMatch, +2 more.
android_current_appA
Get the package name and activity of the currently focused foreground Android application.
Inputs: deviceId.
android_device_infoA
Get detailed information about the connected Android device, including device ID, model, manufacturer, Android OS version, SDK level, and screen resolution.
Inputs: deviceId.
android_execute_actionC
Execute a high-level Android action in a single tool call. Supports tap, swipe, type, press_key, click_element, scroll, and launch_app.
Inputs: action (required), x, y, x1, +13 more.
android_find_elementA
Search for UI elements on the current Android screen by visible text, content description, resource ID, or class name. Returns matching elements with their computed center tap coordinates.
Inputs: text, deviceId, className, clickable, +3 more.
android_launch_appB
Launch an Android application by its package name (e.g. "com.android.settings", "com.google.android.youtube", "com.android.chrome").
Inputs: packageName (required), activity, deviceId.
android_press_keyC
Press an Android hardware or navigation key. Supported keys include: HOME, BACK, CALL, ENDCALL, VOLUME_UP, VOLUME_DOWN, POWER, CAMERA, CLEAR, COMMA, PERIOD, TAB, SPACE, ENTER, DELETE, etc.
Inputs: key (required), deviceId.
android_screenshotA
Capture the current screen of the Android device as a PNG image for visual inspection and AI computer-use reasoning.
Inputs: deviceId.
android_scrollB
Scroll the screen in a specified direction (up, down, left, right).
Inputs: direction (required), amount, deviceId.
android_swipeA
Perform a swipe / drag gesture between two points (x1, y1) and (x2, y2) with a configurable duration.
Inputs: x1 (required), x2 (required), y1 (required), y2 (required), +2 more.
android_tapB
Tap at specific (x, y) pixel coordinates on the Android device screen.
Inputs: x (required), y (required), deviceId.
android_type_textA
Type text into the currently focused Android input field. Handles escaping for spaces and special characters.
Inputs: text (required), deviceId.
android_ui_dumpA
Dump the current Android screen UI hierarchy using UIAutomator. Returns a structured, compact list of visible and interactive UI elements with their text, resource IDs, and screen bounds.
Inputs: deviceId.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 13 tools
Most tools have clearly distinct purposes, but android_tap, android_click_element, and android_execute_action overlap in interaction, differing only by abstraction level (raw coordinates, element-based, and high-level bundling). Descriptions help disambiguate these, so the overlap is minor.
All tools share the 'android_' prefix, which is good, but the naming pattern is inconsistent: some are bare nouns (screenshot, scroll), some are verb phrases (type_text, launch_app), and some are noun phrases (current_app, device_info). This mix of conventions is still readable but not fully predictable.
With 13 tools, the server is well-scoped for a mobile automation domain, offering both low-level gestures and high-level actions without redundancy. This count is appropriate and each tool earns its place.
The tool surface covers core UI automation: screen capture, interaction (tap, swipe, type, press, scroll), element discovery (ui_dump, find_element, click_element), and app control (launch_app, current_app). Missing advanced gestures like pinch or long-press, but these are not essential for typical agent tasks.
Maintenance
Related MCP Connectors
Let Claude, ChatGPT and other agents use your Android phone: see the screen, tap, type, open apps.
Cloud Android devices for AI agents: install an APK, read the screen, tap, type, read logcat.
Give your AI agent a real cloud Android phone: push APKs, drive it, get screenshots and logs.
Cloud Android phones for AI agents: create a phone, read the screen, tap, type, install APKs, park.
Related MCP Servers
- AlicenseBqualityDmaintenanceEnables AI assistants to interact with Android devices and emulators via ADB, providing tools for screenshots, UI inspection, touch and text input, app management, and device control.42143 npm23MIT
- AlicenseAqualityDmaintenanceEnables AI models to control Android devices via ADB through natural language commands, supporting screen analysis and automated actions.357 npmMIT
- FlicenseBqualityDmaintenanceEnables AI agents to control Android devices via ADB, supporting gestures, input, screenshots, UI analysis, and app management.191-
- AlicenseAqualityCmaintenanceEnables AI agents to control, inspect, and automate Android devices, Waydroid containers, and AVD emulators over ADB. Provides tools for screenshots, UI-hierarchy text-based tapping, gestures, key presses, text input, app management, and raw shell commands.12MIT