Expo Agent Bridge

io.github.Rudrasamadhiya由 GitHub 帳號 Rudrasamadhiya 發布v0.3.2更新於 Oct 29, 2026

Let AI agents see, tap, type, scroll, screenshot and debug your Expo app on a real phone.

已驗證STDIO僅桌面瀏覽器自動化開發者工具

概覽

AI 產生的概覽

把 AI 代理接進真機上執行的 Expo/React Native 應用程式,讓它讀取畫面、點擊、輸入、捲動、截圖並除錯。

可以做什麼
  • 檢視應用程式狀態:連線與裝置資訊、目前畫面的精簡文字大綱與元素參照、元素位置與字級、JPEG 截圖。
  • 操作介面:點擊、在輸入框輸入文字、捲動清單、切換開關、跳轉路由或深層連結、等待元素出現、收起鍵盤,並可一次批次執行多個動作。
  • 除錯:讀取主控台日誌與 JS 錯誤、查看 fetch/XHR 請求的狀態與耗時、在應用程式內執行 JavaScript、重新載入 JS 打包檔。
  • 透過 adb 按下 Android 硬體與系統按鍵,例如音量、返回、首頁與電源。
適用情境
適合在開發 Expo 或 React Native 應用程式時,讓代理直接在真機上探索執行中的應用程式、填寫表單、重現問題,或查看某個動作後哪裡出錯,而不必由你手動貼上截圖。它是端對端測試框架的補充,而非替代。
執行需求
電腦需 Node.js 20 或更新版本;應用程式需安裝 expo-mcp-bridge 與 react-native-view-shot,並在根層配置中掛載 AgentBridge 元件。手機與電腦須位於同一個 Wi-Fi 的 LAN 模式;EXPO_MCP_PORT 變數(預設 8347)需與元件的 port 屬性一致。Android 硬體按鍵需要 USB 或 Wi-Fi 偵錯下的 adb。
安裝前請注意
橋接會呼叫應用程式真實的處理函式,點擊與輸入會改變應用程式狀態,可能送出表單或觸發請求。app_eval 會在應用程式內執行任意 JavaScript,預設開啟,可用 allowEval 屬性關閉。日誌與網路請求內容(含請求本文)會暴露給代理。此橋接僅供開發使用,正式版建置中不會生效。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Expo Agent Bridge,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

[expo-mcp-bridge — let your AI agent use your phone app the way it uses a browser]

[npm version] [CI] [node] [MIT license]

Website · Docs · Tools reference · One-shot AI setup · Changelog


expo-mcp-bridge gives AI agents — Claude Code, Antigravity, Cursor and any other MCP client — eyes and hands inside your Expo / React Native app, running live on your real phone. The agent reads the screen, taps, types, scrolls, takes screenshots, reads console errors and network requests, and presses hardware keys. No more pasting screenshots into the chat.

tsx
import { Stack, router } from 'expo-router';import { AgentBridge } from 'expo-mcp-bridge';
export default function RootLayout() {  return (    <>      <Stack />      <AgentBridge router={router} />    </>  );}

"Open the app, try the sign-up form with bad input, and tell me what breaks."

Table of contents

Installation

bash
npx expo install expo-mcp-bridge react-native-view-shotnpx expo-mcp-bridge init

react-native-view-shot powers screenshots and ships with Expo Go; in a custom dev build, rebuild the client once after installing it. init writes your agent's MCP config, installs the agent skill and adds a guide to AGENTS.md.

Requirements: Node.js 20 or newer on your computer · an Expo (or React Native) app · phone and computer on the same Wi-Fi.

Quick start

The one-shot way. Paste this into Claude Code, Antigravity or Cursor inside your Expo project and the agent installs, mounts and verifies everything itself:

text
Read https://raw.githubusercontent.com/Rudrasamadhiya/expo-mcp-bridge/main/AI_SETUP.md and set it up in this project.

By hand, in two minutes:

  1. Install the packages and run init (above).
  2. Mount <AgentBridge /> once, as the last child of your root layout (example at the top of this page).
  3. Run npx expo start in LAN mode and open the app on your phone.
  4. Restart your agent and ask it to do something in the app.

Features

  • Real devices, zero native setup. Expo Go or a dev build, iPhone or Android, over Wi-Fi. One component, no native linking.
  • Token-cheap by design. The agent reads a compact outline of the visible screen — about 70 tokens instead of about 1,000 for a screenshot — and every action returns only what changed.
  • Fast flows. Actions finish the moment the UI settles. app_batch fills a whole form in one call.
  • Sees what broke. New JS errors and failed requests are attached to the action that caused them.
  • Full control. Tap, type, scroll, toggle, navigate, wait, screenshots, layout, logs, network, eval — and volume / back / home keys.
  • Agent skill included. init installs a skill for Claude Code and an AGENTS.md guide for Antigravity, Cursor, Codex and others, so agents use the tools well from the first message.
  • Dev only. In production builds <AgentBridge /> renders its children and nothing else.

