Skip to main content
Glama
GinzaTech
by GinzaTech

RN Agent Observer

VI · English

RN Agent Observer 2.4.0 is a local runtime observability bridge for React Native/Expo. The tool uses the same TypeScript core for both CLI and MCP, drives Android via ADB/UIAutomator, receives telemetry from development instrumentation, exports console/exception/heap/JS CPU profiles through Metro's Chrome DevTools Protocol, captures per-request network traffic without instrumentation, produces screen understanding with state/headline/actions/UI findings for agents, provides session-stable ref snapshots + diffs + auto-recorded replay, records screen video, persists sessions in SQLite, and keeps screenshots/traces/UI trees as on-disk artifacts.

The current release completes Android v1 on Windows: 45 MCP tools, the matching CLI, an Expo demo with deterministic labs, transparent heuristic diagnosis, and pixel + structural UI comparison.

Requirements

  • Node.js 22.12 or newer

  • pnpm 9.6

  • Android Platform Tools (adb)

  • Android emulator or physical device with USB debugging enabled

  • Expo development build if you need app-specific telemetry

Related MCP server: React Native MCP Server

Quick Start

pnpm install
pnpm check
adb devices -l
pnpm rn-observe --help
pnpm mcp:check

Point the observer at your Expo/React Native app:

$env:RN_OBSERVER_PROJECT_ROOT = 'C:\path\to\expo-app'
$env:RN_OBSERVER_DEVICE_ID = 'emulator-5554'
# Có thể bỏ qua nếu app.json chứa expo.android.package
$env:RN_OBSERVER_APP_ID = 'com.example.app'

pnpm rn-observe launch
pnpm rn-observe observe
pnpm rn-observe understand-screen
pnpm rn-observe ui-model
pnpm rn-observe tap --test-id buy-button
pnpm rn-observe performance
pnpm rn-observe diagnose

Artifacts and SQLite are created under <projectRoot>/.artifacts/; large binaries are never embedded in MCP responses.

Deterministic demo

pnpm --filter @rn-agent-observer/demo-expo android -- --device <device-name>

The demo includes PerformanceLab, NetworkLab, RenderLab, AnimationLab, ErrorLab, and VisualLab. NetworkLab uses internal fixtures (0/500/2000ms and 503) so it doesn't depend on Internet services. PerformanceLab accurately reports its 100ms long JS task through instrumentation.

MCP

pnpm mcp:check
pnpm mcp:start

The server uses stdio. Client configuration and the list of 45 tools are in docs/protocol.md.

AI agent integration

There are 3 ways for agents (OpenCode/Claude Code/Cursor/Codex...) to use the observer:

1. MCP server (recommended — structured tools)

{
  "mcpServers": {
    "rn-agent-observer": {
      "command": "node",
      "args": [
        "C:\\abs\\rn-agent-observer\\packages\\mcp-server\\dist\\server.js"
      ],
      "env": {
        "RN_OBSERVER_PROJECT_ROOT": "C:\\path\\to\\expo-app",
        "RN_OBSERVER_DEVICE_ID": "emulator-5554"
      }
    }
  }
}

2. Install as a skill (teaches the agent the debugging workflow via CLI)

npx skills add GinzaTech/rn-agent-observer

The skill is at skills/rn-agent-observer/SKILL.md — it teaches the agent the observe -> understand-screen -> reproduce -> diagnose -> fix -> understand-screen -> compare loop, how to read metrics honestly, and common error handling. After installing, just say "debug laggy app X" and the agent will know to use rn-observe.

3. AGENTS.md (when the agent works directly in this repo) — already present at the root; the agent reads it automatically.

All 3 can be used at the same time: skill/AGENTS.md teaches the workflow, MCP provides directly callable tools.

Documentation

