
Metro MCP
io.github.steve228uk由 GitHub 帳號 steve228uk 發布v0.15.0更新於 Oct 24, 2026
MCP server for React Native/Expo runtime debugging, inspection, and automation via Metro/CDP
概覽
一個本機 MCP 伺服器,連接 React Native 或 Expo 應用程式的 Metro 打包服務,用來偵錯、檢視並自動化執行中的應用程式。
- 可以做什麼
- 透過 Metro 與 Hermes 的 CDP 連線檢視執行期日誌、網路請求、錯誤、環境與建置旗標,並將堆疊符號化,內建代理可與 Chrome DevTools 同時使用。在應用程式執行時執行 JavaScript,檢視 Redux 狀態、React 元件樹、導覽狀態與 AsyncStorage 內容。控制裝置與模擬器、管理應用程式權限、測試深層連結,並以點擊、滑動與輸入進行 UI 自動化。錄製互動並產生 Appium、Maestro 或 Detox 測試,進行 CPU 與堆積分析以及無障礙稽核。瀏覽並讀取應用程式沙箱目錄中的檔案,並呼叫透過選用應用程式整合註冊的自訂命令。
- 適用情境
- 適合在開發、偵錯或測試以 Metro 與 Hermes 為基礎的 React Native 或 Expo 應用程式時使用,讓助理讀取日誌、檢視狀態、操作介面或產生測試,而不需修改應用程式程式碼。
- 執行需求
- 透過 npx 或 bunx 在本機執行(Node.js 18+ 或 Bun 1.0+)。需要執行中的 Metro 開發伺服器,應用程式為 React Native 0.70+ 或 Expo SDK 49+ 且使用 Hermes。iOS 需要 Xcode 14+ 與模擬器;Android 需要 Android SDK 且 adb 在 PATH 中;部分 iOS 操作可選用 IDB。選用環境變數 METRO_MCP_PROXY_PORT 與 METRO_MCP_PROXY_ENABLED 可設定 CDP 代理。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Metro MCP,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
metro-mcp
[Install in VS Code] [Install in Cursor]
A plugin-based MCP server for React Native runtime debugging, inspection, and automation. Connects to Metro bundler via Chrome DevTools Protocol — no app code changes needed for most features.
Works with Expo, bare React Native, and any project using Metro + Hermes.
Contents
- Quick Start
- Requirements
- How It Works
- Features
- Chrome DevTools
- Claude Code Status Bar
- Test Recording
- App Integration
- Configuration
- Custom Plugins
- Compatibility
Quick Start
Claude Code
Codex
Codex stores MCP servers in ~/.codex/config.toml by default, and the Codex CLI and IDE extension share that configuration.
If you prefer to configure it manually:
OpenCode
Run OpenCode's interactive MCP installer:
Choose a local server, name it metro-mcp, and use npx -y metro-mcp as the command.
If you prefer to configure it manually, add this to opencode.json in your project, or to ~/.config/opencode/opencode.json for a global install:
Or with Bun:
Cursor / VS Code
Or with Bun:
Install across multiple agents
If you use several MCP clients, add-mcp can write the config for supported agents, including Claude Code, Codex, Cursor, OpenCode, and VS Code:
metro-mcp supports multiple agents at the same time. Standard stdio installs start or reuse a local shared daemon for the same project directory and Metro/config options, so Codex, Claude Code, Cursor, and other clients can connect concurrently to the same running Metro app and see the same logs, network requests, errors, and runtime state.
Shared HTTP server / Supergateway
If you want to expose one long-lived MCP endpoint yourself, start the shared server explicitly:
This serves Streamable HTTP at http://127.0.0.1:8765/mcp. The endpoint supports both the 2025-era MCP handshake and the 2026-07-28 negotiation; /sse and /messages are intentionally unavailable. Tools such as supergateway can point at the Streamable HTTP endpoint instead of launching a fresh stdio process per request.
With custom Metro port
For OpenCode, add the port to the command array:
Requirements
- Node.js 18+ or Bun 1.0+
- iOS: Xcode 14+ with Simulator (
xcrun simctlis used for most operations) - Android: Android SDK with
adbon your PATH - IDB (optional): Some iOS operations fall back to IDB (idb-companion) — install with
brew install idb-companion. Tools will tell you when IDB is needed.
How It Works
metro-mcp connects to your running Metro dev server the same way Chrome DevTools does:
- Discovers Metro via port scanning (8081, 8082, 19000–19002)
- Connects to Hermes via Chrome DevTools Protocol (CDP)
- Streams console logs, network requests, and errors into buffers
- Exposes everything as MCP tools, resources, and prompts
No app modifications required for core debugging features.
Features
→ See the full tools reference.
Chrome DevTools
Hermes (the React Native JavaScript engine) only allows a single CDP debugger connection at a time. Since metro-mcp uses that connection, pressing "j" in Metro or tapping "Open Debugger" in the dev menu will steal the connection and disconnect the MCP.
metro-mcp solves this with a built-in CDP proxy that multiplexes the single Hermes connection, allowing Chrome DevTools and the MCP to work simultaneously.
Opening DevTools
Use the open_devtools MCP tool instead of the usual methods. It opens the same React Native DevTools frontend (rn_fusebox) that Metro uses, but routes the WebSocket connection through the proxy so both can coexist.
The tool automatically finds Chrome or Edge using the same detection as Metro and opens a standalone DevTools window.
What to avoid
Configuration
The CDP proxy is enabled by default. To change the port or disable it:
Claude Code Status Bar
Get live Metro CDP connection status in your Claude Code status bar.
Run setup_statusline in Claude Code — it writes a script to ~/.claude/metro-mcp-statusline.sh, then ask Claude to add it to your status bar:
The status bar segment shows three states:
Test Recording
Record real user interactions (taps, text entry, scrolls) and generate production-ready tests — no app code changes required.
AI-driven test generation
Describe a flow and the AI navigates the app, then generates the test:
"Write an Appium test for the guest checkout flow — start by tapping 'Start Shopping' on the welcome screen and end when the cart screen is visible."
The AI calls start_test_recording, navigates using tap_element/type_text/swipe, then generates a complete test with real selectors observed from the fiber tree.
Manual recording
Supports Appium (WebdriverIO), Maestro YAML, and Detox.
→ See the testing guide for full details, format examples, and tips.
App Integration (Optional)
Register custom commands and expose state to the MCP server — no package needed. Add this to your app entry point in dev mode:
Use list_commands and run_command to call these from the MCP client.
For enhanced features like real-time Redux action tracking, navigation events, performance marks, and React render profiling, install metro-bridge — see the client SDK docs and profiling guide.
Configuration
See configuration docs for environment variables, CLI arguments, and config file options.
Custom Plugins
metro-mcp is fully extensible. See the plugins guide to build your own tools and resources.
Compatibility
- React Native: 0.70+ (Hermes required)
- Expo: SDK 49+
- Runtime: Node.js 18+ or Bun 1.0+
- Platforms: iOS Simulator, Android Emulator, physical devices via USB
License
MIT
來源:README.md,提交 09b27c7
工具
0版本歷史
1- v0.15.0最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分