testclaw-mcp
Provides tools for managing Android devices, including installing, opening, uninstalling apps, and running test suites on Android devices via ADB.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@testclaw-mcplist available Android devices for testing"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
testclaw-mcp
给 TestClaw 提供远程 HTTP MCP 工具层。
当前仓库的 AI 主架构已经调整为 API + CLI + SKILL。testclaw-mcp 继续保留,但定位改为:
面向外部 MCP 客户端的兼容层
远程 HTTP MCP 暴露层
无法直接运行
testclaw-cli时的替代接入方式
如果当前运行环境可直接安装并执行 testclaw-cli,业务主路径应优先走 testclaw-cli,而不是继续把 testclaw-mcp 当作唯一执行面。
OAuth 登录主路径已经收敛到 sonic-server。testclaw-mcp 仅保留自身兼容 OAuth/HTTP 接入能力,用于已有 MCP 客户端接入;业务主路径仍优先走 testclaw-cli。
能力
OAuth 登录 Sonic MCP
无鉴权
GET /healthz获取当前用户
查询项目 / 模块 / 用例 / 元素 / 步骤 / 安装包 / Agent / 设备 / 测试结果 / 测试套件
创建模块 / 测试用例 / 步骤 / 测试套件
连接 Agent websocket 查询已安装应用
远程安装 / 打开 / 关闭 / 卸载应用
运行 / 停止测试套件
通用 Sonic API 请求
Related MCP server: Any-API MCP Server
默认目标
默认会连到:
SONIC_BASE_URL=http://192.168.31.121:3001SONIC_API_PREFIX=/api/controller
也可以通过环境变量覆盖。
环境变量
SONIC_BASE_URL:Sonic 站点地址,例如http://192.168.31.121:3001SONIC_API_PREFIX:API 前缀,默认/api/controllerSONIC_MCP_HOST:MCP 对外可访问的主机名或 IP,默认127.0.0.1SONIC_MCP_PORT:HTTP MCP 监听端口,默认39040SONIC_MCP_DATA_DIR:SQLite 数据目录,默认./.dataMCP_DANGEROUSLY_ALLOW_INSECURE_ISSUER_URL:允许http://issuer,仅测试/内网使用
安装依赖
cd testclaw-mcp
npm install要求 Node >=22.5.0。
本地运行
SONIC_BASE_URL=http://192.168.31.121:3001 \
SONIC_MCP_HOST=127.0.0.1 \
SONIC_MCP_PORT=39040 \
MCP_DANGEROUSLY_ALLOW_INSECURE_ISSUER_URL=true \
node index.js注意:
OAuth 地址会直接由
SONIC_MCP_HOST和SONIC_MCP_PORT推导服务端本地监听固定绑定
0.0.0.0SONIC_MCP_HOST必须填写客户端可访问的真实地址,例如127.0.0.1或192.168.31.121若要使用
http://,必须显式开启MCP_DANGEROUSLY_ALLOW_INSECURE_ISSUER_URL=true部署端不再需要写死
SONIC_USERNAME/SONIC_PASSWORD
服务器部署示例:
SONIC_BASE_URL=http://127.0.0.1:3001 \
SONIC_MCP_HOST=192.168.31.121 \
SONIC_MCP_PORT=39040 \
MCP_DANGEROUSLY_ALLOW_INSECURE_ISSUER_URL=true \
node index.js在 MCP 客户端中接入
当前版本只提供 HTTP /mcp 接入,不再支持 stdio。
示例(Codex):
[mcp_servers.sonic]
url = "http://127.0.0.1:39040/mcp"首次登录:
codex mcp login sonic如果你把 testclaw-mcp 部署到服务器上,再把地址改成服务器 URL,例如:
[mcp_servers.sonic]
url = "http://192.168.31.121:39040/mcp"通用 MCP 客户端示例:
{
"mcpServers": {
"sonic": {
"url": "http://127.0.0.1:39040/mcp"
}
}
}登录方式
当前版本的登录方式是:
Codex 连接
/mcp用户执行
codex mcp login sonic浏览器打开
testclaw-mcp的/authorize用户输入 Sonic 用户名密码
testclaw-mcp向 Sonic 换取SonicToken后续 MCP 工具调用自动附带当前登录用户对应的
SonicToken
部署端不保存 Sonic 明文账号密码。
第一版工具
sonic_loginsonic_get_current_usersonic_list_projectssonic_list_modulessonic_get_modulesonic_create_modulesonic_list_test_casessonic_get_test_casesonic_create_test_casesonic_list_elementssonic_get_elementsonic_list_stepssonic_get_stepsonic_create_stepsonic_list_packagessonic_create_packagesonic_upload_packagesonic_list_agentssonic_list_installed_appssonic_get_agentsonic_list_devicessonic_get_devicesonic_prepare_android_debugsonic_release_devicesonic_install_packagesonic_open_appsonic_kill_appsonic_uninstall_appsonic_list_resultssonic_get_resultsonic_list_suitessonic_get_suitesonic_create_suitesonic_run_suitesonic_force_stop_suitesonic_api_request
AI Agent 全自动流程
当前 testclaw-mcp 已经可以覆盖一条完整的 AI Agent 自动化链路:
sonic_list_projectssonic_list_modules/sonic_create_modulesonic_list_test_cases/sonic_create_test_casesonic_list_elements/sonic_create_stepsonic_create_suitesonic_prepare_android_debugsonic_install_package/sonic_open_app/sonic_kill_app/sonic_uninstall_appsonic_run_suitesonic_get_result/sonic_force_stop_suitesonic_release_device
也就是说,AI Agent 现在可以:
自动创建测试模块、测试用例、步骤和测试套件
自动占用 Android 设备并获取
adb/uiautomator2调试地址自动在本地
adb模式下安装应用、启动应用、停止应用、卸载应用自动触发 Sonic 测试套件执行并轮询结果
在流程结束后自动释放设备
推荐编排顺序:
先通过
sonic_prepare_android_debug绑定设备再通过
sonic_create_*系列工具生成测试资产如需直接做设备前置动作,优先走默认
executionMode=local再调用
sonic_run_suite最后无论成功失败都执行
sonic_release_device
当前默认设计适合:
Codex/Claude Desktop/Cursor -> testclaw-mcp -> Sonic Server如果
testclaw-mcp跑在 AI Agent 本机,则设备应用操作默认走本机adb
健康检查
可直接用无鉴权接口做部署探活:
curl http://127.0.0.1:39040/healthz返回会包含:
statusversiontimechecks.sqlitechecks.sonic
设备选择
以下设备操作工具现在都支持 3 种设备选择方式:
deviceIdudIdadbAddress
适用工具:
sonic_prepare_android_debugsonic_release_devicesonic_list_installed_appssonic_install_packagesonic_open_appsonic_kill_appsonic_uninstall_app
其中 adbAddress 支持直接传页面上展示的字符串,例如:
adb connect 192.168.31.52:52892当前解析规则是:
先按
adbAddress的 host 找到对应 Agent再查找该 Agent 下当前登录用户唯一一台
DEBUGGING状态的 Android 设备若匹配到多台或 0 台,会直接报错,要求改传
deviceId或udId
设备执行模式
设备相关工具现在支持两种执行模式:
默认
executionMode=local可选
executionMode=server
默认 local 的含义是:
testclaw-mcp仍然通过 Sonic Server 占用设备并获取调试端口但真正的
adb操作在 运行testclaw-mcp的这台机器本地执行因此如果你希望
Codex -> 本机 adb -> Sonic 设备调试端口,就应该把testclaw-mcp跑在 Codex 本机
兼容模式 server 的含义是:
继续沿用旧逻辑
由
testclaw-mcp通过 Agent WebSocket 在服务端侧执行应用安装、启动、停止、卸载与应用列表查询
支持 executionMode 的工具:
sonic_list_installed_appssonic_install_packagesonic_open_appsonic_kill_appsonic_uninstall_app
sonic_prepare_android_debug 的默认行为:
支持
deviceId或udId默认给 Android 设备分配一组确定性的调试端口:
sasRemotePort = 45000 + (deviceId % 1000) * 2uia2RemotePort = sasRemotePort + 1
返回结果里会额外带上:
resolvedDeviceadbAddresslocalCommands.connectAdblocalCommands.uia2ServerUrl
本地运行示例
如果你要让 Codex 本地直连设备,请在 Codex 本机运行 testclaw-mcp:
SONIC_BASE_URL=http://192.168.31.121:3001 \
SONIC_MCP_HOST=127.0.0.1 \
SONIC_MCP_PORT=39040 \
SONIC_MCP_ADB_BIN=adb \
node index.js可选环境变量:
SONIC_MCP_ADB_BIN指定本地
adb可执行文件路径,默认adb
SONIC_MCP_ADB_ENV_JSON以 JSON 形式附加本地执行
adb时需要的环境变量
安全说明
推荐生产环境给
SONIC_MCP_HOST配置可访问的HTTPS域名HTTP模式属于显式不安全模式,仅建议内网或测试环境使用SQLite 会保存 OAuth client、授权码、access token / refresh token 以及 Sonic session token
不会长期保存 Sonic 明文密码
说明
返回结果尽量保留 Sonic 原始响应结构(code / message / data),方便后续扩展。后面如果你要,我可以继续补:
测试用例 tools
模块 / 公共步骤 tools
设备占用 / 释放 tools
更细的资源级权限控制
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/liam798/testclaw-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server