react-native-mcp-server

v0.1.0-rc.14
@ohah/react-native-mcp-server Checked 2 days ago Published 8 months ago

MCP server for React Native app automation and monitoring

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

evaluate_script

Run JS in React Native app context (not WebView). Returns JSON result. For WebView JS, use webview_evaluate_script. Use measureView(uid) for coords.

ParameterTypeDescription
function *stringJS function string. E.g. "() => measureView(uid)". require() not available.
argsarrayArguments array for the function.
deviceIdstringTarget device ID. Auto if single device. Use get_debugger_status to list.
platformstringTarget platform. Auto when single device of that platform.

take_snapshot

Capture component tree. Compact text output. uid = testID or path for tap/swipe. Use interactive=true for minimal token usage.

ParameterTypeDescription
deviceIdstringTarget device ID. Auto if single device. Use get_debugger_status to list.
interactivebooleanIf true, show only interactive elements (Touchable, Button, TextInput, Switch, etc.).
maxDepthintegerMax tree depth. Default 30.
platformstringTarget platform. Auto when single device of that platform.

take_screenshot

Capture device screen as JPEG. EXPENSIVE: consumes large image tokens. Prefer text-based tools first: query_selector/assert_text for native UI, webview_evaluate_script for WebView DOM. Use screenshot only when visual layout check is needed or text tools cannot verify the state. After one screenshot, switch back to text-based tools.

ParameterTypeDescription
platform *stringandroid: adb. ios: simctl (simulator only).
filePathstringPath to save screenshot.

accessibility_audit

Run accessibility audit on component tree. Returns violations with rule, selector, and severity.

ParameterTypeDescription
deviceIdstringTarget device ID. Auto if single device. Use get_debugger_status to list.
maxDepthintegerMax tree depth. Default 999.
platformstringTarget platform. Auto when single device of that platform.

webview_evaluate_script

Run JS inside a WebView (DOM query, click, read text, etc). Use this instead of tap for any WebView content — tap cannot target DOM elements. Get webViewId via evaluate_script with getRegisteredWebViewIds().

ParameterTypeDescription
script *stringJS to run in WebView (DOM query, click, etc). Must evaluate to value for result.
webViewId *stringWebView id. Use evaluate_script getRegisteredWebViewIds() to discover.
deviceIdstringTarget device ID. Auto if single device. Use get_debugger_status to list.
platformstringTarget platform. Auto when single device of that platform.

type_text

Type text into TextInput by uid (from query_selector). Supports Unicode. Use instead of input_text for non-ASCII.

ParameterTypeDescription
text *stringText to type.
uid *stringtestID or path of TextInput. Get from query_selector first.
deviceIdstringTarget device ID. Auto if single device. Use get_debugger_status to list.
platformstringTarget platform. Auto when single device of that platform.

query_selector

Find first RN element matching selector. Returns uid, type, and position (pageX, pageY, width, height) in points — use these coordinates directly with tap. For WebView inner elements, use webview_evaluate_script instead.

ParameterTypeDescription
selector *stringSelector for RN Fiber tree. Read resource docs://guides/query-selector-syntax for full syntax (type, #testID, :text, hierarchy, etc.).
deviceIdstringTarget device ID. Auto if single device. Use get_debugger_status to list.
platformstringTarget platform. Auto when single device of that platform.

query_selector_all

Find all RN elements matching selector. Returns array with positions (pageX, pageY, width, height) in points. Use query_selector for single element.

ParameterTypeDescription
selector *stringSelector for RN Fiber tree. Read resource docs://guides/query-selector-syntax for full syntax (type, #testID, :text, hierarchy, etc.).
deviceIdstringTarget device ID. Auto if single device. Use get_debugger_status to list.
platformstringTarget platform. Auto when single device of that platform.

get_component_source

Get source file location (file, line, column) for a component. Use selector or uid from take_snapshot.

ParameterTypeDescription
deviceIdstringTarget device ID. Auto if single device. Use get_debugger_status to list.
platformstringTarget platform. Auto when single device of that platform.
selectorstringSelector to find the component. If omitted, uid is required.
uidstringuid from take_snapshot (testID or path like "0.1.2"). If omitted, selector is required.

assert_text

Assert text exists on screen. Supports polling via timeoutMs.

ParameterTypeDescription
text *stringText substring to assert exists on screen
deviceIdstringTarget device ID. Auto if single device. Use get_debugger_status to list.
intervalMsnumberPoll interval ms. Used only when timeoutMs > 0.
platformstringTarget platform. Auto when single device of that platform.
selectorstringOptional selector to narrow scope.
timeoutMsnumberMax wait ms. 0 = single check; >0 = poll until pass or timeout.

assert_visible

Assert element matching selector is visible. Supports polling via timeoutMs.

