ClawPaw Setup Guide
Walk the user through the complete setup step by step. Check each step before proceeding to the next. Use the scripts in the scripts/ directory to automate checks.
Step 1 — Check Prerequisites
Run the adb check script:
CODEBLOCK0
If STATUS:NO_ADB: guide user to install adb, then re-run.
If STATUS:NO_DEVICE: guide user to connect USB and enable USB Debugging.
If STATUS:DEVICE_FOUND: proceed to Step 2.
Step 2 — Install APK
Ask the user if the ClawPaw app is already installed on the phone.
If not installed, build and install via adb:
CODEBLOCK1
Or guide the user to install manually from Android Studio (Run button).
After install, ask the user to:
- 1. Open the ClawPaw app
- Tap Connect
- Wait for Backend connection and SSH tunnel to show green dots
Step 3 — Grant Permissions (USB connected)
Run the permissions script:
CODEBLOCK2
This grants 3 permissions:
- - WRITESETTINGS — brightness control
- WRITESECURE_SETTINGS — auto-enable accessibility service
- adb tcpip 5555 — enable wireless ADB over SSH tunnel
Then ask the user to check the phone for any permission dialogs and tap Allow.
Step 4 — Verify SSH Tunnel
Ask the user to open the ClawPaw app and confirm both rows show a green dot:
- - Backend connection (WebSocket)
- SSH tunnel (SSH reverse tunnel)
If SSH tunnel shows Disconnected or Error:
- - Tap the Retry button next to the SSH tunnel status
- If still failing, restart the app
Step 5 — Connect ADB (first time or after Pod restart)
Get the user's UID and Secret from the ClawPaw app main screen, then run:
CODEBLOCK3
If output shows failed to authenticate:
- - Tell user to look at the phone screen for an "Allow USB debugging?" dialog
- Tap Always allow from this computer, then OK
- Run the script again
If output shows already connected or connected to: proceed.
Step 6 — End-to-End Verification
Run these curl commands with the user's credentials to confirm the full chain works:
CODEBLOCK4
Read /tmp/phone_screen.png and show it to the user to confirm.
Step 7 — Configure MCP (optional)
To use ClawPaw tools directly in Claude Code (snapshot, tap, screenshot, etc.), add to ~/.claude.json:
CODEBLOCK5
Then restart Claude Code.
Troubleshooting
| Error | Cause | Fix |
|---|
| INLINECODE9 | ADB TCP mode not set | Re-run Step 3 with USB connected |
| INLINECODE10 |
USB debugging (Security settings) not enabled | Settings → Developer Options → USB debugging (Security settings) → ON |
|
WRITE_SETTINGS not granted | Step 3 was skipped | Run
grant-permissions.sh with USB connected |
|
SSH: Disconnected | MIUI killed the service | Settings → Battery → ClawPaw → No restrictions; lock app in recents |
|
failed to authenticate | New adb server, phone needs to approve | Check phone for Allow USB debugging dialog |
| Screenshot is black | Screen is off | Press power key first, or
adb shell input keyevent KEYCODE_WAKEUP |
ClawPaw 设置指南
逐步引导用户完成完整设置。在进入下一步之前检查每一步。使用 scripts/ 目录中的脚本自动执行检查。
第 1 步 — 检查先决条件
运行 adb 检查脚本:
bash
bash .claude/skills/clawpaw-setup/scripts/check-adb.sh
如果 STATUS:NO_ADB:引导用户安装 adb,然后重新运行。
如果 STATUS:NO_DEVICE:引导用户连接 USB 并启用 USB 调试。
如果 STATUS:DEVICE_FOUND:继续执行第 2 步。
第 2 步 — 安装 APK
询问用户 ClawPaw 应用是否已安装在手机上。
如果未安装,通过 adb 构建并安装:
bash
从源代码构建(需要 Android Studio 或 Gradle)
cd android && ./gradlew assembleDebug
adb install -r app/build/outputs/apk/debug/app-debug.apk
或者引导用户从 Android Studio(运行按钮)手动安装。
安装后,请用户:
- 1. 打开 ClawPaw 应用
- 点击连接
- 等待后端连接和SSH 隧道显示绿色圆点
第 3 步 — 授予权限(USB 已连接)
运行权限脚本:
bash
bash .claude/skills/clawpaw-setup/scripts/grant-permissions.sh
这将授予 3 个权限:
- - WRITESETTINGS — 亮度控制
- WRITESECURE_SETTINGS — 自动启用无障碍服务
- adb tcpip 5555 — 通过 SSH 隧道启用无线 ADB
然后请用户检查手机上是否有任何权限对话框,并点击允许。
第 4 步 — 验证 SSH 隧道
请用户打开 ClawPaw 应用并确认两行均显示绿色圆点:
- - 后端连接(WebSocket)
- SSH 隧道(SSH 反向隧道)
如果 SSH 隧道显示已断开或错误:
- - 点击 SSH 隧道状态旁边的重试按钮
- 如果仍然失败,请重新启动应用
第 5 步 — 连接 ADB(首次或 Pod 重启后)
从 ClawPaw 应用主屏幕获取用户的 UID 和 Secret,然后运行:
bash
bash .claude/skills/clawpaw-setup/scripts/reconnect-adb.sh
如果输出显示 failed to authenticate:
- - 告诉用户查看手机屏幕上的允许 USB 调试吗?对话框
- 点击始终允许来自此计算机,然后点击确定
- 重新运行脚本
如果输出显示 already connected 或 connected to:继续执行。
第 6 步 — 端到端验证
使用用户的凭据运行这些 curl 命令以确认完整链路正常工作:
bash
1. 按下主页按钮
curl -sk -X POST https://www.clawpaw.me/api/adb/press_key \
-H Content-Type: application/json \
-H x-clawpaw-secret:
\
-d {uid:,key:home}
预期结果:{success:true,data:}
2. 截取屏幕截图
curl -sk -X POST https://www.clawpaw.me/api/adb/screenshot \
-H Content-Type: application/json \
-H x-clawpaw-secret: \
-d {uid:} | python3 -c
import sys,json,base64
d=json.load(sys.stdin)
if d.get(success) and d.get(data,{}).get(data):
open(/tmp/phone_screen.png,wb).write(base64.b64decode(d[data][data]))
print(屏幕截图已保存到 /tmp/phone_screen.png)
else:
print(失败:, d)
读取 /tmp/phone_screen.png 并向用户展示以确认。
第 7 步 — 配置 MCP(可选)
要在 Claude Code 中直接使用 ClawPaw 工具(快照、点击、截图等),添加到 ~/.claude.json:
json
clawpaw: {
type: stdio,
command: node,
args: [/mcp/dist/index.js],
env: {
CLAWPAWBACKENDURL: https://www.clawpaw.me,
CLAWPAW_UID: ,
CLAWPAW_SECRET:
}
}
然后重新启动 Claude Code。
故障排除
| 错误 | 原因 | 修复 |
|---|
| device offline | 未设置 ADB TCP 模式 | 在 USB 连接的情况下重新执行第 3 步 |
| INJECT_EVENTS permission denied |
未启用 USB 调试(安全设置) | 设置 → 开发者选项 → USB 调试(安全设置)→ 开启 |
| WRITE_SETTINGS not granted | 跳过了第 3 步 | 在 USB 连接的情况下运行 grant-permissions.sh |
| SSH: Disconnected | MIUI 终止了服务 | 设置 → 电池 → ClawPaw → 无限制;在最近任务中锁定应用 |
| failed to authenticate | 新的 adb 服务器,手机需要批准 | 检查手机上是否出现允许 USB 调试对话框 |
| 屏幕截图是黑色的 | 屏幕已关闭 | 先按电源键,或 adb shell input keyevent KEYCODE_WAKEUP |