metro_network
Capture network requests from a React Native app via Metro CDP debugger. Output as JSON or HAR for analysis, with auto-discovery and sensitive header redaction.
Instructions
Captures network requests from a React Native app via the Metro CDP debugger (Network domain). If webSocketDebuggerUrl is omitted, auto-discovers via metro_apps and uses the first connected app. Pairs requestWillBeSent with responseReceived by requestId (method, url, status, headers, timing). format:'har' emits a valid HAR 1.2 log (HAR-lite — no response bodies yet) you can open in Chrome DevTools → Import HAR; pass saveTo to write the .har file. Sensitive headers (authorization/cookie/…) are REDACTED by default — set redact:false to keep them (don't commit unredacted HAR: it leaks tokens).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| webSocketDebuggerUrl | No | CDP WebSocket URL from metro_apps. Omit to auto-discover. | |
| port | No | Metro port for auto-discovery (default 8081) | |
| durationMs | No | How long to capture network activity in milliseconds (default 3000) | |
| maxEntries | No | Maximum request entries to return (default 100, keeps most recent) | |
| format | No | Output format: 'json' (default, structured entries) or 'har' (HAR 1.2 log). | |
| saveTo | No | Optional file path to write the output (a .har file when format:'har'). | |
| redact | No | Mask sensitive headers (authorization/cookie/set-cookie/…). Default true. |