rn-devtools-mcp
v0.1.0
Published
`rn-devtools-mcp` lets your coding agent control and inspect a live React Native Hermes runtime through the Metro inspector proxy (`/json/list`) and CDP WebSocket targets.
Readme
rn-devtools-mcp
rn-devtools-mcp lets your coding agent control and inspect a live React Native Hermes runtime through the Metro inspector proxy (/json/list) and CDP WebSocket targets.
It runs as an MCP server (stdio) and exposes React Native debugging primitives as MCP tools for reliable automation, runtime debugging, and evidence collection.
Tool Reference | Changelog | Contributing | Troubleshooting | Design Principles
Key features
- Metro target discovery: discovers debuggable RN targets via
/json/listand/json/version. - Hermes runtime debugging: evaluate scripts, pause/resume/step, and manage breakpoints.
- CDP coverage via aliases: use dedicated tool aliases or the generic
rn_cdp_call. - Evidence buffers: capture recent console, network, debugger, and exception events for analysis.
- Reconnect-aware sessions: reconnect logic for app reload/disconnect cycles.
Disclaimers
rn-devtools-mcp can inspect and execute code in the connected React Native runtime. Treat connected app data as sensitive.
- Do not connect this server to apps/environments containing secrets you do not want MCP clients to access.
- This server does not sandbox CDP commands; callers with MCP access can issue powerful runtime/debugger commands.
Requirements
- Node.js 20+
- npm
- React Native app running in development mode
- Metro dev server reachable from the MCP server process
Getting started
Install dependencies:
npm installRun MCP server (stdio):
npm run devDefault MCP client configuration:
{
"mcpServers": {
"rn-devtools": {
"command": "node",
"args": ["/absolute/path/to/rn-devtools-mcp/dist/index.js"]
}
}
}During development, use tsx entry directly:
{
"mcpServers": {
"rn-devtools": {
"command": "npx",
"args": ["tsx", "/absolute/path/to/rn-devtools-mcp/src/index.ts"]
}
}
}Client setup examples
Codex
codex mcp add rn-devtools -- npx tsx /absolute/path/to/rn-devtools-mcp/src/index.tsClaude Code
claude mcp add rn-devtools --scope user npx tsx /absolute/path/to/rn-devtools-mcp/src/index.tsCursor
Configure MCP server command in Cursor Settings -> MCP using one of the JSON snippets above.
Verification
npm test
npm run buildSmoke test against a running RN app:
METRO_URL=http://localhost:8081 npm run smokeIf METRO_URL is omitted, the server probes local candidates:
8081,8082,8083,8088,8090,19000
Override candidate ports:
METRO_PORT_CANDIDATES=18081,18082 npm run smokeTools
If you run into issues, check Troubleshooting.
The catalog below is auto-generated from src/server/tools.ts.
Target & session (5 tools)
Runtime & debugger control (8 tools)
Network & evidence (4 tools)
Generic CDP (1 tool)
CDP alias families
- Runtime aliases (13 tools)
rn_runtime_enablern_runtime_disablern_runtime_discard_console_entriesrn_runtime_get_heap_usagern_runtime_global_lexical_scope_namesrn_runtime_compile_scriptrn_runtime_get_propertiesrn_runtime_call_function_onrn_runtime_release_objectrn_runtime_release_object_grouprn_runtime_run_if_waiting_for_debuggerrn_runtime_add_bindingrn_runtime_remove_binding
- Debugger aliases (9 tools)
- Profiler aliases (2 tools)
- Heap profiler aliases (8 tools)
- Network aliases (3 tools)
- IO aliases (2 tools)
- Tracing aliases (2 tools)
- Log aliases (2 tools)
- Host aliases (2 tools)
- ReactNativeApplication aliases (2 tools)
- Runtime aliases (13 tools)
See full inputs, behavior, and errors in Tool Reference.
Configuration
Environment variables:
METRO_URL: explicit Metro base URL (example:http://localhost:8081)METRO_PORT_CANDIDATES: comma-separated fallback probe ports whenMETRO_URLis not set
Concepts
Target discovery
The server discovers targets from Metro inspector endpoints and selects Hermes targets by default when possible.
Session model
Each connection is represented by sessionKey. Tools that issue CDP commands require a connected session.
Event buffers
The server caches recent events in ring buffers. You can query recent console/network/exception events at any time during a live session.
Known limitations
- Native debugger workflows (LLDB/Android Studio breakpoints) are out of scope.
- CDP support is capability-dependent by RN/Hermes target and version.
- Some CDP commands may fail with
RN_CDP_METHOD_UNSUPPORTED,RN_CDP_METHOD_NOT_FOUND, or other command errors.
License
MIT - see LICENSE.
