Skip to main content
Glama
zalazp
by zalazp

adb-sms MCP

ADB 経由で Android のSMS 認証コードを読み取り、Cursor Agent が chrome-devtools と連携して Web の SMS ログインを完了できるようにします。

設計方針: 電話番号はユーザーが devices.json で設定します。adb はデバイスの serial の識別と SMS の OTP 読み取りのみを担当します。

動作原理

USB 连接手机(adb devices → serial)
        │
        ├─ devices.json[serial].phone_numbers  →  Web 填手机号
        │
        └─ adb 读短信 inbox                    →  adb_wait_for_otp 拿验证码

Related MCP server: Android MCP Server

プロジェクト構成

mcp-adb-sms/
├── server.py              # MCP 服务入口
├── adb_client.py          # ADB 设备 / 短信读取
├── sms_parser.py          # 短信与 OTP 解析
├── test_local.py          # 本地自检(不启动 MCP)
├── requirements.txt
├── devices.json.example   # 手机号配置模板(提交到 git)
├── devices.json           # 本地配置(git 忽略,需自行创建)
└── README.md

前提条件

  1. Android スマホで USB デバッグ を有効にし、PC を認証する

  2. adb devicesdevice と表示される(unauthorized ではない)

  3. Python 3.10+(推奨: 3.12)

  4. Android platform-toolsadb を含む)

インストール

git clone https://github.com/zalazp/mcp-adb-sms.git
cd mcp-adb-sms
py -3.12 -m pip install -r requirements.txt

電話番号の設定(必須)

電話番号はadb では読み取らず、ご自身で devices.json に記入してください:

copy devices.json.example devices.json
  1. adb devices を実行し、serial をメモする(例: 10AD410LNF000PX

  2. serial をキーとして、そのスマホのすべての電話番号を記入する

{
  "10AD410LNF000PX": {
    "phone_numbers": [
      "18317840243",
      "19139582095"
    ]
  }
}

Cursor 設定

%USERPROFILE%\.cursor\mcp.json を編集:

{
  "mcpServers": {
    "adb-sms": {
      "command": "py",
      "args": [
        "-3.12",
        "E:\\path\\to\\mcp-adb-sms\\server.py"
      ],
      "env": {
        "ADB_PATH": "D:\\RJAZ\\Sdk\\platform-tools\\adb.exe"
      }
    }
  }
}

フィールド

説明

args 内のパス

clone したディレクトリ内の server.py絶対パスに変更

ADB_PATH

本機の adb.exe の絶対パス。PATH に含まれている場合は "adb" と記述可

保存後、Cursor を再起動すると、MCP パネルで adb-sms が緑色になります。

ローカル自己診断

cd mcp-adb-sms
$env:ADB_PATH="D:\RJAZ\Sdk\platform-tools\adb.exe"
py -3.12 test_local.py

正常な出力例:

{
  "adb_exists": true,
  "devices": [{ "serial": "10AD410LNF000PX", "state": "device" }],
  "sms_readable": true,
  "sim_numbers": [
    { "number": "13800138000", "available": true },
    { "number": "13900139000", "available": true }
  ],
  "device_profile": { "source": "devices.json" }
}

recommendations が設定不足を示している場合は、上記の手順で devices.json を作成してください。

MCP ツール

ツール

説明

adb_health_check

adb、SMS 読み取り可否、devices.json の設定状況を診断

adb_list_devices

接続中の ADB デバイスを一覧表示

adb_get_sim_numbers

devices.json から現在の serial の電話番号を読み取る

adb_read_recent_sms

直近 N 件の SMS を読み取る

adb_wait_for_otp

Web で認証コード送信後、新しい OTP をポーリング待機

adb_grant_sms_permission

Android 11+ で shell に SMS 読み取りを許可する試行

adb_shell

制限付き adb shell(ホワイトリストコマンド)

Agent の典型的なフロー(SMS ログイン)

1. adb_health_check()
2. adb_get_sim_numbers()              ← 从 devices.json 取手机号
3. chrome-devtools: 打开登录页、填号、勾选协议
4. chrome-devtools: 滑块验证码(失败则人工完成)
5. chrome-devtools: 点击「发送验证码」
6. adb_wait_for_otp(timeout=90, sender_filter="Midea|美的")
7. chrome-devtools: 填入验证码并登录

SMS が読み取れない場合

adb shell appops set com.android.shell READ_SMS allow

または Agent で adb_grant_sms_permission を呼び出し、その後 adb_health_check を実行します。

それでも失敗する場合、MCP は dumpsys notification による通知バーの SMS 読み取り(精度は低め)にフォールバックします。

セキュリティ上の注意

  • USB 接続されたローカルデバイスの SMS のみを読み取ります

  • SMS の内容をディスクに永続化しません

  • devices.json には電話番号が含まれるため、.gitignore に含まれており、公開リポジトリにコミットしないでください

  • adb_shell は content / dumpsys / getprop などのホワイトリストコマンドのみ許可します

  • 本人のデバイスまたは許可されたテスト環境のみで使用してください

License

MIT

F
license - not found
Not graded
quality - not tested
B
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • F
    license
    A
    quality
    C
    maintenance
    Enables AI agents to interact with Android devices through UI manipulation, screen capture, touch gestures, text input, and app management via ADB. Provides comprehensive mobile automation capabilities including element detection, navigation, and application control for Android device testing and interaction.
    9
    5
  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables control of Android devices through ADB using natural language commands. Supports browser automation, SMS sending, device information retrieval, settings control, and common device actions like screenshots and button presses.
    3

View all related MCP servers

Related MCP Connectors

  • Remote MCP for Android CLI agent build gate, structured receipts, audit logs, and reviewer-ready evi

  • Phone, SMS & email for AI agents — one remote MCP endpoint, OAuth login, zero install.

  • Control plane for agent auth walls. Connector 0 handles SMS OTP with US test numbers.

View all MCP Connectors

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/zalazp/mcp-adb-sms'

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