Current version

  • Android/Windows is the only target of Observer 2.4.0.

  • ADB has no reliable JS FPS signal; the field is returned as available: false, no guessed numbers.

  • JS blocking, route, React renders, and network metadata require development instrumentation in the app.

  • DevTools export via CDP (devtools-export, devtools-profile) and per-request network (metro-network) require Metro running and the app connected to Metro (adb reverse tcp:8081 tcp:8081); not usable when another React Native DevTools session holds the connection.

  • reload --fast uses CDP Page.reload (JS-only); automatically falls back to force-stop when Metro is unavailable.

  • Apps without instrumentation: use metro-network (CDP), app-state (foreground activity, PID), and device-network (device-level byte counters, not app-attributed) as fallback evidence.

  • record (screenrecord) is limited to 180s/clip by Android.

  • Perfetto trace supports Android; deep trace analysis still uses Perfetto UI/Android Studio.

  • CDP commands are queued between processes; external React Native DevTools must still be closed because it doesn't use the observer lock.

  • session stop auto-generates replay; refs in session are stable across reorder/scroll; missing sessions emit EVIDENCE_NOT_RECORDED.

  • understand-screen/MCP understand_screen returns route instrumentation when available, screen state, headline, text/action refs, UI findings, and screenshot/UI-tree evidence; repeated calls detect unchanged loading. Classification is heuristic and text fields are always redacted.

  • ui-model/MCP runtime_ui_model parses TSX with TypeScript AST to get component + file:line, then correlates with instrumentation and native tree. Results distinguish rendered, visible/offscreen/hidden/unmounted/flattened-or-unobserved, enabled, and canPress with reason.

  • The development-only Babel plugin auto-adds source testID and wraps onPress; session stop collects interaction start/success/error, puts testID taps into replay. Never records handler arguments, props, or input values.

  • Observer doesn't capture network bodies by default. Development-only opt-in uses fail-closed allowlists but should still only be used with development fixtures.


RN Agent Observer (English)

RN Agent Observer 2.4.0 is a local runtime observability bridge for React Native/Expo. It uses one shared TypeScript core behind both a CLI and an MCP server, drives Android through ADB/UIAutomator, receives telemetry from development instrumentation, exports console/exceptions/heap/JS CPU profiles through Metro's Chrome DevTools Protocol, captures per-request network traffic without app instrumentation, produces structured screen understanding (state/headline/actions/UI findings) for agents, provides session-stable ref snapshots + diffs + automatically recorded replay scripts, records on-screen video, persists sessions in SQLite, and keeps screenshots/traces/UI trees as on-disk artifacts.

The current release completes Android v1 on Windows: 45 MCP tools, the matching CLI, an Expo demo app with deterministic labs, transparent heuristic diagnosis, and pixel + structural UI comparison.

Requirements

  • Node.js 22.12 or newer

  • pnpm 9.6

  • Android Platform Tools (adb)

  • An Android emulator or physical device with USB debugging enabled

  • An Expo development build if you need app-specific telemetry

Quick Start

pnpm install
pnpm check
adb devices -l
pnpm rn-observe --help
pnpm mcp:check

Point the observer at your Expo/React Native app:

$env:RN_OBSERVER_PROJECT_ROOT = 'C:\path\to\expo-app'
$env:RN_OBSERVER_DEVICE_ID = 'emulator-5554'
# Optional when app.json contains expo.android.package
$env:RN_OBSERVER_APP_ID = 'com.example.app'

pnpm rn-observe launch
pnpm rn-observe observe
pnpm rn-observe understand-screen
pnpm rn-observe ui-model
pnpm rn-observe tap --test-id buy-button
pnpm rn-observe performance
pnpm rn-observe diagnose

Artifacts and SQLite data are created under <projectRoot>/.artifacts/; large binaries are never embedded in MCP responses.

Deterministic demo

pnpm --filter @rn-agent-observer/demo-expo android -- --device <device-name>

The demo ships PerformanceLab, NetworkLab, RenderLab, AnimationLab, ErrorLab, and VisualLab. NetworkLab uses internal fixtures (0/500/2000ms and HTTP 503) so it never depends on Internet services. PerformanceLab reports its intentional 100ms long JS task precisely through instrumentation.

MCP

pnpm mcp:check
pnpm mcp:start

