react-native-mcp-kit 2.3.0 → 2.3.1
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 +35 -12
- package/dist/bin/ios-hid +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
**See, drive, and debug a running React Native app from an AI agent.**
|
|
4
4
|
|
|
5
|
-
`react-native-mcp-kit` connects a running RN app
|
|
5
|
+
`react-native-mcp-kit` connects a running RN app — on simulator, emulator, or physical device — to any process that speaks the [Model Context Protocol](https://modelcontextprotocol.io). You wire it in once and the agent gets a concise, structured view of what's happening inside the running app: deep runtime-state analysis it can cross-reference in a single pass, full access to the React tree so it can find and reason about UI without screenshots and OCR, every kind of log the app produces, and simulation of real taps, swipes, and text input through the OS gesture pipeline. The whole surface is designed around what's cheap and fast for the agent to think about — lean responses by default, low vision-token cost on screenshots, a focused set of tools instead of overwhelming dumps.
|
|
6
6
|
|
|
7
7
|
```
|
|
8
8
|
AI Agent / Cursor / Claude Code --stdio/MCP--> Node server --WebSocket--> RN app (device)
|
|
@@ -15,16 +15,16 @@ AI Agent / Cursor / Claude Code --stdio/MCP--> Node server --WebSocket--> RN app
|
|
|
15
15
|
A few concrete scenarios this unlocks:
|
|
16
16
|
|
|
17
17
|
- **Drive multiple devices in parallel from one agent session.** iOS simulator, Android emulator, physical device — any mix attaches to the same server. The agent can walk the same flow across platforms side-by-side, catching visual or behavioural regressions that show up on one OS but not the other, without ever leaving the editor.
|
|
18
|
-
- **End-to-end automation without a separate test harness.** Describe a multi-step flow in natural language — "sign in, open settings, flip the notifications toggle, verify the confirmation toast" — and
|
|
19
|
-
- **Interactive inspection of a live app from your editor.** Ask "what screen am I on?", "what
|
|
20
|
-
- **Debug gesture-arbitration bugs that unit tests can't catch.** Taps go through the real iOS/Android touch pipeline, so issues like "the close button inside a horizontally-scrolling list swallows taps" surface naturally — and when you need to sidestep the pipeline (call a prop directly
|
|
21
|
-
- **Expose your own inspection points from inside components.** A component can register a named state key or an ad-hoc
|
|
18
|
+
- **End-to-end automation without a separate test harness.** Describe a multi-step flow in natural language — "sign in, open settings, flip the notifications toggle, verify the confirmation toast" — and the agent walks it: locates the right components, fires real taps through the OS gesture pipeline, asserts on the resulting state, and reports back.
|
|
19
|
+
- **Interactive inspection of a live app from your editor.** Ask "what screen am I on?", "what's in the request cache?", "what did the last POST return?", "what values are in app state right now?" — no rebuild, no DevTools panel, no "add more logs and reload" loop.
|
|
20
|
+
- **Debug gesture-arbitration bugs that unit tests can't catch.** Taps go through the real iOS/Android touch pipeline, so issues like "the close button inside a horizontally-scrolling list swallows taps" surface naturally — and when you need to sidestep the pipeline (call a prop directly, in a spot a real finger can't reach) the bridge offers that too.
|
|
21
|
+
- **Expose your own inspection points from inside components.** A component can register a named state key or an ad-hoc action from its own lifecycle. Agents then read feature-flag state, force a particular loading scenario, or trigger an internal-only action without you shipping a debug menu.
|
|
22
22
|
|
|
23
|
-
Everything the library adds to your bundle is stripped
|
|
23
|
+
Everything the library adds to your bundle is stripped from production builds by default — wire it up once and leave it in, without shipping it to users.
|
|
24
24
|
|
|
25
25
|
## Example scenarios
|
|
26
26
|
|
|
27
|
-
- **Deep runtime-state analysis on demand.** Ask "why is this screen blank?" or "why did the last submission fail?" — the agent cross-references
|
|
27
|
+
- **Deep runtime-state analysis on demand.** Ask "why is this screen blank?" or "why did the last submission fail?" — the agent cross-references what's mounted in the UI, where the user is in the app, what the network has been doing, what errors fired, and any state the app has opted into exposing. All from the running runtime, no extra logging or rebuild. The same pass can be scoped to a specific moment ("state right after I tap submit") instead of a stale snapshot.
|
|
28
28
|
- **Reproduce a bug from a ticket, fix it, verify the fix.** The agent reads the reproduction steps, drives the app into the failing state through real taps and swipes, confirms the bug, edits the relevant source, then replays the same sequence to verify the fix — all in one editor session, no rebuilds between steps.
|
|
29
29
|
- **End-to-end flow narrated in plain language.** "Sign in, add an item to the cart, go through checkout, verify the total matches the expected value, screenshot the final screen, and give me a network traffic summary." The agent drives real taps, checks state at each step, snapshots the key screens, and hands back captured request counts / durations / errors as evidence.
|
|
30
30
|
- **Cross-platform parity check.** One agent holds two connected clients, runs the same tap sequence on iOS and Android in parallel, captures screenshots, and points out the differences — catches platform-specific regressions after an RN upgrade, shared-component refactor, or native change.
|
|
@@ -72,7 +72,7 @@ export const App = () => {
|
|
|
72
72
|
|
|
73
73
|
These modules register automatically on mount — no prop required:
|
|
74
74
|
|
|
75
|
-
`alert`, `console`, `device`, `errors`, `network`, `fiber_tree`
|
|
75
|
+
`alert`, `console`, `device`, `errors`, `log_box`, `network`, `fiber_tree`
|
|
76
76
|
|
|
77
77
|
If the dependency lives deeper in the tree (e.g. the `QueryClient` is created inside a feature-specific provider), skip the prop and use `useMcpModule` there instead — see [Hooks](#hooks).
|
|
78
78
|
|
|
@@ -134,7 +134,19 @@ iOS simulators share localhost with the host machine, no forwarding needed.
|
|
|
134
134
|
|
|
135
135
|
### 4. Run
|
|
136
136
|
|
|
137
|
-
Start Metro + your app. The `McpProvider` connects to `ws://localhost:8347` on mount.
|
|
137
|
+
Start Metro + your app. The `McpProvider` connects to `ws://localhost:8347` on mount.
|
|
138
|
+
|
|
139
|
+
From your agent, a typical first session looks like:
|
|
140
|
+
|
|
141
|
+
```
|
|
142
|
+
connection_status
|
|
143
|
+
→ { clientCount: 1, clients: [{ id: "ios-1", label: "iPhone 17 Pro", ... }] }
|
|
144
|
+
|
|
145
|
+
list_tools { compact: true }
|
|
146
|
+
→ catalog of every module registered by the app, grouped by client
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
After that, every tool is callable by name via `call`. If the server isn't running yet, the provider just retries silently — no crash, no error toast.
|
|
138
150
|
|
|
139
151
|
## `McpProvider` reference
|
|
140
152
|
|
|
@@ -154,7 +166,12 @@ Wrap your whole app in it — every optional prop opts a module in when supplied
|
|
|
154
166
|
|
|
155
167
|
## MCP server tools
|
|
156
168
|
|
|
157
|
-
The Node server exposes a small set of entry-point tools agents use directly — you don't register or configure them
|
|
169
|
+
The Node server exposes a small set of entry-point tools agents use directly — you don't register or configure them:
|
|
170
|
+
|
|
171
|
+
- **Discovery & dispatch** — `connection_status`, `list_tools`, `describe_tool`, `call`.
|
|
172
|
+
- **Reactive state** — `state_get`, `state_list` (read values exposed via `useMcpState`).
|
|
173
|
+
- **Test automation** — `wait_until` (poll any tool until a predicate holds, replacing screenshot-in-a-loop + sleep) and `assert` (single-shot checkpoint with a standardized diff on failure).
|
|
174
|
+
- **UI-level waits** — `fiber_tree__query` has a built-in `waitFor: { until: "appear" | "disappear", stable? }` option; see the [fiber_tree section](#fiber_tree).
|
|
158
175
|
|
|
159
176
|
## Host tools (device-level control)
|
|
160
177
|
|
|
@@ -172,8 +189,9 @@ iOS input goes through a bundled `ios-hid` Swift binary that injects HID events
|
|
|
172
189
|
|
|
173
190
|
## Metro tools (dev-server control plane)
|
|
174
191
|
|
|
175
|
-
Separate module talking HTTP / WebSocket to the Metro instance the app was bundled from.
|
|
192
|
+
Separate module talking HTTP / WebSocket to the Metro instance the app was bundled from.
|
|
176
193
|
|
|
194
|
+
- **Auto-detected URL per client.** Each attached app reports its actual Metro origin at handshake (via RN's `getDevServer()`). Non-default ports (`yarn start --port 8082`) and LAN-connected physical devices work without an explicit `metroUrl` arg.
|
|
177
195
|
- **`metro__symbolicate`** — maps a raw Hermes / V8 stack trace back to source paths via Metro's `/symbolicate`. Pairs naturally with `errors__get_errors` and `log_box__get_logs` (each entry has parsed `stackFrames` ready to feed in).
|
|
178
196
|
- **`metro__reload`** — triggers a full JS reload on every attached app (`POST /reload`).
|
|
179
197
|
- **`metro__status`** — cheap ping before a chain of Metro calls.
|
|
@@ -258,7 +276,12 @@ Captures unhandled JS errors (via `ErrorUtils.setGlobalHandler`) and unhandled p
|
|
|
258
276
|
|
|
259
277
|
### fiber_tree
|
|
260
278
|
|
|
261
|
-
The heart of UI inspection. Search the component tree via a chained `query`: each step narrows the result
|
|
279
|
+
The heart of UI inspection. Search the component tree via a chained `query`: each step narrows the result by **criteria** within a given **scope**, with multiple matches fanning out into the next step.
|
|
280
|
+
|
|
281
|
+
- **Criteria**: `name`, `testID`, `mcpId`, `text`, `hasProps`, `props` (equality + `contains`), `not`, `any`.
|
|
282
|
+
- **Scopes**: `descendants`, `children`, `parent`, `ancestors`, `siblings`, `self`, `screen` (focused screen fiber from React Navigation), `nearest_host` (closest host component).
|
|
283
|
+
|
|
284
|
+
Wrapper cascades (`PressableView → Pressable → View → RCTView`) collapse to the topmost by default, so overlapping matches don't drown the result. `bounds` come back in physical pixels and pair directly with `host__tap` — or use `host__tap_fiber` for the locate-and-tap shortcut.
|
|
262
285
|
|
|
263
286
|
Pass `waitFor: { until: 'appear' | 'disappear', timeout?, interval?, stable? }` to poll the same query until the target state is reached — e.g. `waitFor: { until: 'appear', stable: 300 }` waits for a screen to mount and hold stable for 300ms. Response carries `{ waited, attempts, elapsedMs, timedOut, stableFor? }` alongside the usual matches.
|
|
264
287
|
|
package/dist/bin/ios-hid
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-mcp-kit",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.1",
|
|
4
4
|
"description": "MCP server for React Native — drive, inspect, and debug running RN apps from AI agents via the real OS gesture pipeline",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Aliaksei Pranko",
|