react-native-ai-debugger 1.1.4 → 1.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +12 -1
- package/README.md +45 -1239
- package/build/__tests__/unit/tap.test.js +4 -4
- package/build/__tests__/unit/tap.test.js.map +1 -1
- package/build/core/guides.d.ts.map +1 -1
- package/build/core/guides.js +22 -7
- package/build/core/guides.js.map +1 -1
- package/build/core/index.d.ts +1 -1
- package/build/core/index.d.ts.map +1 -1
- package/build/core/index.js +1 -1
- package/build/core/index.js.map +1 -1
- package/build/core/networkInterceptor.d.ts +3 -0
- package/build/core/networkInterceptor.d.ts.map +1 -0
- package/build/core/networkInterceptor.js +203 -0
- package/build/core/networkInterceptor.js.map +1 -0
- package/build/core/state.d.ts +1 -0
- package/build/core/state.d.ts.map +1 -1
- package/build/core/state.js +4 -0
- package/build/core/state.js.map +1 -1
- package/build/core/telemetry.d.ts +1 -1
- package/build/core/telemetry.d.ts.map +1 -1
- package/build/core/telemetry.js +3 -1
- package/build/core/telemetry.js.map +1 -1
- package/build/index.js +3 -3
- package/build/index.js.map +1 -1
- package/build/pro/tap.d.ts +91 -0
- package/build/pro/tap.d.ts.map +1 -0
- package/build/pro/tap.js +542 -0
- package/build/pro/tap.js.map +1 -0
- package/package.json +6 -5
package/README.md
CHANGED
|
@@ -1,1248 +1,54 @@
|
|
|
1
|
-
#
|
|
1
|
+
# ⚠️ react-native-ai-debugger has been renamed!
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> **CRITICAL NOTICE:** This package has been renamed to `react-native-ai-devtools`.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
**This repository and NPM package will no longer receive updates.**
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Please migrate to the new package and repository immediately.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
- **Network Request Tracking** - Monitor HTTP requests/responses with headers, timing, and body content
|
|
12
|
-
- **JavaScript Execution** - Run code directly in your app (REPL-style) and inspect results
|
|
13
|
-
- **Global State Debugging** - Discover and inspect Apollo Client, Redux stores, Expo Router, and custom globals
|
|
14
|
-
- **Bundle Error Detection** - Get Metro bundler errors and compilation issues with file locations
|
|
15
|
-
- **Debug Web Dashboard** - Browser-based UI for real-time log and network monitoring
|
|
9
|
+
* **New NPM Package:** [react-native-ai-devtools](https://www.npmjs.com/package/react-native-ai-devtools)
|
|
10
|
+
* **GitHub Repository:** [https://github.com/igorzheludkov/react-native-ai-devtools](https://github.com/igorzheludkov/react-native-ai-devtools)
|
|
16
11
|
|
|
17
|
-
|
|
12
|
+
## Migration Guide for Claude Code / Cursor
|
|
18
13
|
|
|
19
|
-
|
|
20
|
-
- **Android Devices** - Screenshots, app install/launch, package management (via ADB)
|
|
21
|
-
- **Unified Tap** - Single `tap` tool with automatic fallback chain: fiber tree → accessibility → OCR → coordinates. Auto-detects platform, accepts pixels from screenshots
|
|
22
|
-
- **UI Automation** - Swipe, long press, text input, and key events on both platforms
|
|
23
|
-
- **Accessibility Inspection** - Query UI hierarchy to find elements by text, label, or resource ID
|
|
24
|
-
- **OCR Text Extraction** - Extract visible text with tap-ready coordinates (works on any screen content)
|
|
14
|
+
You must update your local MCP configuration files to use the new package name.
|
|
25
15
|
|
|
26
|
-
###
|
|
27
|
-
|
|
28
|
-
- **Auto-Discovery** - Scans Metro on ports 8081, 8082, 19000-19002 automatically
|
|
29
|
-
- **Smart Device Selection** - Prioritizes Bridgeless > Hermes > standard React Native targets
|
|
30
|
-
- **Auto-Reconnection** - Exponential backoff (up to 8 attempts) when connection drops
|
|
31
|
-
- **Efficient Buffering** - Circular buffers: 500 logs, 200 network requests
|
|
32
|
-
- **Platform Support** - Expo SDK 54+ (Bridgeless) and React Native 0.70+ (Hermes)
|
|
33
|
-
|
|
34
|
-
## Claude Code Skills
|
|
35
|
-
|
|
36
|
-
This repository includes pre-built [Claude Code skills](https://docs.anthropic.com/en/docs/claude-code/skills) for common React Native debugging workflows. Skills let Claude handle multi-step tasks (session setup, log inspection, network debugging, etc.) with a single slash command instead of manual back-and-forth.
|
|
37
|
-
|
|
38
|
-
### Available Skills
|
|
39
|
-
|
|
40
|
-
| Skill | Description |
|
|
41
|
-
| ----- | ----------- |
|
|
42
|
-
| `session-setup` | Bootstrap a debugging session: discover devices, boot simulators, connect to Metro |
|
|
43
|
-
| `debug-logs` | Capture, filter, and analyze console logs to find errors and warnings |
|
|
44
|
-
| `network-inspect` | Monitor and inspect HTTP requests, filter by status/method, and analyze failures |
|
|
45
|
-
| `app-state` | Inspect Redux/Apollo/context state, navigate the app, and execute code in the runtime |
|
|
46
|
-
| `component-inspect` | Inspect React component tree, props, state, and layout |
|
|
47
|
-
| `layout-check` | Verify UI layout against design specs using screenshots and component data |
|
|
48
|
-
| `device-interact` | Automate device interaction: tap, swipe, text input, and element finding |
|
|
49
|
-
| `bundle-check` | Detect and diagnose Metro bundler errors and compilation failures |
|
|
50
|
-
| `native-rebuild` | Rebuild and verify the app after installing native Expo packages |
|
|
51
|
-
|
|
52
|
-
See [`skills/overview.md`](./skills/overview.md) for a decision guide on which skill to use and a recommended workflow.
|
|
53
|
-
|
|
54
|
-
### Installing Skills (Claude Code)
|
|
55
|
-
|
|
56
|
-
Copy the skill files into your project's `.claude/skills/` directory:
|
|
57
|
-
|
|
58
|
-
```bash
|
|
59
|
-
# Install all skills
|
|
60
|
-
mkdir -p .claude/skills
|
|
61
|
-
curl -s https://api.github.com/repos/igorzheludkov/react-native-ai-debugger/contents/skills \
|
|
62
|
-
| grep download_url \
|
|
63
|
-
| cut -d '"' -f 4 \
|
|
64
|
-
| xargs -I {} sh -c 'curl -sL {} -o .claude/skills/$(basename {})'
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
Or pick individual skills from the [`skills/`](./skills/) folder and drop them into `.claude/skills/`.
|
|
68
|
-
|
|
69
|
-
Then invoke in Claude Code:
|
|
70
|
-
|
|
71
|
-
```
|
|
72
|
-
/session-setup
|
|
73
|
-
/debug-logs
|
|
74
|
-
/network-inspect
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
Skills can also be triggered **automatically** — each skill file contains a "When to Trigger" section that tells Claude when to proactively invoke it without a slash command. For example, Claude will run `bundle-check` on its own when it detects a red screen, or `session-setup` when starting a fresh debugging task with no connection established yet.
|
|
78
|
-
|
|
79
|
-
## Requirements
|
|
80
|
-
|
|
81
|
-
- Node.js 18+
|
|
82
|
-
- React Native app running with Metro bundler
|
|
83
|
-
- **Optional for iOS UI automation**: [Facebook IDB](https://fbidb.io/) - `brew install idb-companion`
|
|
84
|
-
- **Optional for OCR**: Python 3.6+ (EasyOCR is installed automatically, see [OCR Setup](#ocr-text-extraction))
|
|
85
|
-
|
|
86
|
-
## Claude Code Setup
|
|
87
|
-
|
|
88
|
-
No installation required - Claude Code uses `npx` to run the latest version automatically.
|
|
89
|
-
|
|
90
|
-
### Global (all projects)
|
|
91
|
-
|
|
92
|
-
```bash
|
|
93
|
-
claude mcp add rn-debugger --scope user -- npx react-native-ai-debugger
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
### Project-specific
|
|
97
|
-
|
|
98
|
-
```bash
|
|
99
|
-
claude mcp add rn-debugger --scope project -- npx react-native-ai-debugger
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
### Manual Configuration
|
|
103
|
-
|
|
104
|
-
Add to `~/.claude.json` (user scope) or `.mcp.json` (project scope):
|
|
105
|
-
|
|
106
|
-
```json
|
|
107
|
-
{
|
|
108
|
-
"mcpServers": {
|
|
109
|
-
"rn-debugger": {
|
|
110
|
-
"type": "stdio",
|
|
111
|
-
"command": "npx",
|
|
112
|
-
"args": ["react-native-ai-debugger"]
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
Restart Claude Code after adding the configuration.
|
|
119
|
-
|
|
120
|
-
## VS Code Copilot Setup
|
|
121
|
-
|
|
122
|
-
Requires VS Code 1.102+ with Copilot ([docs](https://code.visualstudio.com/docs/copilot/customization/mcp-servers)).
|
|
123
|
-
|
|
124
|
-
**Via Command Palette**: `Cmd+Shift+P` → "MCP: Add Server"
|
|
125
|
-
|
|
126
|
-
**Manual config** - add to `.vscode/mcp.json`:
|
|
127
|
-
|
|
128
|
-
```json
|
|
129
|
-
{
|
|
130
|
-
"servers": {
|
|
131
|
-
"rn-debugger": {
|
|
132
|
-
"type": "stdio",
|
|
133
|
-
"command": "npx",
|
|
134
|
-
"args": ["-y", "react-native-ai-debugger"]
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
## Cursor Setup
|
|
141
|
-
|
|
142
|
-
[Docs](https://docs.cursor.com/context/model-context-protocol)
|
|
143
|
-
|
|
144
|
-
**Via Command Palette**: `Cmd+Shift+P` → "View: Open MCP Settings"
|
|
145
|
-
|
|
146
|
-
**Manual config** - add to `.cursor/mcp.json` (project) or `~/.cursor/mcp.json` (global):
|
|
147
|
-
|
|
148
|
-
```json
|
|
149
|
-
{
|
|
150
|
-
"mcpServers": {
|
|
151
|
-
"rn-debugger": {
|
|
152
|
-
"command": "npx",
|
|
153
|
-
"args": ["-y", "react-native-ai-debugger"]
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
## Available Tools
|
|
160
|
-
|
|
161
|
-
### Usage Guide
|
|
162
|
-
|
|
163
|
-
| Tool | Description |
|
|
164
|
-
| ----------------- | --------------------------------------------------------------------------- |
|
|
165
|
-
| `get_usage_guide` | Get recommended workflows for all tools. Call without params for overview, with a topic (`setup`, `inspect`, `layout`, `interact`, `logs`, `network`, `state`, `bundle`) for the full guide |
|
|
166
|
-
|
|
167
|
-
The server also sends instructions on connection, so MCP clients automatically learn about `get_usage_guide`.
|
|
168
|
-
|
|
169
|
-
### Connection & Logs
|
|
170
|
-
|
|
171
|
-
| Tool | Description |
|
|
172
|
-
| ----------------------- | ------------------------------------------------------------------ |
|
|
173
|
-
| `scan_metro` | Scan for Metro servers and auto-connect. **Call this first** to start debugging |
|
|
174
|
-
| `connect_metro` | Connect to a specific Metro port (use when you know the exact port) |
|
|
175
|
-
| `disconnect_metro` | Disconnect from all Metro servers. Frees the CDP slot for the built-in RN debugger. Reconnect with `scan_metro` |
|
|
176
|
-
| `get_apps` | List connected apps. Run `scan_metro` first if none connected |
|
|
177
|
-
| `get_connection_status` | Get detailed connection health, uptime, and recent disconnects |
|
|
178
|
-
| `ensure_connection` | Verify/establish connection with health checks |
|
|
179
|
-
| `get_logs` | Retrieve console logs (filtering, truncation, summary, TONL format) |
|
|
180
|
-
| `search_logs` | Search logs for specific text (truncation, TONL format) |
|
|
181
|
-
| `clear_logs` | Clear the log buffer |
|
|
182
|
-
|
|
183
|
-
### Network Tracking
|
|
184
|
-
|
|
185
|
-
| Tool | Description |
|
|
186
|
-
| ---------------------- | ---------------------------------------------------------- |
|
|
187
|
-
| `get_network_requests` | Retrieve network requests (filtering, summary, TONL format) |
|
|
188
|
-
| `search_network` | Search requests by URL pattern (TONL format) |
|
|
189
|
-
| `get_request_details` | Get full details of a request (headers, body with truncation) |
|
|
190
|
-
| `get_network_stats` | Get statistics: counts by method, status code, domain |
|
|
191
|
-
| `clear_network` | Clear the network request buffer |
|
|
192
|
-
|
|
193
|
-
### App Inspection & Execution
|
|
194
|
-
|
|
195
|
-
| Tool | Description |
|
|
196
|
-
| -------------------- | ------------------------------------------------------------------- |
|
|
197
|
-
| `execute_in_app` | Execute simple JS expressions using globals discovered via `list_debug_globals` |
|
|
198
|
-
| `list_debug_globals` | Discover available debug objects (Apollo, Redux, Expo Router, etc.) |
|
|
199
|
-
| `inspect_global` | Inspect a global object to see its properties and callable methods |
|
|
200
|
-
| `reload_app` | Reload the app (auto-connects if needed). Use sparingly - Fast Refresh handles most changes |
|
|
201
|
-
| `get_debug_server` | Get the debug HTTP server URL for browser-based viewing |
|
|
202
|
-
| `restart_http_server` | Restart the debug HTTP server |
|
|
203
|
-
|
|
204
|
-
### Bundle Tools
|
|
205
|
-
|
|
206
|
-
| Tool | Description |
|
|
207
|
-
| -------------------- | ------------------------------------------------------------------- |
|
|
208
|
-
| `get_bundle_status` | Get Metro bundler status and build state |
|
|
209
|
-
| `get_bundle_errors` | Get compilation errors with file locations |
|
|
210
|
-
| `clear_bundle_errors` | Clear the bundle error buffer |
|
|
211
|
-
|
|
212
|
-
### React Component Inspection
|
|
213
|
-
|
|
214
|
-
**Recommended Workflow**: Use `get_component_tree(focusedOnly=true, structureOnly=true)` for a token-efficient overview of just the active screen (~1-3KB), then drill down with `inspect_component` or `find_components`.
|
|
215
|
-
|
|
216
|
-
| Tool | Description |
|
|
217
|
-
| -------------------- | ------------------------------------------------------------------- |
|
|
218
|
-
| `get_component_tree` | **Start here** with `focusedOnly=true, structureOnly=true` for active screen overview |
|
|
219
|
-
| `inspect_component` | **Drill-down tool**: Inspect specific component's props, state/hooks, children |
|
|
220
|
-
| `find_components` | **Targeted search**: Find components by pattern with optional layout info |
|
|
221
|
-
| `get_screen_layout` | Full layout data - use sparingly, can be large for complex screens |
|
|
222
|
-
|
|
223
|
-
### Element Inspector (Coordinate-Based)
|
|
224
|
-
|
|
225
|
-
Inspect React components at specific screen coordinates - like React Native's built-in Element Inspector, but programmatically.
|
|
226
|
-
|
|
227
|
-
| Tool | Description |
|
|
228
|
-
| -------------------------- | ------------------------------------------------------------------------------ |
|
|
229
|
-
| `get_inspector_selection` | **Main tool**: Get React component at coordinates. Auto-enables inspector and taps if x/y provided |
|
|
230
|
-
| `toggle_element_inspector` | Manually toggle the Element Inspector overlay on/off |
|
|
231
|
-
| `inspect_at_point` | Inspect React component at (x,y) coordinates |
|
|
232
|
-
|
|
233
|
-
**Quick Inspection (Recommended)**:
|
|
234
|
-
```
|
|
235
|
-
# Single call - auto-enables inspector, taps, returns component info
|
|
236
|
-
get_inspector_selection(x=210, y=400)
|
|
237
|
-
```
|
|
238
|
-
|
|
239
|
-
Returns:
|
|
240
|
-
```
|
|
241
|
-
Element: FastImageView
|
|
242
|
-
Path: App > RootNavigation > ... > PlayerModal > FastImage > FastImageView
|
|
243
|
-
Frame: (62.3, 130.0) 295.67x295.67
|
|
244
|
-
Style: { borderRadius: 15, overflow: "hidden" }
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
**Manual Flow** (for more control):
|
|
248
|
-
```
|
|
249
|
-
# 1. Enable the inspector overlay
|
|
250
|
-
toggle_element_inspector()
|
|
251
|
-
|
|
252
|
-
# 2. Tap to select element
|
|
253
|
-
tap with x=630 y=1200 # pixel coordinates from screenshot
|
|
254
|
-
|
|
255
|
-
# 3. Read the selection
|
|
256
|
-
get_inspector_selection()
|
|
257
|
-
|
|
258
|
-
# 4. Disable overlay when done
|
|
259
|
-
toggle_element_inspector()
|
|
260
|
-
```
|
|
261
|
-
|
|
262
|
-
**Token Efficiency**: Returns ~0.2-0.5KB vs 15-25KB for full component tree. Works on all React Native versions including Fabric/New Architecture.
|
|
263
|
-
|
|
264
|
-
### UI Interaction (Cross-Platform)
|
|
265
|
-
|
|
266
|
-
| Tool | Description |
|
|
267
|
-
| ---------------- | ------------------------------------------------------------------------ |
|
|
268
|
-
| `tap` | **Unified tap** — auto-detects platform, tries fiber tree → accessibility → OCR → coordinates. Accepts text, testID, component name, or pixel coordinates from screenshots |
|
|
269
|
-
| `ocr_screenshot` | Extract all visible text with tap-ready coordinates (works on iOS/Android) |
|
|
270
|
-
|
|
271
|
-
**Examples:**
|
|
272
|
-
```
|
|
273
|
-
tap with text="Submit" # Finds and taps by visible text
|
|
274
|
-
tap with testID="login-btn" # Finds by testID prop
|
|
275
|
-
tap with component="HamburgerIcon" # Finds by React component name
|
|
276
|
-
tap with x=300 y=600 # Taps at pixel coordinates (auto-converts)
|
|
277
|
-
tap with text="Menu" strategy="ocr" # Forces OCR strategy only
|
|
278
|
-
```
|
|
279
|
-
|
|
280
|
-
### Android (ADB)
|
|
281
|
-
|
|
282
|
-
| Tool | Description |
|
|
283
|
-
| --------------------------- | ------------------------------------------------------------- |
|
|
284
|
-
| `list_android_devices` | List connected Android devices and emulators via ADB |
|
|
285
|
-
| `android_screenshot` | Take a screenshot from an Android device/emulator |
|
|
286
|
-
| `android_install_app` | Install an APK on an Android device/emulator |
|
|
287
|
-
| `android_launch_app` | Launch an app by package name |
|
|
288
|
-
| `android_list_packages` | List installed packages (with optional filter) |
|
|
289
|
-
| `android_long_press` | Long press at specific coordinates |
|
|
290
|
-
| `android_swipe` | Swipe from one point to another |
|
|
291
|
-
| `android_input_text` | Type text at current focus point |
|
|
292
|
-
| `android_key_event` | Send key events (HOME, BACK, ENTER, etc.) |
|
|
293
|
-
| `android_get_screen_size` | Get device screen resolution |
|
|
294
|
-
| `android_describe_all` | Get full UI accessibility tree via uiautomator |
|
|
295
|
-
| `android_describe_point` | Get UI element info at specific coordinates |
|
|
296
|
-
| `android_find_element` | Find element by text/contentDesc/resourceId (no screenshot) |
|
|
297
|
-
| `android_wait_for_element` | Wait for element to appear (useful for screen transitions) |
|
|
298
|
-
|
|
299
|
-
### iOS (Simulator)
|
|
300
|
-
|
|
301
|
-
| Tool | Description |
|
|
302
|
-
| ----------------------- | --------------------------------------------------------------- |
|
|
303
|
-
| `list_ios_simulators` | List available iOS simulators |
|
|
304
|
-
| `ios_screenshot` | Take a screenshot from an iOS simulator |
|
|
305
|
-
| `ios_install_app` | Install an app bundle (.app) on a simulator |
|
|
306
|
-
| `ios_launch_app` | Launch an app by bundle ID |
|
|
307
|
-
| `ios_open_url` | Open a URL (deep links or web URLs) |
|
|
308
|
-
| `ios_terminate_app` | Terminate a running app |
|
|
309
|
-
| `ios_boot_simulator` | Boot a simulator by UDID |
|
|
310
|
-
| `ios_swipe` | Swipe gesture (requires IDB) |
|
|
311
|
-
| `ios_input_text` | Type text into active field (requires IDB) |
|
|
312
|
-
| `ios_button` | Press hardware button: HOME, LOCK, SIRI (requires IDB) |
|
|
313
|
-
| `ios_key_event` | Send key event by keycode (requires IDB) |
|
|
314
|
-
| `ios_key_sequence` | Send sequence of key events (requires IDB) |
|
|
315
|
-
| `ios_describe_all` | Get full accessibility tree (requires IDB) |
|
|
316
|
-
| `ios_describe_point` | Get element at point (requires IDB) |
|
|
317
|
-
| `ios_find_element` | Find element by label/value (requires IDB, no screenshot) |
|
|
318
|
-
| `ios_wait_for_element` | Wait for element to appear (requires IDB) |
|
|
319
|
-
|
|
320
|
-
## Usage
|
|
321
|
-
|
|
322
|
-
1. Start your React Native app:
|
|
323
|
-
|
|
324
|
-
```bash
|
|
325
|
-
npm start
|
|
326
|
-
# or
|
|
327
|
-
expo start
|
|
328
|
-
```
|
|
329
|
-
|
|
330
|
-
2. In Claude Code, scan for Metro:
|
|
331
|
-
|
|
332
|
-
```
|
|
333
|
-
Use scan_metro to find and connect to Metro
|
|
334
|
-
```
|
|
335
|
-
|
|
336
|
-
3. Get logs:
|
|
337
|
-
```
|
|
338
|
-
Use get_logs to see recent console output
|
|
339
|
-
```
|
|
340
|
-
|
|
341
|
-
### `get_logs` Tool Reference
|
|
342
|
-
|
|
343
|
-
The `get_logs` tool has multiple parameters for controlling output size and format. Here's the complete reference:
|
|
344
|
-
|
|
345
|
-
| Parameter | Type | Default | Description |
|
|
346
|
-
|-----------|------|---------|-------------|
|
|
347
|
-
| `maxLogs` | number | 50 | Maximum number of logs to return |
|
|
348
|
-
| `level` | string | "all" | Filter by level: `all`, `log`, `warn`, `error`, `info`, `debug` |
|
|
349
|
-
| `startFromText` | string | - | Start from the last log containing this text |
|
|
350
|
-
| `maxMessageLength` | number | 500 | Max chars per message (0 = unlimited) |
|
|
351
|
-
| `verbose` | boolean | false | Disable all truncation, return full messages |
|
|
352
|
-
| `format` | string | "text" | Output format: `text` or `tonl` (30-50% smaller) |
|
|
353
|
-
| `summary` | boolean | false | Return counts + last 5 messages only |
|
|
354
|
-
|
|
355
|
-
#### Recommended Usage Patterns
|
|
356
|
-
|
|
357
|
-
```
|
|
358
|
-
# Quick overview (always start here)
|
|
359
|
-
get_logs with summary=true
|
|
360
|
-
|
|
361
|
-
# Recent errors only
|
|
362
|
-
get_logs with level="error" maxLogs=20
|
|
363
|
-
|
|
364
|
-
# Logs since last app reload
|
|
365
|
-
get_logs with startFromText="Running app" maxLogs=100
|
|
366
|
-
|
|
367
|
-
# Full messages for debugging specific issues
|
|
368
|
-
get_logs with maxLogs=10 verbose=true
|
|
369
|
-
|
|
370
|
-
# Token-efficient format for large outputs
|
|
371
|
-
get_logs with format="tonl" maxLogs=100
|
|
372
|
-
|
|
373
|
-
# Compact overview with shorter messages
|
|
374
|
-
get_logs with maxMessageLength=200 maxLogs=50
|
|
375
|
-
```
|
|
376
|
-
|
|
377
|
-
### Filtering Logs
|
|
378
|
-
|
|
379
|
-
```
|
|
380
|
-
get_logs with maxLogs=20 and level="error"
|
|
381
|
-
```
|
|
382
|
-
|
|
383
|
-
Available levels: `all`, `log`, `warn`, `error`, `info`, `debug`
|
|
384
|
-
|
|
385
|
-
### Start from Specific Line
|
|
386
|
-
|
|
387
|
-
```
|
|
388
|
-
get_logs with startFromText="iOS Bundled" and maxLogs=100
|
|
389
|
-
```
|
|
390
|
-
|
|
391
|
-
This finds the **last** (most recent) line containing the text and returns logs from that point forward. Useful for getting logs since the last app reload.
|
|
392
|
-
|
|
393
|
-
### Search Logs
|
|
394
|
-
|
|
395
|
-
```
|
|
396
|
-
search_logs with text="error" and maxResults=20
|
|
397
|
-
```
|
|
398
|
-
|
|
399
|
-
Case-insensitive search across all log messages.
|
|
400
|
-
|
|
401
|
-
### Token-Optimized Output
|
|
402
|
-
|
|
403
|
-
The tools include several options to reduce token usage when working with AI assistants.
|
|
404
|
-
|
|
405
|
-
#### Summary Mode (Recommended First Step)
|
|
406
|
-
|
|
407
|
-
**Always start with `summary=true`** - it gives you the full picture in ~10-20 tokens instead of potentially thousands:
|
|
408
|
-
|
|
409
|
-
```
|
|
410
|
-
get_logs with summary=true
|
|
411
|
-
```
|
|
412
|
-
|
|
413
|
-
Returns:
|
|
414
|
-
- **Total count** - How many logs are in the buffer
|
|
415
|
-
- **Breakdown by level** - See if there are errors/warnings at a glance
|
|
416
|
-
- **Last 5 messages** - Most recent activity (truncated to 100 chars each)
|
|
417
|
-
|
|
418
|
-
Example output:
|
|
419
|
-
|
|
420
|
-
```
|
|
421
|
-
Total: 847 logs
|
|
422
|
-
|
|
423
|
-
By Level:
|
|
424
|
-
LOG: 612
|
|
425
|
-
WARN: 180
|
|
426
|
-
ERROR: 55
|
|
427
|
-
|
|
428
|
-
Last 5 messages:
|
|
429
|
-
14:32:45 [LOG] User clicked button...
|
|
430
|
-
14:32:46 [WARN] Slow query detected...
|
|
431
|
-
14:32:47 [ERROR] Network request failed...
|
|
432
|
-
```
|
|
433
|
-
|
|
434
|
-
#### Why Summary First?
|
|
435
|
-
|
|
436
|
-
| Approach | Tokens | Use Case |
|
|
437
|
-
|----------|--------|----------|
|
|
438
|
-
| `summary=true` | ~20-50 | Quick health check, see if errors exist |
|
|
439
|
-
| `level="error"` | ~100-500 | Investigate specific errors |
|
|
440
|
-
| `maxLogs=50` (default) | ~500-2000 | General debugging |
|
|
441
|
-
| `verbose=true` | ~2000-10000+ | Deep dive into specific data |
|
|
442
|
-
|
|
443
|
-
**Recommended workflow:**
|
|
444
|
-
1. `summary=true` → See the big picture
|
|
445
|
-
2. `level="error"` or `level="warn"` → Focus on problems
|
|
446
|
-
3. `startFromText="..."` → Get logs since specific event
|
|
447
|
-
4. `verbose=true` with low `maxLogs` → Full details when needed
|
|
448
|
-
|
|
449
|
-
#### Message Truncation
|
|
450
|
-
|
|
451
|
-
Long log messages are truncated by default (500 chars). Adjust as needed:
|
|
452
|
-
|
|
453
|
-
```
|
|
454
|
-
# Shorter for overview
|
|
455
|
-
get_logs with maxMessageLength=200
|
|
456
|
-
|
|
457
|
-
# Full messages (use with lower maxLogs)
|
|
458
|
-
get_logs with maxLogs=10 verbose=true
|
|
459
|
-
|
|
460
|
-
# Unlimited
|
|
461
|
-
get_logs with maxMessageLength=0
|
|
462
|
-
```
|
|
463
|
-
|
|
464
|
-
#### TONL Format
|
|
465
|
-
|
|
466
|
-
Use TONL (Token-Optimized Notation Language) for ~30-50% smaller output:
|
|
467
|
-
|
|
468
|
-
```
|
|
469
|
-
get_logs with format="tonl"
|
|
470
|
-
```
|
|
471
|
-
|
|
472
|
-
Output:
|
|
473
|
-
|
|
474
|
-
```
|
|
475
|
-
[Format: TONL - compact token-optimized format. Fields in header, values in rows.]
|
|
476
|
-
{logs:[{time:"14:32:45",level:"LOG",msg:"App started"},{time:"14:32:46",level:"WARN",msg:"Slow query"}]}
|
|
477
|
-
```
|
|
478
|
-
|
|
479
|
-
TONL is also available for `search_logs`, `get_network_requests`, and `search_network`.
|
|
480
|
-
|
|
481
|
-
## Network Tracking
|
|
482
|
-
|
|
483
|
-
### View Recent Requests
|
|
484
|
-
|
|
485
|
-
```
|
|
486
|
-
get_network_requests with maxRequests=20
|
|
487
|
-
```
|
|
488
|
-
|
|
489
|
-
### Filter by Method
|
|
490
|
-
|
|
491
|
-
```
|
|
492
|
-
get_network_requests with method="POST"
|
|
493
|
-
```
|
|
494
|
-
|
|
495
|
-
### Filter by Status Code
|
|
496
|
-
|
|
497
|
-
Useful for debugging auth issues:
|
|
498
|
-
|
|
499
|
-
```
|
|
500
|
-
get_network_requests with status=401
|
|
501
|
-
```
|
|
502
|
-
|
|
503
|
-
### Search by URL
|
|
504
|
-
|
|
505
|
-
```
|
|
506
|
-
search_network with urlPattern="api/auth"
|
|
507
|
-
```
|
|
508
|
-
|
|
509
|
-
### Get Full Request Details
|
|
510
|
-
|
|
511
|
-
After finding a request ID from `get_network_requests`:
|
|
512
|
-
|
|
513
|
-
```
|
|
514
|
-
get_request_details with requestId="123.45"
|
|
515
|
-
```
|
|
516
|
-
|
|
517
|
-
Shows full headers, request body, response headers, and timing.
|
|
518
|
-
|
|
519
|
-
Request body is truncated by default (500 chars). For full body:
|
|
520
|
-
|
|
521
|
-
```
|
|
522
|
-
get_request_details with requestId="123.45" verbose=true
|
|
523
|
-
```
|
|
524
|
-
|
|
525
|
-
### Summary Mode (Recommended First Step)
|
|
526
|
-
|
|
527
|
-
Get statistics overview before fetching full requests:
|
|
528
|
-
|
|
529
|
-
```
|
|
530
|
-
get_network_requests with summary=true
|
|
531
|
-
```
|
|
532
|
-
|
|
533
|
-
This returns the same output as `get_network_stats` - counts by method, status, and domain.
|
|
534
|
-
|
|
535
|
-
### TONL Format
|
|
536
|
-
|
|
537
|
-
Use TONL for ~30-50% smaller output:
|
|
538
|
-
|
|
539
|
-
```
|
|
540
|
-
get_network_requests with format="tonl"
|
|
541
|
-
```
|
|
542
|
-
|
|
543
|
-
### View Statistics
|
|
544
|
-
|
|
545
|
-
```
|
|
546
|
-
get_network_stats
|
|
547
|
-
```
|
|
548
|
-
|
|
549
|
-
Example output:
|
|
550
|
-
|
|
551
|
-
```
|
|
552
|
-
Total requests: 47
|
|
553
|
-
Completed: 45
|
|
554
|
-
Errors: 2
|
|
555
|
-
Avg duration: 234ms
|
|
556
|
-
|
|
557
|
-
By Method:
|
|
558
|
-
GET: 32
|
|
559
|
-
POST: 15
|
|
560
|
-
|
|
561
|
-
By Status:
|
|
562
|
-
2xx: 43
|
|
563
|
-
4xx: 2
|
|
564
|
-
|
|
565
|
-
By Domain:
|
|
566
|
-
api.example.com: 40
|
|
567
|
-
cdn.example.com: 7
|
|
568
|
-
```
|
|
569
|
-
|
|
570
|
-
## Debug Web Dashboard
|
|
571
|
-
|
|
572
|
-
The MCP server includes a built-in web dashboard for viewing logs and network requests in your browser. This is useful for real-time monitoring without using MCP tools.
|
|
573
|
-
|
|
574
|
-
### Getting the Dashboard URL
|
|
575
|
-
|
|
576
|
-
Use the `get_debug_server` tool to find the dashboard URL:
|
|
577
|
-
|
|
578
|
-
```
|
|
579
|
-
get_debug_server
|
|
580
|
-
```
|
|
581
|
-
|
|
582
|
-
The server automatically finds an available port starting from 3456. Each MCP instance gets its own port, so multiple Claude Code sessions can run simultaneously.
|
|
583
|
-
|
|
584
|
-
### Available Pages
|
|
585
|
-
|
|
586
|
-
| URL | Description |
|
|
587
|
-
| ---------- | ---------------------------------------------- |
|
|
588
|
-
| `/` | Dashboard with overview stats |
|
|
589
|
-
| `/logs` | Console logs with color-coded levels |
|
|
590
|
-
| `/network` | Network requests with expandable details |
|
|
591
|
-
| `/apps` | Connected React Native apps |
|
|
592
|
-
|
|
593
|
-
### Features
|
|
594
|
-
|
|
595
|
-
- **Auto-refresh** - Pages update automatically every 3 seconds
|
|
596
|
-
- **Color-coded logs** - Errors (red), warnings (yellow), info (blue), debug (gray)
|
|
597
|
-
- **Expandable network requests** - Click any request to see full details:
|
|
598
|
-
- Request/response headers
|
|
599
|
-
- Request body (with JSON formatting)
|
|
600
|
-
- Timing information
|
|
601
|
-
- Error details
|
|
602
|
-
- **GraphQL support** - Shows operation name and variables in compact view:
|
|
603
|
-
```
|
|
604
|
-
POST 200 https://api.example.com/graphql 1ms ▶
|
|
605
|
-
GetMeetingsBasic (timeFilter: "Future", first: 20)
|
|
606
|
-
```
|
|
607
|
-
- **REST body preview** - Shows JSON body preview for non-GraphQL requests
|
|
608
|
-
|
|
609
|
-
### JSON API Endpoints
|
|
610
|
-
|
|
611
|
-
For programmatic access, JSON endpoints are also available:
|
|
612
|
-
|
|
613
|
-
| URL | Description |
|
|
614
|
-
| -------------------- | ----------------------------- |
|
|
615
|
-
| `/api/status` | Server status and buffer sizes |
|
|
616
|
-
| `/api/logs` | All logs as JSON |
|
|
617
|
-
| `/api/network` | All network requests as JSON |
|
|
618
|
-
| `/api/bundle-errors` | Metro bundle errors as JSON |
|
|
619
|
-
| `/api/apps` | Connected apps as JSON |
|
|
620
|
-
|
|
621
|
-
## App Inspection
|
|
622
|
-
|
|
623
|
-
### Discover Debug Globals
|
|
624
|
-
|
|
625
|
-
Find what debugging objects are available in your app:
|
|
626
|
-
|
|
627
|
-
```
|
|
628
|
-
list_debug_globals
|
|
629
|
-
```
|
|
630
|
-
|
|
631
|
-
Example output:
|
|
632
|
-
|
|
633
|
-
```json
|
|
634
|
-
{
|
|
635
|
-
"Apollo Client": ["__APOLLO_CLIENT__"],
|
|
636
|
-
"Redux": ["__REDUX_STORE__"],
|
|
637
|
-
"Expo": ["__EXPO_ROUTER__"],
|
|
638
|
-
"Reanimated": ["__reanimatedModuleProxy"]
|
|
639
|
-
}
|
|
640
|
-
```
|
|
641
|
-
|
|
642
|
-
### Inspect an Object
|
|
643
|
-
|
|
644
|
-
Before calling methods on an unfamiliar object, inspect it to see what's callable:
|
|
645
|
-
|
|
646
|
-
```
|
|
647
|
-
inspect_global with objectName="__EXPO_ROUTER__"
|
|
648
|
-
```
|
|
649
|
-
|
|
650
|
-
Example output:
|
|
651
|
-
|
|
652
|
-
```json
|
|
653
|
-
{
|
|
654
|
-
"navigate": { "type": "function", "callable": true },
|
|
655
|
-
"push": { "type": "function", "callable": true },
|
|
656
|
-
"currentPath": { "type": "string", "callable": false, "value": "/" },
|
|
657
|
-
"routes": { "type": "array", "callable": false }
|
|
658
|
-
}
|
|
659
|
-
```
|
|
660
|
-
|
|
661
|
-
### Execute Code in App
|
|
662
|
-
|
|
663
|
-
Run simple JavaScript expressions using globals discovered via `list_debug_globals`:
|
|
664
|
-
|
|
665
|
-
```
|
|
666
|
-
execute_in_app with expression="__DEV__"
|
|
667
|
-
// Returns: true
|
|
668
|
-
|
|
669
|
-
execute_in_app with expression="__APOLLO_CLIENT__.cache.extract()"
|
|
670
|
-
// Returns: Full Apollo cache contents
|
|
671
|
-
|
|
672
|
-
execute_in_app with expression="__EXPO_ROUTER__.navigate('/settings')"
|
|
673
|
-
// Navigates the app to /settings
|
|
674
|
-
```
|
|
675
|
-
|
|
676
|
-
**Limitations (Hermes engine):**
|
|
677
|
-
- No `require()` or `import` — only pre-existing globals are available
|
|
678
|
-
- No `async/await` syntax — use simple expressions or promise chains (`.then()`)
|
|
679
|
-
- No emoji or non-ASCII characters in string literals — causes parse errors
|
|
680
|
-
- Keep expressions simple and synchronous when possible
|
|
681
|
-
|
|
682
|
-
## React Component Inspection
|
|
683
|
-
|
|
684
|
-
Inspect React components at runtime via the React DevTools hook. These tools let you debug component state, verify layouts, and understand app structure without adding console.logs.
|
|
685
|
-
|
|
686
|
-
### Recommended Workflow (Token-Efficient)
|
|
687
|
-
|
|
688
|
-
**Always use the 2-step approach:**
|
|
689
|
-
|
|
690
|
-
1. **Step 1: Get focused screen overview** (~1-3KB)
|
|
691
|
-
```
|
|
692
|
-
get_component_tree with focusedOnly=true structureOnly=true
|
|
693
|
-
```
|
|
694
|
-
|
|
695
|
-
2. **Step 2: Drill down** into specific components as needed
|
|
696
|
-
```
|
|
697
|
-
inspect_component with componentName="HomeScreen"
|
|
698
|
-
# or
|
|
699
|
-
find_components with pattern="Button" includeLayout=true
|
|
700
|
-
```
|
|
701
|
-
|
|
702
|
-
This approach uses **~10-20x fewer tokens** than getting full details upfront.
|
|
703
|
-
|
|
704
|
-
### Token Consumption Comparison
|
|
705
|
-
|
|
706
|
-
| Approach | Tokens | Use Case |
|
|
707
|
-
|----------|--------|----------|
|
|
708
|
-
| `focusedOnly=true, structureOnly=true` | ~1-3KB | **Recommended** - active screen structure only |
|
|
709
|
-
| `structureOnly=true` | ~15-25KB | Full tree structure (includes navigation, overlays) |
|
|
710
|
-
| `inspect_component` | ~1-2KB | Deep dive into specific component |
|
|
711
|
-
| `find_components` | ~2-5KB | Targeted search with layout |
|
|
712
|
-
| `get_screen_layout` | ~20-50KB+ | Full layout (use sparingly) |
|
|
713
|
-
|
|
714
|
-
### Focused Screen Mode (`focusedOnly`)
|
|
715
|
-
|
|
716
|
-
The `focusedOnly` parameter dramatically reduces output by returning only the active screen subtree:
|
|
717
|
-
|
|
718
|
-
- **Skips navigation wrappers** - Providers, NavigationContainers, SafeAreaProviders
|
|
719
|
-
- **Skips global overlays** - BottomSheet, Modal, Toast, Snackbar components
|
|
720
|
-
- **Returns just the focused screen** - Components matching `*Screen` or `*Page` pattern
|
|
721
|
-
|
|
722
|
-
```
|
|
723
|
-
get_component_tree with focusedOnly=true structureOnly=true
|
|
724
|
-
```
|
|
725
|
-
|
|
726
|
-
Output:
|
|
727
|
-
|
|
728
|
-
```
|
|
729
|
-
Focused: HomeScreen
|
|
730
|
-
|
|
731
|
-
HomeScreen
|
|
732
|
-
Header
|
|
733
|
-
Logo
|
|
734
|
-
SearchBar
|
|
735
|
-
FlatList
|
|
736
|
-
ListItem (×12)
|
|
737
|
-
Footer
|
|
738
|
-
```
|
|
739
|
-
|
|
740
|
-
**When to skip `focusedOnly`:**
|
|
741
|
-
- Debugging navigation structure itself
|
|
742
|
-
- Investigating which screens are mounted
|
|
743
|
-
- Checking global overlay state
|
|
744
|
-
|
|
745
|
-
### Inspecting Overlays (BottomSheet, Modal, Toast)
|
|
746
|
-
|
|
747
|
-
Since `focusedOnly` skips global overlays by design, use this workflow to debug them:
|
|
748
|
-
|
|
749
|
-
1. **Find the overlay component:**
|
|
750
|
-
```
|
|
751
|
-
find_components with pattern="BottomSheet|Modal|Toast"
|
|
752
|
-
```
|
|
753
|
-
|
|
754
|
-
2. **Inspect its state/props:**
|
|
755
|
-
```
|
|
756
|
-
inspect_component with componentName="MyBottomSheet"
|
|
757
|
-
```
|
|
758
|
-
|
|
759
|
-
This targeted approach uses ~2-4KB vs ~20KB+ for the full tree.
|
|
760
|
-
|
|
761
|
-
### Step 1: Get Component Tree
|
|
762
|
-
|
|
763
|
-
View the React component hierarchy with minimal data:
|
|
764
|
-
|
|
765
|
-
```
|
|
766
|
-
# Focused screen only (recommended)
|
|
767
|
-
get_component_tree with focusedOnly=true structureOnly=true
|
|
768
|
-
|
|
769
|
-
# Full tree structure
|
|
770
|
-
get_component_tree with structureOnly=true
|
|
771
|
-
```
|
|
772
|
-
|
|
773
|
-
Output (ultra-compact):
|
|
774
|
-
|
|
775
|
-
```
|
|
776
|
-
Focused: HomeScreen
|
|
777
|
-
|
|
778
|
-
HomeScreen
|
|
779
|
-
Header
|
|
780
|
-
FlatList
|
|
781
|
-
Footer
|
|
782
|
-
```
|
|
783
|
-
|
|
784
|
-
This gives you the focused screen structure in just 1-3KB.
|
|
785
|
-
|
|
786
|
-
### Step 2a: Inspect Specific Component
|
|
787
|
-
|
|
788
|
-
After identifying a component in the structure, drill down:
|
|
789
|
-
|
|
790
|
-
```
|
|
791
|
-
inspect_component with componentName="HomeScreen"
|
|
792
|
-
```
|
|
793
|
-
|
|
794
|
-
Output:
|
|
795
|
-
|
|
796
|
-
```json
|
|
797
|
-
{
|
|
798
|
-
"component": "HomeScreen",
|
|
799
|
-
"path": "... > Navigator > HomeScreen",
|
|
800
|
-
"props": {
|
|
801
|
-
"navigation": "[Object]",
|
|
802
|
-
"route": { "name": "Home", "key": "home-xyz" }
|
|
803
|
-
},
|
|
804
|
-
"hooks": [
|
|
805
|
-
{ "hookIndex": 0, "value": false },
|
|
806
|
-
{ "hookIndex": 3, "value": 42 }
|
|
807
|
-
]
|
|
808
|
-
}
|
|
809
|
-
```
|
|
810
|
-
|
|
811
|
-
Options:
|
|
812
|
-
- `includeChildren=true` - Include children tree
|
|
813
|
-
- `childrenDepth=2` - How deep to show children (1=direct only, 2+=nested tree)
|
|
814
|
-
- `includeState=false` - Skip hooks/state (faster)
|
|
815
|
-
- `index=1` - Inspect 2nd instance if multiple exist
|
|
816
|
-
|
|
817
|
-
### Step 2b: Find Components by Pattern
|
|
818
|
-
|
|
819
|
-
Search for components and optionally get their layout:
|
|
820
|
-
|
|
821
|
-
```
|
|
822
|
-
find_components with pattern="Screen$" includeLayout=true
|
|
823
|
-
```
|
|
824
|
-
|
|
825
|
-
Output:
|
|
826
|
-
|
|
827
|
-
```
|
|
828
|
-
pattern: Screen$
|
|
829
|
-
found: 5
|
|
830
|
-
#found{component,path,depth,key,layout}
|
|
831
|
-
HomeScreen|... > Navigator > HomeScreen|45|paddingHorizontal:16|
|
|
832
|
-
SettingsScreen|... > Navigator > SettingsScreen|45|flex:1|
|
|
833
|
-
```
|
|
834
|
-
|
|
835
|
-
Options:
|
|
836
|
-
- `includeLayout=true` - Include flex, padding, margin values
|
|
837
|
-
- `summary=true` - Get counts only (e.g., "HomeScreen: 1")
|
|
838
|
-
- `maxResults=10` - Limit number of results
|
|
839
|
-
|
|
840
|
-
### Full Layout (Use Sparingly)
|
|
841
|
-
|
|
842
|
-
For detailed layout of all visible components:
|
|
843
|
-
|
|
844
|
-
```
|
|
845
|
-
get_screen_layout
|
|
846
|
-
```
|
|
847
|
-
|
|
848
|
-
**Warning**: This returns ~20-50KB for complex screens. Use `find_components` with `includeLayout=true` instead for targeted queries.
|
|
849
|
-
|
|
850
|
-
### Use Cases
|
|
851
|
-
|
|
852
|
-
**Figma Alignment / Layout Verification**
|
|
853
|
-
```
|
|
854
|
-
# Step 1: See focused screen structure
|
|
855
|
-
get_component_tree with focusedOnly=true structureOnly=true
|
|
856
|
-
|
|
857
|
-
# Step 2: Get layout for specific components
|
|
858
|
-
find_components with pattern="Header|Footer|Button" includeLayout=true
|
|
859
|
-
```
|
|
860
|
-
|
|
861
|
-
**Debug State Changes**
|
|
862
|
-
```
|
|
863
|
-
# Check hook values before action
|
|
864
|
-
inspect_component with componentName="LoginForm"
|
|
865
|
-
# → hookIndex 2: false (isLoading)
|
|
866
|
-
|
|
867
|
-
# After user action, check again
|
|
868
|
-
inspect_component with componentName="LoginForm"
|
|
869
|
-
# → hookIndex 2: true (isLoading changed!)
|
|
870
|
-
```
|
|
871
|
-
|
|
872
|
-
**Debug Navigation Issues**
|
|
873
|
-
```
|
|
874
|
-
# Find which screen is currently mounted (use full tree)
|
|
875
|
-
get_component_tree with structureOnly=true
|
|
876
|
-
# or
|
|
877
|
-
find_components with pattern="Screen$"
|
|
878
|
-
|
|
879
|
-
# Check if a screen rendered multiple times (memory leak)
|
|
880
|
-
find_components with pattern="HomeScreen" summary=true
|
|
881
|
-
```
|
|
882
|
-
|
|
883
|
-
**Debug Overlays (BottomSheet, Modal, Toast)**
|
|
884
|
-
```
|
|
885
|
-
# Find and inspect overlay components
|
|
886
|
-
find_components with pattern="BottomSheet|Modal"
|
|
887
|
-
|
|
888
|
-
# Get overlay props/state
|
|
889
|
-
inspect_component with componentName="PaywallModal"
|
|
890
|
-
```
|
|
891
|
-
|
|
892
|
-
**Understand Unfamiliar Codebase**
|
|
893
|
-
```
|
|
894
|
-
# Quick focused screen overview
|
|
895
|
-
get_component_tree with focusedOnly=true structureOnly=true
|
|
896
|
-
|
|
897
|
-
# Full app structure (navigation, providers)
|
|
898
|
-
get_component_tree with structureOnly=true
|
|
899
|
-
|
|
900
|
-
# Find all button variants
|
|
901
|
-
find_components with pattern="Button"
|
|
902
|
-
|
|
903
|
-
# Find all context providers
|
|
904
|
-
find_components with pattern="Provider$"
|
|
905
|
-
```
|
|
906
|
-
|
|
907
|
-
## Device Interaction
|
|
908
|
-
|
|
909
|
-
### Android (requires ADB)
|
|
910
|
-
|
|
911
|
-
List connected devices:
|
|
912
|
-
|
|
913
|
-
```
|
|
914
|
-
list_android_devices
|
|
915
|
-
```
|
|
916
|
-
|
|
917
|
-
Take a screenshot:
|
|
918
|
-
|
|
919
|
-
```
|
|
920
|
-
android_screenshot
|
|
921
|
-
```
|
|
922
|
-
|
|
923
|
-
Tap on screen:
|
|
924
|
-
|
|
925
|
-
```
|
|
926
|
-
tap with x=540 y=960
|
|
927
|
-
```
|
|
928
|
-
|
|
929
|
-
Swipe gesture:
|
|
930
|
-
|
|
931
|
-
```
|
|
932
|
-
android_swipe with startX=540 startY=1500 endX=540 endY=500
|
|
933
|
-
```
|
|
934
|
-
|
|
935
|
-
Type text (tap input field first):
|
|
936
|
-
|
|
937
|
-
```
|
|
938
|
-
tap with x=540 y=400
|
|
939
|
-
android_input_text with text="hello@example.com"
|
|
940
|
-
```
|
|
941
|
-
|
|
942
|
-
Send key events:
|
|
943
|
-
|
|
944
|
-
```
|
|
945
|
-
android_key_event with key="BACK"
|
|
946
|
-
android_key_event with key="HOME"
|
|
947
|
-
android_key_event with key="ENTER"
|
|
948
|
-
```
|
|
949
|
-
|
|
950
|
-
### iOS Simulator (requires Xcode)
|
|
951
|
-
|
|
952
|
-
List available simulators:
|
|
953
|
-
|
|
954
|
-
```
|
|
955
|
-
list_ios_simulators
|
|
956
|
-
```
|
|
957
|
-
|
|
958
|
-
Boot a simulator:
|
|
959
|
-
|
|
960
|
-
```
|
|
961
|
-
ios_boot_simulator with udid="XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
|
|
962
|
-
```
|
|
963
|
-
|
|
964
|
-
Take a screenshot:
|
|
965
|
-
|
|
966
|
-
```
|
|
967
|
-
ios_screenshot
|
|
968
|
-
```
|
|
969
|
-
|
|
970
|
-
Launch an app:
|
|
971
|
-
|
|
972
|
-
```
|
|
973
|
-
ios_launch_app with bundleId="com.example.myapp"
|
|
974
|
-
```
|
|
975
|
-
|
|
976
|
-
Open a deep link:
|
|
977
|
-
|
|
978
|
-
```
|
|
979
|
-
ios_open_url with url="myapp://settings"
|
|
980
|
-
```
|
|
981
|
-
|
|
982
|
-
## UI Interaction
|
|
983
|
-
|
|
984
|
-
### Unified `tap` Tool (Recommended)
|
|
985
|
-
|
|
986
|
-
The `tap` tool is the simplest way to interact with UI elements. It automatically tries multiple strategies and handles platform detection and coordinate conversion:
|
|
987
|
-
|
|
988
|
-
```
|
|
989
|
-
# By visible text — tries fiber tree, accessibility, then OCR
|
|
990
|
-
tap with text="Submit"
|
|
991
|
-
|
|
992
|
-
# By testID prop
|
|
993
|
-
tap with testID="login-btn"
|
|
994
|
-
|
|
995
|
-
# By React component name (fiber tree only)
|
|
996
|
-
tap with component="HamburgerIcon"
|
|
997
|
-
|
|
998
|
-
# By pixel coordinates from screenshot (auto-converts to points on iOS)
|
|
999
|
-
tap with x=300 y=600
|
|
1000
|
-
|
|
1001
|
-
# Force a specific strategy
|
|
1002
|
-
tap with text="Menu" strategy="ocr"
|
|
1003
|
-
```
|
|
1004
|
-
|
|
1005
|
-
**Fallback chain:** fiber tree (direct `onPress`) → accessibility tree → OCR → error with suggestion.
|
|
1006
|
-
|
|
1007
|
-
On failure, the response includes an actionable `suggestion` telling the agent exactly what to try next.
|
|
1008
|
-
|
|
1009
|
-
### Platform-Specific Tools
|
|
1010
|
-
|
|
1011
|
-
For gestures beyond tapping, use platform-specific tools:
|
|
1012
|
-
|
|
1013
|
-
```
|
|
1014
|
-
# Swipe
|
|
1015
|
-
ios_swipe with startX=200 startY=400 endX=200 endY=100
|
|
1016
|
-
android_swipe with startX=540 startY=1500 endX=540 endY=500
|
|
1017
|
-
|
|
1018
|
-
# Text input (tap input field first)
|
|
1019
|
-
tap with text="Email"
|
|
1020
|
-
ios_input_text with text="hello@example.com"
|
|
1021
|
-
|
|
1022
|
-
# Key events
|
|
1023
|
-
android_key_event with key="BACK"
|
|
1024
|
-
ios_button with button="HOME"
|
|
1025
|
-
```
|
|
1026
|
-
|
|
1027
|
-
### Wait for Screen Transitions
|
|
1028
|
-
|
|
1029
|
-
```
|
|
1030
|
-
android_wait_for_element with text="Dashboard" timeoutMs=15000
|
|
1031
|
-
ios_wait_for_element with label="Home" timeoutMs=10000
|
|
1032
|
-
```
|
|
1033
|
-
|
|
1034
|
-
## OCR Text Extraction
|
|
1035
|
-
|
|
1036
|
-
The `ocr_screenshot` tool extracts all visible text from a screenshot with tap-ready coordinates. This is useful when accessibility labels are missing or when you need to find text that isn't exposed in the accessibility tree.
|
|
1037
|
-
|
|
1038
|
-
### Why OCR?
|
|
1039
|
-
|
|
1040
|
-
| Approach | Pros | Cons |
|
|
1041
|
-
|----------|------|------|
|
|
1042
|
-
| Accessibility tree (`find_element`) | Fast, reliable, low token usage | Only finds elements with accessibility labels |
|
|
1043
|
-
| Screenshot + Vision | Visual layout understanding | High token usage, slow |
|
|
1044
|
-
| **OCR** | Works on ANY visible text, returns tap coordinates | Requires text to be visible, may miss small text |
|
|
1045
|
-
|
|
1046
|
-
### Usage
|
|
1047
|
-
|
|
1048
|
-
```
|
|
1049
|
-
ocr_screenshot with platform="ios"
|
|
1050
|
-
```
|
|
1051
|
-
|
|
1052
|
-
Returns all visible text with tap-ready coordinates:
|
|
1053
|
-
|
|
1054
|
-
```json
|
|
1055
|
-
{
|
|
1056
|
-
"platform": "ios",
|
|
1057
|
-
"engine": "easyocr",
|
|
1058
|
-
"processingTimeMs": 850,
|
|
1059
|
-
"elementCount": 24,
|
|
1060
|
-
"elements": [
|
|
1061
|
-
{ "text": "Settings", "confidence": 98, "tapX": 195, "tapY": 52 },
|
|
1062
|
-
{ "text": "Login", "confidence": 95, "tapX": 187, "tapY": 420 }
|
|
1063
|
-
]
|
|
1064
|
-
}
|
|
1065
|
-
```
|
|
1066
|
-
|
|
1067
|
-
Then tap the element:
|
|
1068
|
-
|
|
1069
|
-
```
|
|
1070
|
-
tap with x=187 y=420
|
|
1071
|
-
```
|
|
1072
|
-
|
|
1073
|
-
### OCR Engine
|
|
1074
|
-
|
|
1075
|
-
The tool uses EasyOCR (Python-based) for text recognition. It provides excellent accuracy on colored backgrounds and stylized text common in mobile UIs.
|
|
1076
|
-
|
|
1077
|
-
### EasyOCR Setup
|
|
1078
|
-
|
|
1079
|
-
EasyOCR and all its Python dependencies (PyTorch, OpenCV, etc.) are installed automatically into an isolated virtual environment by the `node-easyocr` package — no need to run `pip install` manually. The only prerequisite is having Python 3.6+ available on your system:
|
|
16
|
+
### Claude Code
|
|
1080
17
|
|
|
18
|
+
If you installed globally:
|
|
1081
19
|
```bash
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
```
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
{
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
"
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
```
|
|
1118
|
-
|
|
1119
|
-
See [EasyOCR supported languages](https://www.jaided.ai/easyocr/) for the full list of language codes.
|
|
1120
|
-
|
|
1121
|
-
### Recommended Workflow
|
|
1122
|
-
|
|
1123
|
-
1. **Use unified `tap`** - Handles fallback chain automatically
|
|
1124
|
-
2. **Fall back to OCR** - When `tap` suggests using coordinates
|
|
1125
|
-
3. **Use screenshot** - For visual debugging or layout verification
|
|
1126
|
-
|
|
1127
|
-
```
|
|
1128
|
-
# Simplest approach — tap handles everything
|
|
1129
|
-
tap with text="Submit"
|
|
1130
|
-
|
|
1131
|
-
# If tap fails, use OCR to find coordinates
|
|
1132
|
-
ocr_screenshot with platform="android"
|
|
1133
|
-
|
|
1134
|
-
# Then tap using coordinates from OCR result
|
|
1135
|
-
tap with x=540 y=1200
|
|
1136
|
-
```
|
|
1137
|
-
|
|
1138
|
-
## Supported React Native Versions
|
|
1139
|
-
|
|
1140
|
-
| Version | Runtime | Status |
|
|
1141
|
-
| -------------- | ----------------------- | ---------- |
|
|
1142
|
-
| Expo SDK 54+ | React Native Bridgeless | ✓ |
|
|
1143
|
-
| RN 0.70 - 0.76 | Hermes React Native | ✓ |
|
|
1144
|
-
| RN < 0.70 | JSC | Not tested |
|
|
1145
|
-
|
|
1146
|
-
## How It Works
|
|
1147
|
-
|
|
1148
|
-
1. Fetches device list from Metro's `/json` endpoint
|
|
1149
|
-
2. Connects to the main JS runtime via CDP (Chrome DevTools Protocol) WebSocket
|
|
1150
|
-
3. Enables `Runtime.enable` to receive `Runtime.consoleAPICalled` events
|
|
1151
|
-
4. Enables `Network.enable` to receive network request/response events
|
|
1152
|
-
5. Stores logs and network requests in circular buffers for retrieval
|
|
1153
|
-
|
|
1154
|
-
## Auto-Reconnection
|
|
1155
|
-
|
|
1156
|
-
The server automatically handles connection interruptions:
|
|
1157
|
-
|
|
1158
|
-
### Auto-Connect on Startup
|
|
1159
|
-
|
|
1160
|
-
When the MCP server starts, it automatically scans common Metro ports (8081, 8082, 19000-19002) and connects to any running Metro bundlers. No need to manually call `scan_metro` if Metro is already running.
|
|
1161
|
-
|
|
1162
|
-
### Reconnection on Disconnect
|
|
1163
|
-
|
|
1164
|
-
When the connection to Metro is lost (e.g., app restart, Metro restart, or network issues):
|
|
1165
|
-
|
|
1166
|
-
1. The server automatically attempts to reconnect
|
|
1167
|
-
2. Uses exponential backoff: immediate, 500ms, 1s, 2s, 4s, 8s (up to 8 attempts)
|
|
1168
|
-
3. Re-fetches device list to handle new WebSocket URLs
|
|
1169
|
-
4. Preserves existing log and network buffers
|
|
1170
|
-
|
|
1171
|
-
### Connection Gap Warnings
|
|
1172
|
-
|
|
1173
|
-
If there was a recent disconnect, `get_logs` and `get_network_requests` will include a warning:
|
|
1174
|
-
|
|
1175
|
-
```
|
|
1176
|
-
[WARNING] Connection was restored 5s ago. Some logs may have been missed during the 3s gap.
|
|
1177
|
-
```
|
|
1178
|
-
|
|
1179
|
-
### Monitor Connection Health
|
|
1180
|
-
|
|
1181
|
-
Use `get_connection_status` to see detailed connection information:
|
|
1182
|
-
|
|
1183
|
-
```
|
|
1184
|
-
=== Connection Status ===
|
|
1185
|
-
|
|
1186
|
-
--- React Native (Port 8081) ---
|
|
1187
|
-
Status: CONNECTED
|
|
1188
|
-
Connected since: 2:45:30 PM
|
|
1189
|
-
Uptime: 5m 23s
|
|
1190
|
-
Recent gaps: 1
|
|
1191
|
-
- 2:43:15 PM (2s): Connection closed
|
|
1192
|
-
```
|
|
1193
|
-
|
|
1194
|
-
## Troubleshooting
|
|
1195
|
-
|
|
1196
|
-
### No devices found
|
|
1197
|
-
|
|
1198
|
-
- Make sure the app is running on a simulator/device
|
|
1199
|
-
- Check that Metro bundler is running (`npm start`)
|
|
1200
|
-
|
|
1201
|
-
### Wrong device connected
|
|
1202
|
-
|
|
1203
|
-
The server prioritizes devices in this order:
|
|
1204
|
-
|
|
1205
|
-
1. React Native Bridgeless (SDK 54+)
|
|
1206
|
-
2. Hermes React Native
|
|
1207
|
-
3. Any React Native (excluding Reanimated/Experimental)
|
|
1208
|
-
|
|
1209
|
-
### Logs not appearing
|
|
1210
|
-
|
|
1211
|
-
- Ensure the app is actively running (not just Metro)
|
|
1212
|
-
- Try `clear_logs` then trigger some actions in the app
|
|
1213
|
-
- Check `get_apps` to verify connection status
|
|
1214
|
-
|
|
1215
|
-
## Telemetry
|
|
1216
|
-
|
|
1217
|
-
This package collects anonymous usage telemetry to help improve the product. No personal information is collected.
|
|
1218
|
-
|
|
1219
|
-
### What is collected
|
|
1220
|
-
|
|
1221
|
-
| Data | Purpose |
|
|
1222
|
-
|------|---------|
|
|
1223
|
-
| Tool names | Which MCP tools are used most |
|
|
1224
|
-
| Success/failure | Error rates for reliability improvements |
|
|
1225
|
-
| Duration (ms) | Performance monitoring |
|
|
1226
|
-
| Session start/end | Retention analysis |
|
|
1227
|
-
| Platform | macOS/Linux/Windows distribution |
|
|
1228
|
-
| Server version | Adoption of new versions |
|
|
1229
|
-
|
|
1230
|
-
**Not collected**: No file paths, code content, network data, or personally identifiable information.
|
|
1231
|
-
|
|
1232
|
-
### Opt-out
|
|
1233
|
-
|
|
1234
|
-
To disable telemetry, set the environment variable:
|
|
1235
|
-
|
|
1236
|
-
```bash
|
|
1237
|
-
export RN_DEBUGGER_TELEMETRY=false
|
|
1238
|
-
```
|
|
1239
|
-
|
|
1240
|
-
Or inline:
|
|
1241
|
-
|
|
1242
|
-
```bash
|
|
1243
|
-
RN_DEBUGGER_TELEMETRY=false npx react-native-ai-debugger
|
|
1244
|
-
```
|
|
1245
|
-
|
|
1246
|
-
## License
|
|
1247
|
-
|
|
1248
|
-
MIT
|
|
20
|
+
claude mcp remove rn-debugger
|
|
21
|
+
claude mcp add rn-debugger --scope user -- npx react-native-ai-devtools
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
If you installed per-project, edit your project's `.mcp.json` file:
|
|
25
|
+
```diff
|
|
26
|
+
{
|
|
27
|
+
"mcpServers": {
|
|
28
|
+
"rn-debugger": {
|
|
29
|
+
"type": "stdio",
|
|
30
|
+
"command": "npx",
|
|
31
|
+
- "args": ["react-native-ai-debugger"]
|
|
32
|
+
+ "args": ["react-native-ai-devtools"]
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Cursor
|
|
39
|
+
|
|
40
|
+
Edit your global `~/.cursor/mcp.json` or project-level `.cursor/mcp.json` file:
|
|
41
|
+
```diff
|
|
42
|
+
{
|
|
43
|
+
"mcpServers": {
|
|
44
|
+
"rn-debugger": {
|
|
45
|
+
"command": "npx",
|
|
46
|
+
- "args": ["-y", "react-native-ai-debugger"]
|
|
47
|
+
+ "args": ["-y", "react-native-ai-devtools"]
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
*Created by Ihor Zheludkov*
|