mcpField
A
Android Mcp

Android Mcp

ローカル
github.com/Steph-uxAI・エージェント025 週間前に更新

Android Mcp について

Android MCPは、AIエージェントからAndroid端末を操作するためのサーバーです。ADBによる端末管理、画面確認、UI操作、アプリやファイルの操作、自動化に加え、任意でPCビューアーを利用できます。

主な機能

  1. 01USB、WiFi、エミュレーター端末の管理
  2. 02画面のキャプチャと表示テキストの抽出
  3. 03タップ、入力、UI要素の操作
  4. 04アプリ、ファイル、システム設定の管理
  5. 05操作の一括実行とマクロ記録
  6. 06PCから端末を表示・操作

活用シーン

  1. 01Androidアプリの操作を自動化
  2. 02画面内容とUI状態を確認
  3. 03PCとスマートフォン間でファイルを転送
  4. 04定型的な端末操作を再生

MCP 対応

stdioのMCPプロトコルを介して、Android操作用の7カテゴリのツールを公開します。AIエージェントは接続済み端末を操作できます。

設定

ローカルサーバーの設定はどのクライアントでも共通です。コピーしてクライアントの MCP 設定ファイルに貼り付けてください。

インストール方法は未掲載です

このサーバーのパッケージやリモートエンドポイントはまだ取得できていません。プロジェクトの README の手順に従ってください。

リポジトリ

ツール

ツール一覧はまだ取得されていません

ローカルサーバーのツールはマシン上で起動して初めて取得できます。メンテナーはまだツール一覧を提供していません。

詳細

Android MCP

あらゆる AI エージェントから Android を完全に操作 — Claude、OpenCode、Windsurf、Cursor… カテゴリー別の MCP ツール 7 個 · 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

アーキテクチャ

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 以降
  • PATH に ADB があること(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、エミュレーター)
selectserialデフォルトのデバイスを設定
connecthost, portWiFi ADB 接続
disconnect—現在の WiFi デバイスを切断
info—モデル、OS、解像度、密度
status—デバイスは接続され、使用可能ですか?
setup—アニメーション、スリープ解除維持、ATX エージェントを設定

android_screen — キャプチャとストリーミング
アクションパラメーター説明
screenshot—PNG キャプチャ(FLAG_SECURE を回避)→ 画像
regionx y width height指定範囲をキャプチャ → 画像
size—{width, height}
is_on—画面は点灯していますか?
wake—画面を点灯
start_stream—ADB ストリームを開始(約 16fps)
stop_stream—ストリームを停止
live_frame—ストリームの最新フレーム → 画像
ocrlang表示されているテキストを抽出(Tesseract)
find_imagetemplate_b64 thresholdテンプレートマッチング(OpenCV)
viewerfps bitrate no_controlPC で scrcpy の 90fps ウィンドウを起動

android_interact — タッチ、キーボード、UI
アクションパラメーター説明
tapx yタップ
double_tapx yダブルタップ
long_pressx y duration_ms長押し
swipex1 y1 x2 y2 duration_msスワイプ
dragx1 y1 x2 y2 duration_msドラッグ&ドロップ
pinchx y scale duration_msピンチズーム
multi_touchpointsマルチフィンガージェスチャー
typetextテキストを入力
clear—アクティブなフィールドをクリア
submittextテキストを入力して Enter
keykeyシステムキー(HOME、BACK、ENTER、VOLUME_UP…)
combokeysキーの組み合わせ(キーコード)
hierarchy—UI の完全な XML ツリー(uiautomator2)
findtext partial_match要素を検索してタップ
waittext timeout partial_match要素が表示されるまで待機
scrolltext direction max_swipes要素までスクロール
asserttext partial_matchテキストが表示されていることを確認

android_app — アプリケーション
アクションパラメーター説明
launchpackageアプリを起動
closepackageアプリを強制停止
listinclude_systemインストール済みアプリを一覧表示
installapk_pathPC から APK をインストール
uninstallpackageアプリをアンインストール
current—フォアグラウンドのアプリパッケージ
urlurlURL を開く
intentaction uri package extrasAndroid インテントを送信
settingssectionシステム設定を開く(main wifi bluetooth display…)

android_files — ファイル
アクションパラメーター説明
pushlocal_path remote_pathPC → phone
push_b64remote_path dataBase64 → phone
pullremote_path local_pathPhone → PC
pull_b64remote_pathPhone → base64
listdirectoryディレクトリの内容を一覧表示

android_system — システムとネットワーク
アクションパラメーター説明
shellcommandADB シェルコマンド
logslines packageLogcat
battery—バッテリー残量と充電状態
clipboard_get—クリップボードを読み取る
clipboard_settextクリップボードに書き込む
volumelevel stream音量を設定する
rotationrotation画面の回転(0-3)
wifienabledWiFi のオン/オフ
bluetoothenabledBluetooth のオン/オフ
mobile_dataenabledモバイルデータのオン/オフ
notifications—アクティブな通知
gpslat lngGPS 位置情報を偽装する
sensorssensor加速度計、ジャイロ、光センサーなど
wifi_list—利用可能な WiFi ネットワーク
wifi_connectssid passwordWiFi に接続する
contactssearch limit連絡先を読み取る
smsto messageSMS を送信する(スマートフォンでの確認が必要)

android_automation — バッチとマクロ
アクションパラメーター説明
batchactions stop_on_error1 回の呼び出しで N 個のアクションを実行する
macro_startnameマクロの記録を開始する
macro_recordaction …paramsマクロにアクションを追加する
macro_stop—マクロを保存する
macro_list—保存済みマクロを一覧表示する
macro_replayname delay_msマクロを再生する
macro_deletenameマクロを削除する

ライブビューアー — 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+HHOME
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

コメント

MCP は初めてですか?

プロトコルの概要から最初のサーバーの導入まで、よくある疑問にまとめて答えます。

AI アプリケーションが外部のツールやデータソースに統一的な方法で接続するためのオープンなプロトコルです。クライアントはモデルとの対話を担い、MCP サーバーはツール・リソース・プロンプトテンプレートを提供します。標準メッセージでやり取りするため、1 つのサーバーを複数のクライアントで再利用できます。