rn-agent-observer
RN Agent Observer
DE · English
RN Agent Observer 2.4.0 ist eine lokale Laufzeit-Beobachtungsbrücke für React Native/Expo. Das Tool verwendet denselben TypeScript-Kern für CLI und MCP, steuert Android über ADB/UIAutomator, empfängt Telemetrie von Entwicklungs-Instrumentierung, exportiert Console/Exception/Heap/JS-CPU-Profile über das Chrome DevTools Protocol von Metro, erfasst Netzwerkverkehr pro Anfrage ohne Instrumentierung, erstellt Screen-Understanding mit State/Headline/Actions/UI-Findings für Agenten, bietet sessionstabile Ref-Snapshots + Diff + automatisch aufgezeichnete Replays, nimmt Bildschirmvideos auf, speichert Sitzungen in SQLite und hält Bilder/Traces/UI-Bäume als Artefakte auf der Festplatte.
Die aktuelle Version schließt Android v1 unter Windows ab: 45 MCP-Tools, das passende CLI, eine Expo-Demo mit deterministischen Labs, transparente heuristische Diagnose und Bild- + UI-Strukturvergleich.
Anforderungen
Node.js 22.12 oder neuer
pnpm 9.6
Android Platform Tools (
adb)Android-Emulator oder physisches Gerät mit aktiviertem USB-Debugging
Expo-Development-Build, falls anwendungsspezifische Telemetrie benötigt wird
Related MCP server: React Native MCP Server
Schnellstart
pnpm install
pnpm check
adb devices -l
pnpm rn-observe --help
pnpm mcp:checkRichten Sie den Observer auf Ihre 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 diagnoseArtefakte und SQLite-Daten werden unter <projectRoot>/.artifacts/ erstellt; große Binärdateien werden nie in MCP-Antworten eingebettet.
Deterministische Demo
pnpm --filter @rn-agent-observer/demo-expo android -- --device <device-name>Die Demo enthält PerformanceLab, NetworkLab, RenderLab, AnimationLab, ErrorLab und VisualLab. NetworkLab verwendet interne Fixtures (0/500/2000ms und HTTP 503) und hängt daher nicht von Internetdiensten ab. PerformanceLab meldet seinen absichtlichen 100ms-Long-JS-Task präzise über die Instrumentierung.
MCP
pnpm mcp:check
pnpm mcp:startDer Server spricht stdio. Client-Konfiguration und die vollständige Liste der 45 Tools finden Sie in docs/protocol.md.
Integration für KI-Agenten
Es gibt drei Möglichkeiten, wie Agenten (OpenCode/Claude Code/Cursor/Codex...) den Observer nutzen können:
1. MCP-Server (empfohlen — strukturierte 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. Als Skill installieren (bringt dem Agenten den Debug-Workflow über CLI bei)
npx skills add GinzaTech/rn-agent-observerDer Skill liegt unter skills/rn-agent-observer/SKILL.md — er lehrt den Agenten die Schleife observe -> understand-screen -> reproduce -> diagnose -> fix -> understand-screen -> compare, wie man Metriken ehrlich liest und häufige Fehler behebt. Nach der Installation genügt „debug app X, die laggt", und der Agent weiß automatisch, rn-observe zu verwenden.
3. AGENTS.md (wenn der Agent direkt in diesem Repo arbeitet) — bereits im Root vorhanden; Agenten lesen es automatisch.
Alle drei Wege können kombiniert werden: Skill/AGENTS.md lehrt den Workflow, MCP bietet direkt aufrufbare Tools.
Dokumentation
Aktuelle Grenzen
Android/Windows ist das einzige unterstützte Ziel von Observer 2.4.0.
ADB hat kein vertrauenswürdiges JS-FPS-Signal; das Feld wird als
available: falsezurückgegeben — Werte werden nie geraten.JS-Blocking, Route, React-Renders und Netzwerk-Metadaten erfordern Entwicklungs-Instrumentierung in der App.
CDP-Funktionen (
devtools-export,devtools-profile) und Netzwerk pro Anfrage (metro-network) benötigen ein laufendes Metro und eine App, die mit Metro verbunden ist (adb reverse tcp:8081 tcp:8081); sie können nicht verwendet werden, während eine andere React-Native-DevTools-Sitzung die Verbindung hält.reload --fastverwendet CDP Page.reload (nur JS) und fällt automatisch auf force-stop zurück, wenn Metro nicht verfügbar ist.Apps ohne Instrumentierung: Verwenden Sie
metro-network(CDP),app-state(Vordergrund-Activity, PID) unddevice-network(Byte-Zähler auf Geräteebene, nicht der App zugeordnet) als Fallback-Evidenz.record(screenrecord) ist von Android auf 180s pro Clip begrenzt.Perfetto-Tracing wird auf Android unterstützt; tiefgehende Trace-Analyse bleibt in Perfetto UI/Android Studio.
Observer-CDP-Befehle werden über Prozesse hinweg in die Warteschlange gestellt; externes React Native DevTools muss weiterhin geschlossen sein, da es nicht am Observer-Lock teilnimmt.
session stopschreibt automatisch ein Replay; Session-Refs überstehen Reorder/Scroll; fehlende Sessions erzeugenEVIDENCE_NOT_RECORDED.understand-screen/MCPunderstand_screengibt die instrumentierte Route zurück, wenn verfügbar, Screen-State, Headline, Text/Action-Refs, UI-Findings und Screenshot/UI-Tree-Evidenz; wiederholte Aufrufe erkennen unverändertes Laden. Die Klassifizierung ist heuristisch und Textfeld-Werte werden immer redigiert.ui-model/MCPruntime_ui_modelparst TSX mit dem TypeScript-AST für Komponente +file:lineund korreliert dann mit Instrumentierung und nativem Baum. Es unterscheidetrendered,visible/offscreen/hidden/unmounted/flattened-or-unobserved,enabledundcanPressmit Begründung.Das nur für die Entwicklung gedachte Babel-Plugin fügt automatisch einen quellbasierten testID hinzu und umschließt
onPress; Session-Stop erfasst Interaktionenstart/success/errorund übernimmt Taps mit testID ins Replay. Handler-Argumente, Props und Eingabewerte werden nie aufgezeichnet.Netzwerk-Bodies werden standardmäßig nicht erfasst. Das Nur-Entwicklungs-Opt-in verwendet Fail-Closed-Allowlists und sollte weiterhin auf Fixtures beschränkt bleiben.
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:checkPoint 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 diagnoseArtifacts 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:startThe 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-observerThe 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 --fastuses 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 stopautomatically writes a replay, session refs survive reorder/scroll, and missing sessions produceEVIDENCE_NOT_RECORDED.understand-screen/MCPunderstand_screenreturns 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/MCPruntime_ui_modelparses 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-backedcanPressstates.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), anddevice-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.
This server cannot be deployed
Maintenance
Related MCP Connectors
Remote MCP for Android CLI agent build gate, structured receipts, audit logs, and reviewer-ready evi
Capture, inspect & debug HTTPS traffic across iOS, Android, browsers & backends — 304 MCP tools.
- AgentCatOAuthcom.agentcat
Analytics and debugging for your MCP server — explore usage and sessions, then root-cause errors.
Developer utility MCP: screenshots, PDFs, OG, QR, link preview, JSON validate, ShipPack.
Related MCP Servers
- AlicenseNot gradedqualityAmaintenanceThis 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.1MIT
- AlicenseNot gradedqualityDmaintenanceEnables automation and monitoring of React Native apps by providing tools to tap, swipe, screenshot, inspect component state, profile renders, and mock network requests via MCP.3 npm7MIT
- AlicenseNot gradedqualityAmaintenanceA 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.822 npm85MIT
- AlicenseBqualityBmaintenanceAn MCP server that gives AI agents hands-on control of a live React Native app, enabling UI taps, screenshots, UI/component trees, native logs, and JS/React profiling to debug, verify fixes, and diagnose performance issues.164 npmMIT