Expo Guide
React Native MCP works with Expo projects. The runtime is pure JavaScript, and Expo uses the same Hermes runtime.
Quick setup: Run
npx -y @ohah/react-native-mcp-server initto auto-detect your Expo project and configure the Babel preset + MCP client in one step.
Compatibility
Why it works
runtime.jsis pure JavaScript — Expo uses the same Hermes runtime__REACT_DEVTOOLS_GLOBAL_HOOK__is a React standard — same in Expo- WebSocket is built into RN — same in Expo
require('react-native')works the same in Expo
Installation
1. Install the package
npx expo installautomatically picks a version compatible with your Expo SDK.npm installalso works, butnpx expo installis recommended.
2. Add the Babel preset
Expo projects use
babel-preset-expo(notmodule:@react-native/babel-preset).
To apply only in development builds:
3. Enable the MCP runtime (no app code required)
Once the Babel preset is applied, the MCP runtime loads automatically. You do not need to call enable() in your app entry.
- Development (
__DEV__): Connects to port 12300 automatically when running with Metro. - Release/non-dev builds: Run Metro with
REACT_NATIVE_MCP_ENABLED=trueso the transformer injects the enable flag.
4. Configure the MCP server
Register the server in your MCP client (Cursor, Claude Desktop, etc.). Same as bare RN projects.
5. Run the app
Expo Go Limitations
Expo Go is a pre-built sandbox app. It has the following limitations:
-
localhost WebSocket: Expo Go runs in its own network sandbox, so
ws://localhost:12300may fail.- iOS simulator: localhost points to the host machine — works
- Android emulator: requires
adb reverse tcp:12300 tcp:12300 - Physical device: must use the host IP instead of localhost; may not be configurable in Expo Go
-
No custom native modules: Expo Go only supports pre-included native modules. However, react-native-mcp is pure JS, so this limitation does not apply.
-
Babel preset: Works in Expo Go (processed at Metro build time).
Recommendation: Use Expo Dev Client for a stable development experience.
Troubleshooting
MCP connection not working
- Check that the MCP server is running (port 12300)
- Verify the runtime is loaded — e.g.
console.log(typeof __REACT_NATIVE_MCP__)(dev builds connect automatically; for release, run Metro withREACT_NATIVE_MCP_ENABLED=true) - Verify the Babel preset is applied — clear Metro cache and restart:
- Android emulator requires port forwarding:
__REACT_NATIVE_MCP__ is undefined
The Babel preset is not applied.
- Check that
@ohah/react-native-mcp-server/babel-presetis inbabel.config.js - Clear Metro cache:
npx expo start --clear - Verify the package is installed:
npx expo install @ohah/react-native-mcp-server
WebSocket connection fails in Expo Go
If using Expo Go on a physical device (not simulator/emulator), localhost connections are not possible. Switch to Dev Client, or use the host machine's IP address.
For more connection issues, see the Troubleshooting page.