h5-devtools-mcp
v0.1.2Debug H5 pages inside Android app WebViews: console logs, exceptions, run JS.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
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.
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.
| Parameter | Type | Description |
|---|---|---|
target_id * | string | Target id from list_targets, e.g. "<serial>/<socket>/<page id>" |
get_console 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.
| Parameter | Type | Description |
|---|---|---|
exclude_keywords | array | Drop entries whose text or location contains any of these (case-insensitive), e.g. ["google-analytics", "doubleclick"] |
keyword | string | Case-insensitive substring match on message text and location |
levels | array | Only these levels, e.g. ["warn", "error"] |
limit | integer | Max entries to return (default 50) |
since_seq | integer | Only entries with seq greater than this |
target_id | string | Defaults to the most recently attached page |
evaluate_js Evaluate 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.
| Parameter | Type | Description |
|---|---|---|
expression * | string | JavaScript expression to evaluate |
target_id | string | Defaults to the most recently attached page |
detach 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.
| Parameter | Type | Description |
|---|---|---|
target_id | string | Defaults to the most recently attached page |