list_targets
List WebView pages
List debuggable H5 pages running inside Android WebViews (and Chrome) on connected devices. Returns a target id for each page to pass to attach.
无需输入参数。

io.github.xianguoGou由 GitHub 账号 xianguoGou 发布v0.1.2更新于 Nov 4, 2026
Debug H5 pages inside Android app WebViews: console logs, exceptions, run JS.
让编程助手调试真实 Android 设备上 WebView 内的 H5 页面:列出页面、读取控制台日志与异常,并执行 JavaScript。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
参照 仓库 中的启动说明。
[npm version] [npm downloads] [license]
English | 简体中文
An MCP server that lets coding agents (Claude Code, Codex, Cursor…) debug H5 pages running inside Android WebViews on real devices — read console output and uncaught exceptions, and run JavaScript in the page, without opening chrome://inspect.
Status: v0.1, early. Android only.
Every debuggable WebView exposes a Chrome DevTools Protocol endpoint on an abstract unix socket. The server discovers those sockets over adb (the same way chrome://inspect does), forwards them to local ports, and connects with CDP.
adb on your PATH (or set ADB_PATH)Other MCP clients (Cursor, Codex…) take the same command: npx -y h5-devtools-mcp.
Output is designed to be token-cheap: compact one-line entries, long messages truncated, and since_seq so an agent only reads what's new instead of re-reading the whole buffer on every turn.
chrome://inspect DevTools window./json/list omitting webSocketDebuggerUrl. Recent Chromium accepts several CDP clients per page, so attach may succeed alongside an open DevTools window; older WebViews may still refuse.list_targets can take ~3s per unresponsive app. Sockets are queried one by one with a 3s timeout, and Android freezes background apps, so their WebView sockets stop answering. attach only re-checks the target's own socket and stays fast.evaluate_js runs with the page's full privileges — it can read cookies, storage and tokens, and change page state. Keep it behind your agent's tool-permission prompt.The e2e test uses a fake adb and headless Chromium in place of a phone:
evaluate_jsscreenshotMIT
来源:README.md,提交 ce0e832
List WebView pages
List debuggable H5 pages running inside Android WebViews (and Chrome) on connected devices. Returns a target id for each page to pass to attach.
无需输入参数。
Attach to a page
Connect to a WebView page and start buffering its console output and uncaught exceptions (the last 1000 entries). Recent messages the engine still holds are replayed on attach, but attach before reproducing an issue to be sure nothing is missed. Only observes the page: it is not reloaded or modified. May be refused while Chrome DevTools (chrome://inspect) is attached to the same page; close it and retry. Calling it again for an attached page reuses the existing session.
target_id必填Read console output
Read buffered console messages, uncaught exceptions and browser log entries from an attached page. Requires attach first; only entries captured since attach (plus what attach replayed) are available. Returns the most recent matching entries. Pass since_seq from a previous call to get only new entries.
limitlevelskeywordsince_seqtarget_idexclude_keywordsEvaluate JavaScript in a page
Run a JavaScript expression in an attached page and return its result. Plain objects/arrays come back as JSON (so nested Map/Set/DOM values show as {}); other values (DOM nodes, Map, Set, Error, window) as a short description. Promises are awaited. For multiple statements or await, wrap them: (async () => { ... })(). Runs with the page's full privileges, so it can read cookies/storage and change page state.
target_idexpression必填Detach from a page
Disconnect from a page and discard its buffered console entries. The page itself keeps running and is not closed; call attach again to resume capturing. Use it to stop capturing or to start over with an empty buffer.
target_id已满足适用检查项的 90%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
Coding agent ──MCP (stdio)──▶ h5-devtools-mcp ──adb forward──▶ webview_devtools_remote_<pid> ──CDP──▶ WebView pageWebView.setWebContentsDebuggingEnabled(true);# Claude Codeclaude mcp add h5-devtools -- npx -y h5-devtools-mcpgit clone https://github.com/xianguoGou/h5-devtools-mcp.gitcd h5-devtools-mcpnpm install && npm run buildclaude mcp add h5-devtools -- node /absolute/path/to/h5-devtools-mcp/dist/index.js> list_targets- id: R5CT1234/webview_devtools_remote_8812/3A1F… app: com.example.app (pid 8812) on SM-S9180 title: "Order" url: https://m.example.com/order
> get_console { "levels": ["error"] }#41 10:32:01.123 [error exception] TypeError: Cannot read properties of undefined (reading 'price') at https://m.example.com/assets/index-8f2a.js:1:48213next since_seq: 57npm run buildCHROME=/path/to/chrome npm run test:e2e