Metro MCP
v0.15.0MCP server for React Native/Expo runtime debugging, inspection, and automation via Metro/CDP
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
get_console_logs
Get recent console output. Filter by level or search text.
| Parameter | Type | Description |
|---|---|---|
device | string | Device key or "all" for aggregated logs. Defaults to current device. |
format | string | Return 'json' for a structured array of log entries |
level | string | Filter by log level |
limit | number | Maximum number of logs to return |
search | string | Search text to filter logs |
since | number | Only return entries after this Unix timestamp (ms). Pass the timestamp of the last seen entry to fetch only new ones. |
summary | boolean | Return a one-line summary with counts |
clear_console_logs
Clear the console log buffer.
| Parameter | Type | Description |
|---|---|---|
device | string | Device key to clear, or omit for current device. Use "all" to clear all. |
get_network_requests
Get recent network requests from the React Native app.
| Parameter | Type | Description |
|---|---|---|
device | string | Device key or "all" for aggregated requests. Defaults to current device. |
format | string | Return 'json' for a structured array of request objects |
limit | number | Maximum number of requests to return |
since | number | Only return requests after this Unix timestamp (ms). Pass the timestamp of the last seen entry to fetch only new ones. |
summary | boolean | Return a one-line summary with counts |
get_request_details
Get full details of a specific network request including headers and body.
| Parameter | Type | Description |
|---|---|---|
url * | string | URL or partial URL to find the request |
device | string | Device key or "all". Defaults to current device. |
index | number | Index of the request if multiple match (-1 for last) |
get_response_body
Get response body for a network request (cached if small; requires active session if large).
| Parameter | Type | Description |
|---|---|---|
url * | string | URL or partial URL to find the request |
device | string | Device key or "all". Defaults to current device. |
index | number | Index of the request if multiple match (-1 for last) |
search_network
Search network requests by URL pattern, method, or status code.
| Parameter | Type | Description |
|---|---|---|
device | string | Device key or "all". Defaults to current device. |
errorsOnly | boolean | Show only failed requests |
limit | number | Maximum number of results to return |
method | string | HTTP method filter |
statusCode | number | HTTP status code filter |
urlPattern | string | URL substring or regex pattern |
clear_network_requests
Clear the network request buffer.
| Parameter | Type | Description |
|---|---|---|
device | string | Device key to clear, or omit for current device. Use "all" to clear all. |
get_network_stats
Get aggregated network statistics: breakdown by domain, status code, and response times.
| Parameter | Type | Description |
|---|---|---|
device | string | Device key or "all". Defaults to current device. |
get_errors
Get recent uncaught exceptions from the React Native app.
| Parameter | Type | Description |
|---|---|---|
device | string | Device key or "all" for aggregated errors. Defaults to current device. |
format | string | Return 'json' for a structured array of error entries |
limit | number | Maximum number of errors to return |
since | number | Only return entries after this Unix timestamp (ms). Pass the timestamp of the last seen entry to fetch only new ones. |
summary | boolean | Return a one-line summary with counts |
clear_errors
Clear the error buffer.
| Parameter | Type | Description |
|---|---|---|
device | string | Device key to clear, or omit for current device. Use "all" to clear all. |
get_bundle_errors
Get recent Metro compilation/transform errors.
| Parameter | Type | Description |
|---|---|---|
limit | number | Maximum errors to return |
evaluate_js
Execute a JavaScript expression in the running React Native app and return the result. Use this for inspecting variables, calling functions, or querying app state.
| Parameter | Type | Description |
|---|---|---|
expression * | string | JavaScript expression to evaluate |
awaitPromise | boolean | Wait for promise to resolve if expression returns a promise |
list_devices
List connected devices and debuggable targets from Metro bundler.
| Parameter | Type | Description |
|---|---|---|
rescan | boolean | Rescan all Metro ports |
get_app_info
Get information about the connected React Native app (bundle URL, platform, device name).
get_connection_status
Check the connection status to Metro bundler.
reload_app
Reload the connected app and verify a fresh runtime. Uses Page.reload, with a directed Metro message fallback only for a verified app/device peer.
| Parameter | Type | Description |
|---|---|---|
timeout | integer | Maximum time in milliseconds to submit and verify the reload |
symbolicate
Symbolicate a stack trace using Metro bundler source maps. Converts minified/bundled locations back to original source files.
| Parameter | Type | Description |
|---|---|---|
stack * | array | Array of stack frames to symbolicate |
get_redux_state
Get the current Redux state tree or a specific slice. Works without client SDK if Redux DevTools extension is present or store is exposed globally.
| Parameter | Type | Description |
|---|---|---|
compact | boolean | Return compact format |
path | string | Dot-separated path to a state slice (e.g., "user.profile") |
dispatch_redux_action
Dispatch a Redux action to the store.
| Parameter | Type | Description |
|---|---|---|
type * | string | Action type |
payload | Action payload |
get_redux_actions
Get recent Redux actions (requires metro-mcp client SDK for real-time tracking).
| Parameter | Type | Description |
|---|---|---|
limit | number | Maximum actions to return |
get_component_tree
Get a paged flat React component tree. Follow nextCursor to complete the snapshot and check traversal.complete before treating an empty page as authoritative.
| Parameter | Type | Description |
|---|---|---|
cursor | string | Opaque nextCursor returned by the previous page |
maxDepth | integer | Maximum fiber depth to traverse (default 200, maximum 600) |
maxNodes | integer | Maximum fibers to scan (default 1200) |
pageSize | integer | Nodes per page (default 100, maximum 250) |
structureOnly | boolean | Return component names and selectors without props |
find_components
Search for components by name inside the app runtime. Check traversal.complete before treating no matches as definitive.
| Parameter | Type | Description |
|---|---|---|
pattern * | string | Case-insensitive component name pattern |
includeProps | boolean | Include component props in matches |
maxDepth | integer | Maximum fiber depth to traverse (default 200, maximum 600) |
maxNodes | integer | Maximum fibers to scan (default 1200) |
inspect_component
Get props, state, and hooks for the first exact component-name match, with traversal completeness metadata.
| Parameter | Type | Description |
|---|---|---|
name * | string | Exact component name to inspect |
maxDepth | integer | Maximum fiber depth to traverse (default 200, maximum 600) |
maxNodes | integer | Maximum fibers to scan (default 1200) |
get_testable_elements
Get elements with testID or accessibilityLabel. Check traversal.complete before treating an empty elements array as definitive.
| Parameter | Type | Description |
|---|---|---|
maxDepth | integer | Maximum fiber depth to traverse (default 200, maximum 600) |
maxNodes | integer | Maximum fibers to scan (default 1200) |
get_storage_keys
List all AsyncStorage keys in the React Native app.
get_storage_item
Read a specific AsyncStorage key value.
| Parameter | Type | Description |
|---|---|---|
key * | string | AsyncStorage key to read |
get_all_storage
Dump all AsyncStorage key-value pairs.
| Parameter | Type | Description |
|---|---|---|
maxLength | number | Max length for each value |
take_screenshot
Capture a screenshot from the connected iOS simulator or Android device.
| Parameter | Type | Description |
|---|---|---|
delivery | string | Return a retained temporary file path or an inline MCP image |
platform | string | Target platform |
list_simulators
List available iOS simulators or Android emulators.
| Parameter | Type | Description |
|---|---|---|
bootedOnly | boolean | Show only booted/running devices |
platform | string |
install_certificate
Install a root certificate on the iOS simulator or Android device.
| Parameter | Type | Description |
|---|---|---|
certPath * | string | Path to the certificate file |
platform | string |
get_native_logs
Get native platform logs from iOS simulator (syslog) or Android device (logcat).
| Parameter | Type | Description |
|---|---|---|
filter | string | Filter string (process name for iOS, tag for Android) |
lines | number | Number of log lines to return |
platform | string |
app_lifecycle
Launch, terminate, install, or uninstall an app on the simulator/emulator.
| Parameter | Type | Description |
|---|---|---|
action * | string | Action to perform |
bundleId * | string | App bundle identifier (e.g., com.example.app) |
appPath | string | Path to .app or .apk file (for install) |
platform | string |
get_screen_orientation
Get the current screen orientation of the device.
| Parameter | Type | Description |
|---|---|---|
platform | string |
open_deeplink
Open a URL or deep link on the connected iOS simulator or Android device.
| Parameter | Type | Description |
|---|---|---|
url * | string | URL or deep link to open (e.g., "myapp://screen/details" or "https://example.com/path") |
platform | string |
list_url_schemes
List URL schemes registered by an installed iOS app or Android package.
| Parameter | Type | Description |
|---|---|---|
bundleId | string | Bundle ID to check (auto-detected if not provided) |
platform | string | Target platform |
list_permissions
List all app permission statuses on the connected iOS simulator or Android emulator. Returns compact text: one name=status line per permission.
| Parameter | Type | Description |
|---|---|---|
bundleId | string | Bundle ID (iOS) or package name (Android). Auto-detected if omitted. |
platform | string | Target platform |
grant_permission
Grant a permission to the app on the connected iOS simulator or Android emulator.
| Parameter | Type | Description |
|---|---|---|
service * | string | iOS: simctl service (calendar, contacts, contacts-limited, location, location-always, microphone, motion, photos, photos-add, media-library, reminders, siri). Android: runtime permission (e.g. "CAMERA… |
bundleId | string | Bundle ID (iOS) or package name (Android). Auto-detected if omitted. |
platform | string | Target platform |
revoke_permission
Revoke a permission from the app on the connected iOS simulator or Android emulator.
| Parameter | Type | Description |
|---|---|---|
service * | string | iOS: simctl service (calendar, contacts, contacts-limited, location, location-always, microphone, motion, photos, photos-add, media-library, reminders, siri). Android: runtime permission (e.g. "CAMERA… |
bundleId | string | Bundle ID (iOS) or package name (Android). Auto-detected if omitted. |
platform | string | Target platform |
reset_permissions
Reset one or all permissions for the app on the connected iOS simulator or Android emulator. On iOS, omitting service resets all services. On Android, omitting service resets all runtime permissions.
| Parameter | Type | Description |
|---|---|---|
bundleId | string | Bundle ID (iOS) or package name (Android). Auto-detected if omitted. |
platform | string | Target platform |
service | string | iOS: specific service to reset (e.g. "location"); omit to reset all. Android: permission name (e.g. "CAMERA"); omit to reset all runtime permissions. |
open_app_settings
Open the connected app's system settings page using React Native Linking.openSettings().
| Parameter | Type | Description |
|---|---|---|
bundleId | string | Bundle ID (iOS) or package name (Android). If supplied, it must match the connected app. |
platform | string | Target platform |
list_elements
Get labelled or interactive elements from the focused React screen. Check traversal.complete before treating an empty elements array as definitive.
| Parameter | Type | Description |
|---|---|---|
interactiveOnly | boolean | Return only elements with onPress handlers |
maxDepth | integer | |
maxNodes | integer |
tap_element
Tap by label, testID, or logical device-point coordinates. Uses React handlers, then installed SimView or IDB on iOS and adb on Android. Coordinates use native input directly; native results identify the backend and dispatch state.
| Parameter | Type | Description |
|---|---|---|
label | string | Accessibility label, aria-label, or testID to tap |
platform | string | |
x | number | X coordinate |
y | number | Y coordinate |
type_text
Type text into an input field. Targets a specific input by testID/label, or the first visible TextInput. Uses the React handler first, then SimView or IDB on iOS and the selected ADB serial on Android.
| Parameter | Type | Description |
|---|---|---|
text * | string | Text to type |
platform | string | |
testID | string | testID or accessibilityLabel of the TextInput to target (defaults to first visible input) |
long_press
Long press using a React handler by label/testID, then semantic native input through SimView or IDB when the handler is unavailable. Explicit coordinates use native input directly; native results identify the backend and dispatch state.
| Parameter | Type | Description |
|---|---|---|
duration | number | Duration in milliseconds |
label | string | Accessibility label or testID of the element to long press |
platform | string | |
x | number | X coordinate |
y | number | Y coordinate |
swipe
Scroll through React, then use installed SimView or IDB on iOS and the selected ADB serial on Android. Native results identify the backend and dispatch state.
| Parameter | Type | Description |
|---|---|---|
direction * | string | Swipe direction |
platform | string |
press_button
Press a device button (HOME, BACK, VOLUME_UP, etc.).
| Parameter | Type | Description |
|---|---|---|
button * | string | Button to press |
platform | string |
get_current_route
Get the currently focused route name and params.
get_route_history
Get the navigation back stack / history.
list_routes
List registered route names from available navigation state. Uninitialized nested navigators are not discoverable.
audit_accessibility
Audit the current screen within bounded Fiber traversal limits. Checks labels, roles, testIDs, and alt text; returns issues, summary, and traversal coverage.
| Parameter | Type | Description |
|---|---|---|
maxDepth | integer | Maximum Fiber depth to inspect |
maxNodes | integer | Maximum Fibers to inspect |
severity | string | Filter by severity level |
check_element_accessibility
Check accessibility properties of a specific component by name or testID.
| Parameter | Type | Description |
|---|---|---|
name | string | Component name to check |
testID | string | testID to find |
get_accessibility_summary
Quick overview: counts of elements with and without proper accessibility props.
list_commands
List all custom commands registered by the app. Commands are registered on global.__METRO_BRIDGE__.commands or global.__METRO_BRIDGE_COMMANDS__.
run_command
Execute a custom command registered by the app. Pass parameters as a JSON object.
| Parameter | Type | Description |
|---|---|---|
name * | string | Command name to execute |
params | object | Parameters to pass to the command |
timeout | number | Max ms to wait for async commands (default 15000) |
start_test_recording
Inject interaction interceptors into the running app via the React fiber tree. Captures taps, text entry, long presses, keyboard submits, and scroll/swipe gestures — with no changes to your app code. Works with ScrollView, FlatList, SectionList, FlashList, and other scroll containers. Call stop_test_recording when done, then generate_test_from_recording to get the test.
stop_test_recording
Stop the active recording, retrieve all captured events, and store them for test generation. Returns a summary of what was recorded. Call generate_test_from_recording next to produce Appium, Maestro, or Detox test code.
generate_test_from_recording
Convert the most recent recording into a test file. Supports three formats: appium (WebdriverIO + Mocha), maestro (YAML), and detox (Jest). Call stop_test_recording first.
| Parameter | Type | Description |
|---|---|---|
format * | string | Output format |
bundleId | string | iOS bundle ID or Android app package |
includeSetup | boolean | Include WDIO configuration usage comments (the runner owns setup and teardown) |
platform | string | Target platform (appium only) |
testName | string | Name for the test / describe block |
generate_wdio_config
Generate a minimal but runnable wdio.conf.ts for Appium + React Native testing, along with the npm install command.
| Parameter | Type | Description |
|---|---|---|
androidAppPath | string | Path to the Android .apk when platform is both |
androidDeviceName | string | Optional Android Appium device name when platform is both |
androidPackageName | string | Android app package when platform is both |
androidPlatformVersion | string | Optional Android version when platform is both |
androidUdid | string | Optional Android device serial when platform is both |
appPath | string | Path to .app / .apk (leave empty to use a running simulator) |
bundleId | string | iOS bundle ID or Android app package |
deviceName | string | Optional Appium device name for a single-platform config |
iosAppPath | string | Path to the iOS .app when platform is both |
iosBundleId | string | iOS bundle ID when platform is both |
iosDeviceName | string | Optional iOS Appium device name when platform is both |
iosPlatformVersion | string | Optional iOS version when platform is both |
iosUdid | string | Optional iOS simulator UDID when platform is both |
noReset | boolean | Preserve installed app data; false allows Appium to reset the app |
outputPath | string | Shown in the output, not written to disk |
platform | string | |
platformVersion | string | Optional OS version for a single-platform config |
udid | string | Optional device UDID / serial for a single-platform config |
add_recording_annotation
Add a human-readable annotation (comment marker) to the current recording. Useful for labelling major flow checkpoints like "reached checkout", "error appeared here", "navigated to payment". Annotations appear as code comments in generated tests.
| Parameter | Type | Description |
|---|---|---|
note * | string | Annotation text to embed in the recording |
save_test_recording
Save the current recording events to disk as JSON so they can be reloaded later. Useful for regenerating the same flow in a different test format without re-recording. Files are saved to ~/.metro-mcp/recordings/<filename>.json.
| Parameter | Type | Description |
|---|---|---|
filename * | string | Name for the saved recording (without .json extension) |
load_test_recording
Load a previously saved recording from disk and make it available for test generation. After loading, call generate_test_from_recording with any format to regenerate the test. Use list_test_recordings to see available files.
| Parameter | Type | Description |
|---|---|---|
filename * | string | Name of the saved recording (without .json extension) |
list_test_recordings
List all previously saved test recordings in ~/.metro-mcp/recordings/. Returns filenames and sizes. Use load_test_recording to load one for test generation.
start_profiling
Start profiling the running React Native app. Primary path: injects into the React DevTools hook (__REACT_DEVTOOLS_GLOBAL_HOOK__) via evalInApp — captures all component render durations without requiring <Profiler> wrappers, works on all architectures. Fallback (legacy arch only): CDP Profiler domain for JS CPU call-graph sampling. Perform the interaction you want to measure, then call stop_profiling.
| Parameter | Type | Description |
|---|---|---|
samplingInterval | integer | CDP fallback only: sampling interval in microseconds (default 1000). |
stop_profiling
Stop profiling and return an analysis of the captured data. DevTools hook mode: returns top components by total render duration across all commits. CDP mode: returns top JS functions by self time and total time. Must call start_profiling first.
| Parameter | Type | Description |
|---|---|---|
includeNative | boolean | CDP mode only: include native/internal Hermes frames. |
topN | integer | Number of top entries to return. |
get_profile_status
Check whether profiling is active, which mode is in use, and whether a previous profile is available.
get_flamegraph
Return the current profiling results as a human-readable text chart. Shows React DevTools component profile (if captured), CPU flamegraph (if CDP profile captured), and React render data from <Profiler> components (if set up). Call stop_profiling first to populate the profile data.
get_react_renders
Read React render timing data collected via <Profiler onRender={trackRender}>. Returns all recorded renders sorted by actualDuration descending, with memoization savings from baseDuration. Requires importing trackRender from metro-mcp/client. Use clear=true to reset the buffer.
| Parameter | Type | Description |
|---|---|---|
clear | boolean | Clear the render buffer after reading. |
get_memory_info
Get current JavaScript heap memory usage from the running app. Returns used heap, total heap, and heap size limit (when available). Call repeatedly to track memory growth over time or to detect leaks.
profile_action
Profile a specific JavaScript expression or code path in a single call. Starts profiling, evaluates the expression, waits for it to complete (plus optional extra duration), then stops and returns the top functions by self time. Use instead of calling start_profiling / stop_profiling manually for focused measurements.
| Parameter | Type | Description |
|---|---|---|
expression * | string | JavaScript expression to profile (can be an async IIFE) |
extraMs | integer | Additional milliseconds to wait after the expression resolves before stopping (default 0) |
topN | integer | Number of top functions to return |
start_heap_sampling
Start Hermes heap allocation sampling via CDP HeapProfiler. Records memory allocation call stacks to identify where objects are being allocated. Call stop_heap_sampling to retrieve the top allocation sites.
| Parameter | Type | Description |
|---|---|---|
samplingInterval | integer | Average bytes between samples (default 32768). Lower = more detail, higher overhead. |
stop_heap_sampling
Stop heap allocation sampling and return the top allocation sites. Shows which functions are allocating the most memory, useful for diagnosing memory leaks. Must call start_heap_sampling first.
| Parameter | Type | Description |
|---|---|---|
topN | integer | Number of top allocation sites to return |
wait_for_element
Poll the component tree until an element matching the given testID or accessibilityLabel appears. Returns element info on success. Use after tap_element, navigate(), or any action that triggers async screen transitions or data loading — instead of immediately calling the next tool. Returns traversal metadata immediately when the bounded search is incomplete.
| Parameter | Type | Description |
|---|---|---|
selector * | string | testID or accessibilityLabel to wait for |
maxDepth | integer | Maximum fiber depth inspected per poll |
maxNodes | integer | Maximum fibers inspected per poll |
pollInterval | integer | How often to check in milliseconds (default 500) |
timeout | integer | Maximum wait time in milliseconds (default 10000) |
wait_for_condition
Poll a JavaScript expression in the app until it returns a truthy value, then return that value. Useful for waiting on state changes, loading flags, API responses, or any async condition. Example: wait for globalThis.myStore?.isLoaded === true.
| Parameter | Type | Description |
|---|---|---|
expression * | string | JS expression to evaluate; polling stops when it returns truthy |
pollInterval | integer | How often to check in milliseconds (default 500) |
timeout | integer | Maximum wait time in milliseconds (default 10000) |
setup_statusline
Writes the Metro CDP connection status script to ~/.claude/metro-mcp-statusline.sh. Does not modify settings.json — tell the user to add it to their status line themselves (e.g. ask Claude: "/statusline add the script at ~/.claude/metro-mcp-statusline.sh"). Only works with Claude Code.
list_debug_globals
Auto-discover well-known global debugging objects (Redux stores, Apollo Client, Expo Router, React DevTools hook, etc.) available in the app runtime.
| Parameter | Type | Description |
|---|---|---|
detailed | boolean | Include top-level keys for each discovered global |
inspect_at_point
Inspect the smallest measured host component at screen coordinates. Uses awaited Fabric/Paper measurement and returns traversal completeness metadata.
| Parameter | Type | Description |
|---|---|---|
x * | number | X coordinate (points/dp) |
y * | number | Y coordinate (points/dp) |
includeProps | boolean | Include component props in the result |
maxDepth | integer | |
maxNodes | integer |
open_devtools
Open the React Native DevTools debugger panel in Chrome. Connects through the CDP proxy so DevTools and the MCP can share the same Hermes connection.
| Parameter | Type | Description |
|---|---|---|
open | boolean | Attempt to open the browser automatically |
get_app_directories
Get known app sandbox directory paths (documents, cache, temp, library). Returns absolute paths usable with list_directory and read_file.
| Parameter | Type | Description |
|---|---|---|
bundleId | string | App bundle ID (iOS, e.g. com.example.app) or package name (Android). Required for iOS; used for Android private-directory resolution. |
platform | string |
list_directory
List files and directories in an app sandbox path. Call get_app_directories first to obtain the root path.
| Parameter | Type | Description |
|---|---|---|
bundleId | string | App bundle ID (iOS) or package name (Android). Required when path is omitted; also used for Android run-as access. |
path | string | Absolute directory path to list. Defaults to the app data container root (bundleId required). |
platform | string | |
recursive | boolean | Recursively list subdirectories (returns raw text) |
read_file
Read the contents of a file from the app sandbox. Enforces a configurable size cap (default 50 KB, max 1 MB) to avoid flooding context.
| Parameter | Type | Description |
|---|---|---|
path * | string | Absolute path to the file |
bundleId | string | App package name (Android, for run-as access to private files) |
encoding | string | Output encoding. Use base64 for binary files (images, SQLite, etc.) |
maxBytes | number | Maximum bytes to read (default 50 KB, hard cap 1 MB) |
platform | string |
get_file_info
Get file or directory metadata: size, modification date, and whether it is a directory.
| Parameter | Type | Description |
|---|---|---|
path * | string | Absolute path to the file or directory |
bundleId | string | App package name (Android, for run-as) |
platform | string |
delete_file
Delete a file from the app sandbox. Requires confirm: true to prevent accidental deletion.
| Parameter | Type | Description |
|---|---|---|
confirm * | boolean | Must be set to true to confirm the deletion |
path * | string | Absolute path to the file to delete |
bundleId | string | App package name (Android, for run-as) |
platform | string |
get_build_info
Return build-time and runtime flags for the running React Native app: __DEV__, platform, OS version, RN version, Hermes engine, New Architecture, and expo-application fields if available.
get_env_vars
Return a filtered subset of process.env from the running app. Credential-like keys (SECRET, KEY, TOKEN, PASSWORD, etc.) are redacted by default. Use filter to search by key name substring.
| Parameter | Type | Description |
|---|---|---|
filter | string | Substring to match against env var key names (case-insensitive) |
includeAll | boolean | When true, includes credential keys that are otherwise redacted |
get_platform_constants
Return the full Platform.constants object from React Native, including OS-specific build details.
get_expo_config
Return expo-constants manifest/expoConfig fields if the app uses Expo, otherwise null.