The server speaks stdio. Client configuration and the full list of 45 tools are documented in docs/protocol.md.

Documentation

AI agent integration

Three ways for agents (OpenCode/Claude Code/Cursor/Codex...) to use the observer:

1. MCP server (recommended — structured tools)

{
  "mcpServers": {
    "rn-agent-observer": {
      "command": "node",
      "args": [
        "C:\\abs\\rn-agent-observer\\packages\\mcp-server\\dist\\server.js"
      ],
      "env": {
        "RN_OBSERVER_PROJECT_ROOT": "C:\\path\\to\\expo-app",
        "RN_OBSERVER_DEVICE_ID": "emulator-5554"
      }
    }
  }
}

2. Install as a skill (teaches the agent the debugging workflow via CLI)

npx skills add GinzaTech/rn-agent-observer

The skill lives at skills/rn-agent-observer/SKILL.md — it teaches the observe -> understand-screen -> reproduce -> diagnose -> fix -> understand-screen -> compare loop, how to read metrics honestly, and common failure recovery. After installing, just say "app X feels laggy" and the agent knows to reach for rn-observe.

3. AGENTS.md (when the agent works inside this repo) — already present at the repo root; agents read it automatically.

All three can be combined: the skill/AGENTS.md teach the workflow, MCP provides directly callable tools.

Current boundary

  • Android/Windows is the only supported target of Observer 2.4.0.

  • ADB has no trustworthy JS FPS signal; the field is returned as available: false — values are never guessed.

  • JS blocking, route, React renders, and network metadata require development instrumentation inside the app.

  • CDP features (devtools-export, devtools-profile, metro-network) need Metro running for the right app and the app connected to it (adb reverse tcp:8081 tcp:8081); they cannot attach while another React Native DevTools session holds the connection.

  • reload --fast uses CDP Page.reload (JS-only) and automatically falls back to force-stop when Metro is unavailable.

  • Observer CDP commands queue across processes; external React Native DevTools must still be closed because it does not participate in the observer lock.

  • session stop automatically writes a replay, session refs survive reorder/scroll, and missing sessions produce EVIDENCE_NOT_RECORDED.

  • understand-screen/MCP understand_screen returns the instrumented route when available, screen state, headline, text/action refs, UI findings, and screenshot/UI-tree evidence; repeated calls detect unchanged loading. Classification is heuristic and text-field values are always redacted.

  • ui-model/MCP runtime_ui_model parses TSX with the TypeScript AST for component + file:line, then correlates source with instrumentation and the native tree. It distinguishes rendered, visible/off-screen/hidden/unmounted/flattened-or-unobserved, enabled, and evidence-backed canPress states.

  • The development-only Babel plugin injects a source-derived testID and wraps onPress; session stop collects interaction start/success/error and promotes testID taps into replay. Handler arguments, props, and input values are never recorded.

  • Network body capture is off by default. Development-only opt-in uses fail-closed allowlists and should still be limited to fixtures.

  • Apps without instrumentation: use metro-network (CDP), app-state (foreground activity, PID), and device-network (device-level byte counters, not app-attributed) as fallback evidence.

  • record (screenrecord) is limited to 180s per clip by Android.

  • Perfetto tracing is supported on Android; deep trace analysis remains in Perfetto UI/Android Studio.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    A
    maintenance
    This MCP server enables real-time debugging and inspection of running React Native apps, providing access to console logs, errors, network requests, navigation state, storage, and performance profiling.
    1
    MIT
  • A
    license
    Not graded
    quality
    A
    maintenance
    A plugin-based MCP server for React Native runtime debugging, inspection, and automation via Chrome DevTools Protocol. Works with Expo, bare React Native, and any Metro + Hermes project without app code changes.
    818 npm
    79
    MIT
  • F
    license
    Not graded
    quality
    A
    maintenance
    MCP server that provides AI coding agents real Android development tools—Gradle, adb, logcat, lint, crash triage—through a local, permissioned interface. Enables agents to inspect projects, run safe Gradle tasks, capture logs/screenshots, and triage crashes.
    1
    -