ParameterTypeDescription
selector *stringSelector to check visibility.
deviceIdstringTarget device ID. Auto if single device. Use get_debugger_status to list.
intervalMsnumberPoll interval ms. Used only when timeoutMs > 0.
platformstringTarget platform. Auto when single device of that platform.
timeoutMsnumberMax wait ms. 0 = single check; >0 = poll until pass or timeout.

assert_not_visible

Assert element matching selector is NOT visible. Supports polling via timeoutMs.

ParameterTypeDescription
selector *stringSelector of element that must not be visible.
deviceIdstringTarget device ID. Auto if single device. Use get_debugger_status to list.
intervalMsnumberPoll interval ms. Used only when timeoutMs > 0.
platformstringTarget platform. Auto when single device of that platform.
timeoutMsnumberMax wait ms. 0 = single check; >0 = poll until pass or timeout.

assert_element_count

Assert element count matching selector. Use expectedCount or minCount/maxCount range.

ParameterTypeDescription
selector *stringSelector to count matching elements.
deviceIdstringTarget device ID. Auto if single device. Use get_debugger_status to list.
expectedCountnumberExact count. Mutually exclusive with min/maxCount.
intervalMsnumberPoll interval ms. Used only when timeoutMs > 0.
maxCountnumberMax count (inclusive).
minCountnumberMin count (inclusive).
platformstringTarget platform. Auto when single device of that platform.
timeoutMsnumberMax wait ms. 0 = single check; >0 = poll until pass or timeout.

get_debugger_status

MCP connection status. appConnected, devices list (deviceId, platform). Call first to see connected devices.

ParameterTypeDescription
deviceIdstringTarget device for topInsetDp override.
topInsetDpnumberSet Android top inset override (dp). Overrides ADB auto-detect. Persists for the connection.

list_console_messages

List captured console logs. Filter by level, since, limit. Levels: log, info, warn, error.

ParameterTypeDescription
deviceIdstringTarget device ID. Auto if single device. Use get_debugger_status to list.
levelstringFilter by level. Omit for all.
limitnumberMax logs. Default 100.
platformstringTarget platform. Auto when single device of that platform.
sincenumberOnly logs after timestamp (ms).

list_network_requests

List captured network requests. Filter by url, method, status, since, limit.

ParameterTypeDescription
deviceIdstringTarget device ID. Auto if single device. Use get_debugger_status to list.
limitnumberMax requests. Default 50.
methodstringHTTP method filter.
platformstringTarget platform. Auto when single device of that platform.
sincenumberOnly requests after timestamp (ms).
statusnumberStatus code filter.
urlstringURL substring filter.

clear

Clear one buffer: console logs, network requests, network mocks, state changes, or render profile. Use target param. App data reset is clear_state.

ParameterTypeDescription
target *stringWhich buffer to clear: console logs, network requests, network mocks, state changes, or render profile data.
deviceIdstringTarget device ID. Auto if single device. Use get_debugger_status to list.
platformstringTarget platform. Auto when single device of that platform.

tap

Tap at (x,y) in points. Get coordinates from query_selector (pageX/pageY). For WebView DOM elements, use webview_evaluate_script instead. Long press via duration param.

ParameterTypeDescription
platform *stringios or android.
x *numberX in points (dp). Pixels auto on Android.
y *numberY in points (dp). Pixels auto on Android.
deviceIdstringDevice ID. Auto if single. list_devices to find.
durationnumberHold ms for long press. Omit for tap.
iosOrientationnumberiOS orientation 1-4. Portrait=1,2; Landscape=3,4. Skips auto-detect.

swipe

Swipe from (x1,y1) to (x2,y2) in points. Get coordinates from query_selector. For scrolling and drawers.

ParameterTypeDescription
platform *stringTarget platform.
x1 *numberStart X in points (dp). Auto-converted to pixels on Android.
x2 *numberEnd X in points (dp). Auto-converted to pixels on Android.
y1 *numberStart Y in points (dp). Auto-converted to pixels on Android.
y2 *numberEnd Y in points (dp). Auto-converted to pixels on Android.
deviceIdstringDevice ID. Auto if single. list_devices to find.
durationnumberSwipe duration ms. Default 300.
iosOrientationnumberiOS orientation 1-4. Skips auto-detect.

input_text

Type into focused input. ASCII only. Use type_text for Korean/Unicode.

ParameterTypeDescription
platform *stringTarget platform.
text *stringText to type. ASCII only. Use type_text for Unicode.
deviceIdstringDevice ID. Auto if single. list_devices to find.

input_key

Send key event to device (Return, Backspace, ENTER, BACK, etc.).

ParameterTypeDescription
keycode *numberKeycode. iOS: 40=Return, 42=Backspace, 44=Space, 41=Escape. Android: 4=BACK, 66=ENTER, 67=DEL.
platform *stringTarget platform.
deviceIdstringDevice ID. Auto if single. list_devices to find.

