Skip to content

Configuration

Environment Variables

VariableDefaultDescription
METRO_HOSTlocalhostMetro bundler host
METRO_PORT8081Metro bundler port
METRO_MCP_PROXY_ENABLEDtrueEnable the CDP proxy for Chrome DevTools coexistence
METRO_MCP_PROXY_PORT0 (random)Fixed port for the CDP proxy. Use 0 for a random available port
DEBUGEnable debug logging

CLI Arguments

bash
npx -y metro-mcp --host 192.168.1.100 --port 19000
# or
bunx metro-mcp --host 192.168.1.100 --port 19000
ArgumentDescription
--host, -hMetro bundler host
--port, -pMetro bundler port

Config File

Create metro-mcp.config.ts in your project root:

typescript
import { defineConfig } from 'metro-mcp';

export default defineConfig({
  metro: {
    host: 'localhost',
    port: 8081,
    autoDiscover: true,  // Scan common ports automatically
  },
  plugins: [],
  bufferSizes: {
    logs: 500,
    network: 200,
    errors: 100,
  },
  network: {
    interceptFetch: false,  // Opt-in: inject JS to wrap fetch()
  },
  proxy: {
    enabled: true,   // CDP proxy for Chrome DevTools coexistence
    port: 0,         // 0 = random available port
  },
  profiler: {
    newArchitecture: true,  // Set to false for legacy bridge apps
  },
});

CDP Proxy Options

The CDP proxy allows Chrome DevTools to connect alongside the MCP, working around Hermes's single-connection limitation. See the Chrome DevTools section for details.

OptionDefaultDescription
proxy.enabledtrueEnable the CDP proxy server. When enabled, external debuggers (Chrome DevTools, etc.) can connect to the proxy port and share the Hermes connection with the MCP.
proxy.port0Port for the proxy's WebSocket + HTTP server. 0 picks a random available port. Set a fixed port if you need a stable URL.

The proxy also serves a /json endpoint for Chrome's target auto-discovery and a /json/version endpoint.

Profiler Options

OptionDefaultDescription
profiler.newArchitecturetrueControls which profiling path is used. When true (default), __REACT_DEVTOOLS_GLOBAL_HOOK__ is used as the primary path — works on all architectures including Bridgeless/Fusebox. When false, CDP Profiler.* domain calls are attempted first (suitable for legacy bridge apps).

Which value should I use?

  • Expo SDK 50+ / RN 0.74+ (New Architecture / Bridgeless): keep true (default)
  • Legacy bridge apps on older RN / Hermes: set to false — the CDP Profiler domain may be available and provides a lower-overhead CPU call-graph

The server also auto-detects Fusebox targets via the prefersFuseboxFrontend CDP capability and skips CDP fallbacks automatically, regardless of this setting.

Released under the MIT License.