What the agent sees

A real login screen, as returned by app_snapshot:

text
scroll [e1]  button "icon:chevron-back" [e2]  text "Welcome back"  input "[email protected]" value="" [e3]  input "••••••••" value="" (secure) [e4]  button "icon:eye" [e5]  button "Log In" [e7]

Tapping e5 (show password) returns just the difference:

text
Tapped.Changes (+ added, - removed):~ input "••••••••" value="" [e4]+ button "icon:eye-off" [e9]- button "icon:eye" [e5]

Common questions

How do I let Claude Code, Cursor or Antigravity see my Expo app?

Install this package, run npx expo-mcp-bridge init, and mount <AgentBridge /> in your root layout. Your agent then gets MCP tools such as app_snapshot (read the visible screen), app_tap, app_type and app_screenshot, and works directly against the app running on your phone.

My AI agent keeps asking me for screenshots of my React Native app. How do I stop that?

That is exactly what this package replaces. Instead of you taking screenshots and pasting them into the chat, the agent calls app_snapshot itself and receives a compact outline of the screen (about 70 tokens instead of about 1,000 for an image), or app_screenshot when it really needs pixels.

Can an AI agent test my React Native app on a real phone?

Yes. The agent taps, types, scrolls and navigates through your real handlers, reads new JS errors and failed network requests after every action, and reports what broke. It works in Expo Go or a dev build, on iPhone and Android, over Wi-Fi.

Does it work with Expo Go?

Yes. Both the bridge and its screenshot dependency (react-native-view-shot) run in Expo Go. No native code, no config plugin and no rebuild are needed.

How is this different from Detox, Maestro or Appium?

Those are end-to-end test frameworks: you write test scripts or flows and run them in CI. expo-mcp-bridge is for development with an AI agent: the agent explores and drives the live app interactively and fixes the code in the same session. It needs no native setup and reads the React tree directly, so it complements a test framework rather than replacing one.

Is it safe to leave in my app?

<AgentBridge /> only runs in development (__DEV__) and only connects to your own computer. In production builds it renders its children and nothing else.

Connecting your agent

init writes .mcp.json for Claude Code. Other agents use the same server:

AgentConfiguration
Claude Code.mcp.json from init, or claude mcp add expo-app -- npx expo-mcp-bridge
Cursornpx expo-mcp-bridge init --cursor writes .cursor/mcp.json
Antigravity, Windsurf, ClineMCP settings: {"mcpServers": {"expo-app": {"command": "npx", "args": ["expo-mcp-bridge"]}}}

On Windows use "command": "cmd", "args": ["/c", "npx", "expo-mcp-bridge"].

Tools

Target elements by ref from a snapshot, by testID, or by visible text. Full parameters are in the tools reference.

Read

ToolDescription
app_statusConnected device, OS, screen size, SDK
app_snapshotOutline of the visible screen with stable refs ([e3])
app_screenshotJPEG of the visible screen; saveTo a file; fullScroll for the whole page as one tall image
app_layoutElement positions (dp) and font sizes

Act

ToolDescription
app_tapPress by ref, testID or text (long: true for a long press)
app_typeFill an input (submit, append)
app_batchSeveral taps, types, scrolls and navigations in one call
app_scrollScroll down, up, left, right, to the top or bottom
app_toggleFlip or set a Switch
app_navigateOpen an expo-router path or deep link (replace keeps the stack shallow)
app_waitWait for text or a testID to appear or disappear
app_dismiss_keyboardHide the on-screen keyboard

Debug

ToolDescription
app_logsConsole logs and JS errors (cursor-based)
app_networkfetch / XHR requests with status, timing and bodies
app_evalRun JavaScript inside the app (dev only)
app_reloadReload the JS bundle, and say honestly if it couldn't

Device

ToolDescription
device_keyvolume_up, volume_down, mute, back, home, power and more (Android, via adb)

Component API

tsx
<AgentBridge  router={router}      // expo-router's router, for exact app_navigate  host="192.168.1.20"  // your computer's IP (auto-detected from Metro)  port={8347}          // must match EXPO_MCP_PORT  allowEval={false}    // disable app_eval  enabled={false}      // turn the bridge off/>
PropTypeDefaultDescription
routerexpo-router router—Used by app_navigate for exact navigation
hoststringfrom MetroComputer running the MCP server
portnumber8347WebSocket port; must match EXPO_MCP_PORT
allowEvalbooleantrueAllow app_eval
enabledbooleantrue in devTurn the bridge on or off

CLI and environment

bash
npx expo-mcp-bridge init            # .mcp.json + agent skill + AGENTS.md sectionnpx expo-mcp-bridge init --cursor   # also write .cursor/mcp.jsonnpx expo-mcp-bridge                 # run the MCP server (your agent starts this for you)npx expo-mcp-bridge --help
VariableDefaultDescription
EXPO_MCP_PORT8347WebSocket port the phone connects to (match <AgentBridge port>)

