react-native-ai-debugger 1.0.4 → 1.0.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/README.md +145 -0
- package/build/core/httpServer.d.ts +14 -0
- package/build/core/httpServer.d.ts.map +1 -0
- package/build/core/httpServer.js +622 -0
- package/build/core/httpServer.js.map +1 -0
- package/build/core/index.d.ts +3 -1
- package/build/core/index.d.ts.map +1 -1
- package/build/core/index.js +8 -2
- package/build/core/index.js.map +1 -1
- package/build/core/ios.d.ts +80 -0
- package/build/core/ios.d.ts.map +1 -1
- package/build/core/ios.js +591 -1
- package/build/core/ios.js.map +1 -1
- package/build/core/telemetry.d.ts +4 -0
- package/build/core/telemetry.d.ts.map +1 -0
- package/build/core/telemetry.js +225 -0
- package/build/core/telemetry.js.map +1 -0
- package/build/index.js +286 -5
- package/build/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,6 +6,7 @@ An MCP (Model Context Protocol) server for AI-powered React Native debugging. En
|
|
|
6
6
|
|
|
7
7
|
- Captures `console.log`, `console.warn`, `console.error` from React Native apps
|
|
8
8
|
- **Network request tracking** - capture HTTP requests/responses with headers, timing, and status
|
|
9
|
+
- **Debug Web Dashboard** - browser-based UI to view logs and network requests in real-time
|
|
9
10
|
- Supports both **Expo SDK 54+** (React Native Bridgeless) and **RN 0.70+** (Hermes)
|
|
10
11
|
- Auto-discovers running Metro servers on common ports
|
|
11
12
|
- Filters logs by level (log, warn, error, info, debug)
|
|
@@ -15,11 +16,14 @@ An MCP (Model Context Protocol) server for AI-powered React Native debugging. En
|
|
|
15
16
|
- **Discover debug globals** available in the app
|
|
16
17
|
- **Android device control** - screenshots, tap, swipe, text input, key events via ADB
|
|
17
18
|
- **iOS simulator control** - screenshots, app management, URL handling via simctl
|
|
19
|
+
- **iOS UI automation** - tap, swipe, text input, button presses via IDB (optional)
|
|
20
|
+
- **iOS accessibility inspection** - get UI element tree and element info at coordinates via IDB
|
|
18
21
|
|
|
19
22
|
## Requirements
|
|
20
23
|
|
|
21
24
|
- Node.js 18+
|
|
22
25
|
- React Native app running with Metro bundler
|
|
26
|
+
- **Optional for iOS UI automation**: [Facebook IDB](https://fbidb.io/) - `brew install idb-companion`
|
|
23
27
|
|
|
24
28
|
## Claude Code Setup
|
|
25
29
|
|
|
@@ -125,6 +129,7 @@ Requires VS Code 1.102+ with Copilot ([docs](https://code.visualstudio.com/docs/
|
|
|
125
129
|
| `list_debug_globals` | Discover available debug objects (Apollo, Redux, Expo Router, etc.) |
|
|
126
130
|
| `inspect_global` | Inspect a global object to see its properties and callable methods |
|
|
127
131
|
| `reload_app` | Reload the app (like pressing 'r' in Metro or shaking the device) |
|
|
132
|
+
| `get_debug_server` | Get the debug HTTP server URL for browser-based viewing |
|
|
128
133
|
|
|
129
134
|
### Android (ADB)
|
|
130
135
|
|
|
@@ -154,6 +159,22 @@ Requires VS Code 1.102+ with Copilot ([docs](https://code.visualstudio.com/docs/
|
|
|
154
159
|
| `ios_terminate_app` | Terminate a running app |
|
|
155
160
|
| `ios_boot_simulator` | Boot a simulator by UDID |
|
|
156
161
|
|
|
162
|
+
### iOS UI Interaction (requires IDB)
|
|
163
|
+
|
|
164
|
+
These tools require [Facebook IDB](https://fbidb.io/) to be installed: `brew install idb-companion`
|
|
165
|
+
|
|
166
|
+
| Tool | Description |
|
|
167
|
+
| ------------------- | ----------------------------------------------------- |
|
|
168
|
+
| `ios_tap` | Tap at specific coordinates on screen |
|
|
169
|
+
| `ios_tap_element` | Tap an element by its accessibility label |
|
|
170
|
+
| `ios_swipe` | Swipe from one point to another |
|
|
171
|
+
| `ios_input_text` | Type text into the active input field |
|
|
172
|
+
| `ios_button` | Press hardware buttons (HOME, LOCK, SIRI, etc.) |
|
|
173
|
+
| `ios_key_event` | Send a key event by keycode |
|
|
174
|
+
| `ios_key_sequence` | Send multiple key events in sequence |
|
|
175
|
+
| `ios_describe_all` | Get accessibility tree for entire screen |
|
|
176
|
+
| `ios_describe_point`| Get accessibility info for element at specific point |
|
|
177
|
+
|
|
157
178
|
## Usage
|
|
158
179
|
|
|
159
180
|
1. Start your React Native app:
|
|
@@ -264,6 +285,57 @@ By Domain:
|
|
|
264
285
|
cdn.example.com: 7
|
|
265
286
|
```
|
|
266
287
|
|
|
288
|
+
## Debug Web Dashboard
|
|
289
|
+
|
|
290
|
+
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.
|
|
291
|
+
|
|
292
|
+
### Getting the Dashboard URL
|
|
293
|
+
|
|
294
|
+
Use the `get_debug_server` tool to find the dashboard URL:
|
|
295
|
+
|
|
296
|
+
```
|
|
297
|
+
get_debug_server
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
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.
|
|
301
|
+
|
|
302
|
+
### Available Pages
|
|
303
|
+
|
|
304
|
+
| URL | Description |
|
|
305
|
+
| ---------- | ---------------------------------------------- |
|
|
306
|
+
| `/` | Dashboard with overview stats |
|
|
307
|
+
| `/logs` | Console logs with color-coded levels |
|
|
308
|
+
| `/network` | Network requests with expandable details |
|
|
309
|
+
| `/apps` | Connected React Native apps |
|
|
310
|
+
|
|
311
|
+
### Features
|
|
312
|
+
|
|
313
|
+
- **Auto-refresh** - Pages update automatically every 3 seconds
|
|
314
|
+
- **Color-coded logs** - Errors (red), warnings (yellow), info (blue), debug (gray)
|
|
315
|
+
- **Expandable network requests** - Click any request to see full details:
|
|
316
|
+
- Request/response headers
|
|
317
|
+
- Request body (with JSON formatting)
|
|
318
|
+
- Timing information
|
|
319
|
+
- Error details
|
|
320
|
+
- **GraphQL support** - Shows operation name and variables in compact view:
|
|
321
|
+
```
|
|
322
|
+
POST 200 https://api.example.com/graphql 1ms ▶
|
|
323
|
+
GetMeetingsBasic (timeFilter: "Future", first: 20)
|
|
324
|
+
```
|
|
325
|
+
- **REST body preview** - Shows JSON body preview for non-GraphQL requests
|
|
326
|
+
|
|
327
|
+
### JSON API Endpoints
|
|
328
|
+
|
|
329
|
+
For programmatic access, JSON endpoints are also available:
|
|
330
|
+
|
|
331
|
+
| URL | Description |
|
|
332
|
+
| -------------------- | ----------------------------- |
|
|
333
|
+
| `/api/status` | Server status and buffer sizes |
|
|
334
|
+
| `/api/logs` | All logs as JSON |
|
|
335
|
+
| `/api/network` | All network requests as JSON |
|
|
336
|
+
| `/api/bundle-errors` | Metro bundle errors as JSON |
|
|
337
|
+
| `/api/apps` | Connected apps as JSON |
|
|
338
|
+
|
|
267
339
|
## App Inspection
|
|
268
340
|
|
|
269
341
|
### Discover Debug Globals
|
|
@@ -404,6 +476,79 @@ Open a deep link:
|
|
|
404
476
|
ios_open_url with url="myapp://settings"
|
|
405
477
|
```
|
|
406
478
|
|
|
479
|
+
### iOS UI Automation (requires IDB)
|
|
480
|
+
|
|
481
|
+
Install IDB first: `brew install idb-companion`
|
|
482
|
+
|
|
483
|
+
**Important: Coordinate System**
|
|
484
|
+
- iOS IDB uses **points** (logical coordinates), not pixels
|
|
485
|
+
- For 2x Retina displays: 1 point = 2 pixels
|
|
486
|
+
- Example: 1640x2360 pixel screenshot = 820x1180 points
|
|
487
|
+
- Use `ios_describe_all` to get exact element coordinates in points
|
|
488
|
+
|
|
489
|
+
Tap on screen (coordinates in points):
|
|
490
|
+
|
|
491
|
+
```
|
|
492
|
+
ios_tap with x=200 y=400
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
Long press (hold for 2 seconds):
|
|
496
|
+
|
|
497
|
+
```
|
|
498
|
+
ios_tap with x=200 y=400 duration=2
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
Swipe gesture:
|
|
502
|
+
|
|
503
|
+
```
|
|
504
|
+
ios_swipe with startX=200 startY=600 endX=200 endY=200
|
|
505
|
+
```
|
|
506
|
+
|
|
507
|
+
Type text (tap input field first):
|
|
508
|
+
|
|
509
|
+
```
|
|
510
|
+
ios_tap with x=200 y=300
|
|
511
|
+
ios_input_text with text="hello@example.com"
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
Press hardware buttons:
|
|
515
|
+
|
|
516
|
+
```
|
|
517
|
+
ios_button with button="HOME"
|
|
518
|
+
ios_button with button="LOCK"
|
|
519
|
+
ios_button with button="SIRI"
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
Get accessibility info for the screen:
|
|
523
|
+
|
|
524
|
+
```
|
|
525
|
+
ios_describe_all
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
Get accessibility info at a specific point:
|
|
529
|
+
|
|
530
|
+
```
|
|
531
|
+
ios_describe_point with x=200 y=400
|
|
532
|
+
```
|
|
533
|
+
|
|
534
|
+
Tap an element by accessibility label:
|
|
535
|
+
|
|
536
|
+
```
|
|
537
|
+
ios_tap_element with label="Settings"
|
|
538
|
+
```
|
|
539
|
+
|
|
540
|
+
Tap using partial label match:
|
|
541
|
+
|
|
542
|
+
```
|
|
543
|
+
ios_tap_element with labelContains="Sign"
|
|
544
|
+
```
|
|
545
|
+
|
|
546
|
+
When multiple elements match, use index (0-based):
|
|
547
|
+
|
|
548
|
+
```
|
|
549
|
+
ios_tap_element with labelContains="Button" index=1
|
|
550
|
+
```
|
|
551
|
+
|
|
407
552
|
## Supported React Native Versions
|
|
408
553
|
|
|
409
554
|
| Version | Runtime | Status |
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
interface DebugServerOptions {
|
|
2
|
+
port?: number;
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* Get the port the debug HTTP server is running on (if started)
|
|
6
|
+
*/
|
|
7
|
+
export declare function getDebugServerPort(): number | null;
|
|
8
|
+
/**
|
|
9
|
+
* Start a debug HTTP server to expose buffer contents.
|
|
10
|
+
* Automatically finds an available port starting from the default.
|
|
11
|
+
*/
|
|
12
|
+
export declare function startDebugHttpServer(options?: DebugServerOptions): Promise<number | null>;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=httpServer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpServer.d.ts","sourceRoot":"","sources":["../../src/core/httpServer.ts"],"names":[],"mappings":"AASA,UAAU,kBAAkB;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,GAAG,IAAI,CAElD;AAgnBD;;;GAGG;AACH,wBAAsB,oBAAoB,CAAC,OAAO,GAAE,kBAAuB,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAkBnG"}
|