press_button

Press hardware button (HOME, BACK, LOCK, VOLUME, etc.).

ParameterTypeDescription
button *stringAndroid: HOME, BACK, MENU, APP_SWITCH, POWER, VOLUME_UP/DOWN, ENTER, DEL. iOS: HOME, LOCK, SIDE_BUTTON.
platform *stringTarget platform.
deviceIdstringDevice ID. Auto if single. list_devices to find.
durationnumberHold seconds. iOS only.

describe_ui

Query native UI/accessibility tree. Large payload. Cannot see inside WebView content. Prefer query_selector for RN elements, webview_evaluate_script for WebView DOM.

ParameterTypeDescription
platform *stringTarget platform.
deviceIdstringDevice ID. Auto if single. list_devices to find.
modestringiOS: "all" or "point" at (x,y). Android: ignored.
nestedbooleaniOS: hierarchical tree. Android: ignored.
xnumberX in points. iOS, required for mode=point.
ynumberY in points. iOS, required for mode=point.

file_push

Push local file to device. iOS requires bundleId.

ParameterTypeDescription
localPath *stringAbsolute path to the local file to push.
platform *stringTarget platform.
remotePath *stringDestination. iOS: in app container. Android: e.g. /sdcard/Download/file.txt.
bundleIdstringBundle ID. iOS only, required.
deviceIdstringDevice ID. Auto if single. list_devices to find.

add_media

Add images/videos to simulator photo library or device gallery.

ParameterTypeDescription
filePaths *arrayAbsolute paths to images/videos for gallery.
platform *stringTarget platform.
deviceIdstringDevice ID. Auto if single. list_devices to find.

list_devices

List connected simulators/devices. Returns deviceId, state, model. Use for other tools.

ParameterTypeDescription
platform *stringios: idb simulators. android: adb devices.

list_apps

List installed apps. No app connection required. Returns bundle IDs or package names.

ParameterTypeDescription
platform *stringTarget platform. list_devices for deviceId.
deviceIdstringOptional. iOS: UDID. Android: serial. Auto if single device.

terminate_app

Terminate app by bundle ID or package name. No app connection required.

ParameterTypeDescription
appId *stringiOS bundle ID or Android package name (e.g. com.example.app). Use list_apps to find IDs.
platform *stringTarget platform.
deviceIdstringOptional. iOS: UDID. Android: serial. Auto if single device.

get_orientation

Get current device orientation (portrait/landscape). No app connection required.

ParameterTypeDescription
platform *stringTarget platform.
deviceIdstringOptional. iOS: UDID. Android: serial. Auto if single device.

set_orientation

Set device orientation to portrait or landscape. iOS: simulator only.

ParameterTypeDescription
orientation *stringDesired orientation. Android: 0 or 1. iOS: one rotation toggles.
platform *stringTarget platform.
deviceIdstringOptional. iOS: UDID. Android: serial. Auto if single device.

get_screen_size

Get screen size (width/height in px). iOS requires app connection.

ParameterTypeDescription
platform *stringTarget platform.
deviceIdstringOptional. iOS: UDID. Android: serial. Auto if single device.

switch_keyboard

Switch keyboard language on simulator/emulator. Use before input_text for correct layout.

ParameterTypeDescription
action *stringlist: available keyboards. get: current. switch: toggle (iOS) or set IME (Android).
platform *stringTarget platform.
keyboard_idstringAndroid switch only. IME ID. Use action=list to see IDs.

clear_state

Clear app data (Android) or reset permissions (iOS). iOS full reset needs uninstall+reinstall.

ParameterTypeDescription
appId *stringBundle ID (iOS) or package name (Android).
platform *stringTarget platform.
deviceIdstringOptional. iOS: UDID. Android: serial. Auto if single device.

set_location

Set GPS on iOS simulator or Android emulator. Android: emulator only.

ParameterTypeDescription
latitude *numberLatitude (-90–90).
longitude *numberLongitude (-180–180).
platform *stringTarget platform.
deviceIdstringOptional. iOS: UDID. Android: serial. Auto if single device.

scroll_until_visible

Scroll until RN element matching selector becomes visible. For long lists and off-screen elements. After scrolling, use query_selector to get the element position for tap.

ParameterTypeDescription
platform *stringTarget platform.
selector *stringSelector of element to find.
deviceIdstringDevice ID. Auto if single.
directionstringScroll direction. Default "down".
iosOrientationnumberiOS orientation 1-4. Skips auto-detect.
maxScrollsnumberMax scroll attempts. Default 10.
scrollableSelectorstringSelector for scroll container. Omit to use center.

inspect_state

Inspect React state hooks by selector. Works with useState, Zustand, etc.

