Skip to main content
Glama
react-native-devtools-mcp

react-native-devtools-mcp

react-native-devtools-mcp

MCP server that gives AI agents eyes, hands, and X-ray vision into any React Native app running in an iOS simulator or Android emulator.

  • Capture screenshots and screen recordings

  • Inspect the full UI accessibility tree with element labels, types, and bounds

  • Interact with the app: tap, type, scroll, press buttons, open deep links

  • Capture device-level console logs (simctl/logcat) and JS-level console output (via Metro CDP)

  • Execute arbitrary JavaScript inside the running app

  • Check Metro bundler status and connected runtimes

Works with any MCP-compatible AI agent: OpenCode, Claude Code, Cursor, Windsurf, etc.

Prerequisites

  • Node.js >= 20

  • iOS: Xcode with Simulator, plus Facebook IDB for view hierarchy:

    brew tap facebook/fb && brew install idb-companion
    pip3 install fb-idb
  • Android: Android SDK with adb on PATH and a configured emulator

Related MCP server: mobile-mcp

Quick Start

1. Build

cd ~/react-native-devtools-mcp
npm install
npm run build

2. Boot a simulator or emulator

# iOS
xcrun simctl boot "iPhone 15 Pro"

# Android
emulator -avd <avd_name>

3. Configure your AI tool

OpenCode — add to ~/.config/opencode/opencode.json:

{
  "mcpServers": {
    "react-native": {
      "command": "node",
      "args": ["/absolute/path/to/react-native-devtools-mcp/dist/index.js"]
    }
  }
}

Claude Code:

claude mcp add react-native node /absolute/path/to/react-native-devtools-mcp/dist/index.js

Cursor — add to .cursor/mcp.json:

{
  "mcpServers": {
    "react-native": {
      "command": "node",
      "args": ["/absolute/path/to/react-native-devtools-mcp/dist/index.js"]
    }
  }
}

Tools

Observation

Tool

Description

Params

screenshot

Capture screen as PNG image

name? (string)

get_view_hierarchy

Dump UI accessibility tree with labels, types, bounds

format? (raw|tree), filter? (string)

get_device_info

Device/simulator info and connection status

none

get_device_logs

Device-level console logs (simctl log / adb logcat)

duration? (seconds, default 30), filter? (regex)

get_metro_status

Metro bundler status and connected RN runtimes

none

get_js_logs

JS console output (console.log/warn/error) via Metro CDP

duration? (seconds, default 5), filter? (regex), level? (all|log|warn|error|info|debug)

Interaction

Tool

Description

Params

tap

Tap at screen coordinates

x (number), y (number)

type_text

Type into focused input field

text (string)

press_button

Press device button

button (home|back|enter|delete)

scroll

Scroll in a direction

direction (up|down|left|right), amount? (pixels, default 500)

open_deeplink

Open URL or deep link in app

url (string)

js_eval

Execute JavaScript in the running app via Metro CDP

expression (string)

Utility

Tool

Description

Params

ping

Health check — device status

none

start_recording

Start screen recording

name? (string)

stop_recording

Stop recording, return file path

none

help

List all tools with params and system status

none

Environment Variables

All optional. The server auto-detects everything.

Variable

Description

Default

RN_DEVTOOLS_PLATFORM

Force platform: ios or android

auto-detect

RN_DEVTOOLS_DEVICE_ID

Force device UDID (iOS) or serial (Android)

auto-detect

RN_DEVTOOLS_IDB_PATH

Path to idb binary for iOS view hierarchy

auto-discover

RN_DEVTOOLS_METRO_PORT

Metro bundler port

8081

RN_DEVTOOLS_METRO_HOST

Metro bundler host

127.0.0.1

Use as Library

react-native-devtools-mcp is designed to be extended. Import createServer to get a pre-configured MCP server with all generic tools, then register your own:

import { createServer } from "react-native-devtools-mcp";

const server = createServer({ name: "my-custom-mcp", version: "1.0.0" });

// Add your own tools on top of the 16 built-in ones
server.tool("my_tool", "Does something custom", {}, async () => {
  return { content: [{ type: "text", text: "result" }] };
});

Individual register functions are also exported if you want selective tool registration:

import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import {
  registerScreenshotTool,
  registerViewHierarchyTool,
  registerInteractionTools,
} from "react-native-devtools-mcp";

const server = new McpServer({ name: "minimal", version: "1.0.0" });
registerScreenshotTool(server);
registerViewHierarchyTool(server);
registerInteractionTools(server);

Metro/CDP utilities are exported too: getMetroTargets, getMetroStatus, cdpEval, captureJsLogs, getMetroBaseUrl.

How it Works

No app code changes required. The server connects to existing debug interfaces:

  • iOS Simulator: xcrun simctl for screenshots, input, logs, deep links. Facebook IDB (idb ui describe-all) for view hierarchy with accessibility labels, frames, and element roles.

  • Android Emulator: adb for screenshots, input, logs, deep links. uiautomator dump for view hierarchy with resource-ids (testIDs), text, and bounds.

  • Metro Bundler: Chrome DevTools Protocol (CDP) over WebSocket for JS console capture (Runtime.consoleAPICalled), JS evaluation (Runtime.evaluate), and runtime status. Connects to http://localhost:8081/json to discover available runtimes.