You normally never run the server yourself — the agent launches it over stdio. To try it by hand, any MCP client works: npx @modelcontextprotocol/inspector npx expo-mcp-bridge.

How it works

text
AI agent  ──MCP (stdio)──▶  expo-mcp-bridge server  ◀──WebSocket :8347──  <AgentBridge /> in your app

The in-app component reads React's live component tree, so it sees exactly what you rendered: your testIDs, labels, inputs and lists. It calls your real onPress and onChangeText handlers, so app logic runs exactly as if a user did it. Native-stack screens hidden under the current one are skipped, modals are captured as overlays, and screenshots capture the visible screen view.

Troubleshooting

SymptomFix
No app connectedSame Wi-Fi, LAN mode (not --tunnel), firewall allows Node on 8347, <AgentBridge /> mounted. USB-only Android: adb reverse tcp:8347 tcp:8347 and host="localhost".
Port 8347 is already in useAnother agent session runs the server — close it, or set EXPO_MCP_PORT and the port prop.
Metro: Unable to resolve "expo-mcp-bridge"npx expo start --clear
app_reload can't reloadMetro was restarted; shake the phone and choose Reload once.
Screenshots failInstall react-native-view-shot (rebuild the dev client if you use one).

More in the troubleshooting guide.

Limits

An in-app library controls your own app only; the OS blocks system dialogs and other apps. device_key covers hardware keys via adb on Android. Gestures that exist only in native code (a pan handler with no onPress) can't be triggered from JavaScript.

Related

  • expo-launch-video — builds on this bridge: your agent records the app live from the phone and cuts a launch video with motion graphics, pop-outs and sound, in a studio you can prompt.
  • Expo Agent Kit — the website and full documentation for both libraries.

Contributing

bash
npm installnpm test

The tests run the bridge in Node against the real MCP server. See CONTRIBUTING.md for details.

License

MIT © Rudra Samadhiya

來源:README.md,提交 6f03ca7

工具

17

app_status

Check whether the mobile app is connected and show device info. Call first.

無需輸入參數。

app_snapshot

Compact text outline of the current screen (buttons, inputs, text, lists) with refs like [e3] to act on. Prefer this over screenshots.

輸入參數maxLines

app_layout

Positions (dp, window coordinates) and font sizes of elements on the current screen. For layout checks and visual work; app_snapshot is cheaper for acting.

輸入參數limit

app_screenshot

JPEG screenshot of the app. Use only for visual/layout questions; app_snapshot is cheaper for finding elements. With saveTo, writes the file and returns only its path (no image tokens).

輸入參數areasaveToqualitymaxWidthfullScroll

app_batch

Run several actions in one call (fastest way to fill forms or walk a flow). Returns the screen once at the end. Steps: {action:"tap"|"type"|"scroll"|"toggle"|"navigate"|"wait"|"dismiss_keyboard", ...that tool's args}.

輸入參數fullsteps必填snapshot

app_tap

Press a button/pressable element. Returns what changed on screen plus any new errors.

輸入參數reffulllongtexttestIDsnapshot

app_type

Set text in an input (replaces by default). Target by ref, testID, or placeholder text.

輸入參數reffulltextvalue必填appendsubmittestIDsnapshot

app_scroll

Scroll a list/ScrollView (first one on screen if no target).

輸入參數reffulltextamounttestIDsnapshotdirection

app_toggle

Flip a Switch (or set it with value).

輸入參數reffulltextvaluetestIDsnapshot

app_navigate

Open a route (expo-router path like "/settings") or a full deep link.

輸入參數fullpath必填replacesnapshot

app_wait

Wait until text or a testID appears (or disappears with gone=true). Cheaper than polling snapshots.

輸入參數gonetexttestIDtimeout

app_logs

Console logs and JS errors captured in the app.

輸入參數clearlevellimitsincesearch

app_network

HTTP requests made by the app (fetch/XHR) with status, timing and truncated bodies.

輸入參數limitsincebodiessearchfailedOnly

app_eval

Run JavaScript inside the app (dev only) and return the JSON result. Expression or statements with return. `bridge` and `RN` (react-native) are in scope.

輸入參數code必填

app_reload

Reload the JS bundle (like pressing r in Metro).

無需輸入參數。

app_dismiss_keyboard

Hide the on-screen keyboard.

無需輸入參數。

device_key

Press a hardware/system key on an Android device via adb (USB or Wi-Fi debugging): volume_up, volume_down, mute, back, home, app_switch, enter, tab, delete, power, menu, escape.

輸入參數key必填repeat

版本歷史

1
  1. v0.3.2最新Oct 21, 2026

評分

已滿足適用檢查項的 90%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分
  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具必需15 分
  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分