ParameterTypeDescription
selector *stringSelector for component (e.g. CartScreen, #cart-view).
deviceIdstringTarget device ID. Auto if single device. Use get_debugger_status to list.
platformstringTarget platform. Auto when single device of that platform.

get_state_changes

List captured state changes. Filter by component, since, limit.

ParameterTypeDescription
componentstringFilter by component name. Omit for all.
deviceIdstringTarget device ID. Auto if single device. Use get_debugger_status to list.
limitnumberMax changes to return. Default 100.
platformstringTarget platform. Auto when single device of that platform.
sincenumberOnly changes after timestamp (ms).

assert_state

Assert React state hook value matches expected. Use with selector and hookIndex.

ParameterTypeDescription
expected *Expected value. Number, string, boolean, or JSON object/array.
selector *stringSelector for component (e.g. #cart-view, CartScreen).
deviceIdstringTarget device ID. Auto if single device. Use get_debugger_status to list.
hookIndexintegerZero-based hook index. Default 0.
pathstringDot-notation path into hook value (e.g. "items.length"). Omit to compare whole value.
platformstringTarget platform. Auto when single device of that platform.

set_network_mock

Add network mock. Matching XHR/fetch return mock without hitting network.

ParameterTypeDescription
urlPattern *stringURL pattern (substring or regex).
bodystringMock body.
delaynumberDelay ms before mock.
deviceIdstringTarget device ID. Auto if single device. Use get_debugger_status to list.
headersobjectMock headers.
isRegexbooleanurlPattern is regex.
methodstringHTTP method. Omit to match all.
platformstringTarget platform. Auto when single device of that platform.
statusnumberMock status. Default 200.
statusTextstringMock status text.

list_network_mocks

List all active network mock rules.

ParameterTypeDescription
deviceIdstringTarget device ID. Auto if single device. Use get_debugger_status to list.
platformstringTarget platform. Auto when single device of that platform.

remove_network_mock

Remove a specific network mock rule by ID.

ParameterTypeDescription
id *numberMock rule ID to remove.
deviceIdstringTarget device ID. Auto if single device. Use get_debugger_status to list.
platformstringTarget platform. Auto when single device of that platform.

visual_compare

Visual regression: capture current screen (or crop by selector), pixel-diff against baseline PNG; use to verify UI didn’t change or to update baseline.

ParameterTypeDescription
baseline *stringAbsolute path to baseline PNG file.
platform *stringTarget platform.
deviceIdstring
saveCurrentstringPath to save current screenshot PNG.
saveDiffstringPath to save diff image PNG.
selectorstringCSS-like selector to crop a specific element. If omitted, compares full screen.
thresholdnumberpixelmatch threshold (0~1). Default 0.1.
updateBaselinebooleanIf true, save current screenshot as new baseline and skip comparison.

start_render_profile

Start render profiling. Tracks mounts, re-renders, and unnecessary renders.

ParameterTypeDescription
componentsarrayWhitelist: track only these components. Overrides ignore.
deviceIdstringTarget device ID. Auto if single device. Use get_debugger_status to list.
ignorearrayBlacklist: skip these components (added to default ignore list). Ignored when components is set.
platformstringTarget platform. Auto when single device of that platform.

get_render_report

Get render profile report. Shows hot components, unnecessary renders, and trigger analysis.

ParameterTypeDescription
deviceIdstringTarget device ID. Auto if single device. Use get_debugger_status to list.
platformstringTarget platform. Auto when single device of that platform.

start_render_highlight

Show visual re-render overlay on device. Highlights re-rendering components with count badges.

ParameterTypeDescription
componentsarrayWhitelist: highlight only these components. Overrides ignore.
deviceIdstringTarget device ID. Auto if single device. Use get_debugger_status to list.
fadeTimeoutnumberMilliseconds before highlights fade out. Default: 500 (react-scan native align).
ignorearrayBlacklist: skip these components (added to default ignore list).
maxHighlightsnumberMaximum simultaneous highlights on screen. Default: 100.
platformstringTarget platform. Auto when single device of that platform.
showLabelsbooleanShow component name labels on each highlight rect. Default: false.

stop_render_highlight

Stop React component render overlay. Removes highlight rects and resets counts.

ParameterTypeDescription
deviceIdstringTarget device ID. Auto if single device. Use get_debugger_status to list.
platformstringTarget platform. Auto when single device of that platform.

start_video_recording

Start screen recording. Call stop_video_recording to save.

ParameterTypeDescription
filePath *stringHost path to save the recording (must be under e2e-artifacts or cwd).
platform *stringios or android.
deviceIdstringDevice ID. iOS: udid, Android: serial. Omit for single device.

stop_video_recording

Stop the current screen recording and return the saved file path.

ParameterTypeDescription
platformstringPlatform to stop. Omit when only one recording.