Troubleshooting

"No booted simulator or emulator detected" Boot a simulator (xcrun simctl boot "iPhone 15 Pro") or emulator (emulator -avd <name>), or set RN_DEVTOOLS_PLATFORM and RN_DEVTOOLS_DEVICE_ID env vars.

View hierarchy empty on iOS iOS view hierarchy requires Facebook IDB. Install it:

brew tap facebook/fb && brew install idb-companion
pip3 install fb-idb

Verify with: idb ui describe-all --udid <simulator-udid>. If idb is not on PATH, set RN_DEVTOOLS_IDB_PATH=/path/to/idb.

IDB not found The server searches common locations automatically. If it still can't find IDB, set RN_DEVTOOLS_IDB_PATH to the absolute path of the idb binary (e.g., ~/Library/Python/3.9/bin/idb).

Screenshot fails on Android Ensure adb is on PATH and the emulator is fully booted past the lock screen.

Metro/JS tools not working Ensure Metro bundler is running and accessible. Test with:

curl http://localhost:8081/json

If Metro runs on a different port, set RN_DEVTOOLS_METRO_PORT.

JS eval returns "No React Native runtime found" The app must be running and connected to Metro. Check get_metro_status to see connected runtimes.

License

MIT

Available Tools

16 tools
get_device_infoB

Show current device/simulator/emulator info and connection status

Inputs: no named parameters.

get_device_logsC

Capture recent device console logs from the simulator/emulator

Inputs: filter, duration.

get_js_logsA

Capture JavaScript console output (console.log/warn/error) from the running React Native app via Metro CDP

Inputs: level, filter, duration.

get_metro_statusA

Check if Metro bundler is running and list connected React Native runtimes

Inputs: no named parameters.

get_view_hierarchyA

Dump the current UI accessibility tree with labels, types, frames, and testIDs. Requires Facebook IDB on iOS.

Inputs: filter, format.

helpA

List all available tools with descriptions, parameters, and current system status

Inputs: no named parameters.

js_evalA

Execute JavaScript in the running React Native app via Metro CDP. Returns the result. Supports await for async expressions.

Inputs: expression (required).

pingA

Health check — returns device info and connection status

Inputs: no named parameters.

press_buttonC

Press a device button (home, back, enter, delete)

Inputs: button (required).

screenshotA

Capture the current simulator/emulator screen and return it as an image

Inputs: name.

scrollB

Scroll the screen in a direction

Inputs: direction (required), amount.

start_recordingC

Start recording the simulator/emulator screen to a video file

Inputs: name.

stop_recordingA

Stop the current screen recording and return the file path

Inputs: no named parameters.

tapC

Tap on the screen at given coordinates

Inputs: x (required), y (required).

type_textB

Type text into the currently focused input field

Inputs: text (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 16 tools

    Disambiguation4/5

    Each tool maps to a distinct action on the simulator/app (tap, scroll, screenshot, record, eval, logs), so selection is mostly clear. The main overlap is `ping` ("returns device info and connection status") versus `get_device_info` ("show device/simulator info and connection status"), which are near-duplicates, and `get_device_logs` vs `get_js_logs` require reading descriptions carefully to pick correctly.

    Naming Consistency4/5

    Names are uniformly snake_case and mostly follow a verb_noun pattern (get_device_info, start_recording, open_deeplink, get_js_logs). Minor deviations are `js_eval` (noun_verb, reversed order) and bare-verb tools like ping, screenshot, tap, scroll, help, which are intuitive enough for action-style commands.

    Tool Count4/5

    16 tools is on the high side but each roughly corresponds to a real devtools workflow: device control, screen capture, recording, log capture, Metro status, and JS evaluation. The set could be trimmed by merging ping with get_device_info and possibly folding help into a meta-capability, but nothing feels gratuitous.

    Completeness4/5

    The surface covers the core loop well: connect/inspect device, capture screen and view hierarchy, read JS/device logs, drive input (tap, type, button, scroll, deeplink), record video, and run JS via Metro. Gaps include network request inspection, app relaunch/reload, and richer gestures (long press, swipe, pinch), but agents can work around these.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      C
      maintenance
      Enables agents and LLMs to interact with native iOS and Android applications and devices via structured accessibility snapshots or coordinate-based taps, supporting simulators, emulators, and real devices.
      39
      55,827 npm
      Apache 2.0
    • A
      license
      B
      quality
      B
      maintenance
      Enables AI agents to automate Android and iOS devices, including emulators and physical devices, by capturing screenshots, reading UI accessibility trees, performing touch and text input, and managing app lifecycle and logs.
      18
      4
      MIT
    • A
      license
      B
      quality
      B
      maintenance
      Connects AI agents to a running React Native app so they can see the screen, tap and type, and inspect logs, network traffic, and state without any SDK or code changes. Composite tools let an agent run a whole interaction flow in a single call instead of one round trip per tap.
      35
      2
      MIT