CLI Init — Quick Setup
Set up React Native MCP in your project with a single command.
This replaces all manual steps (babel config, client config, gitignore) with one interactive wizard.
How it works
Steps in detail
Step 1 — Project Detection
The init command reads your project directory and automatically detects:
If react-native is not found in package.json, the command exits with an error.
Step 1.5 — External Tool Check
Automatically checks whether adb (Android) and idb (iOS, macOS only) are installed.
If a tool is missing, a warning with install instructions is shown, but setup continues. For detailed instructions see Install & connect — Native tools.
Step 2 — MCP Client Selection
You are prompted to choose your MCP client. This determines where the config file is created.
The generated config contains:
If the file already exists, the react-native-mcp entry is merged in — existing settings are preserved.
Step 3 — Apply Changes
The following are applied (after the tool check):
- package.json — Adds
@ohah/react-native-mcp-serverto the app package’sdevDependencies(skipped if already present), then runs the package manager install (skipped with--no-install). - babel.config.js — Appends
@ohah/react-native-mcp-server/babel-presetto thepresetsarray. - MCP client config — Created or merged as described above.
- .gitignore — Appends
/results/(used by E2E test outputs).
Each step is idempotent: running init again skips already-applied changes.
Step 4 — Next Steps
Based on your project type, the command shows what to do next:
- Expo:
npx expo start - Bare RN:
REACT_NATIVE_MCP_ENABLED=true npx react-native start
Options
package.json and install
init adds @ohah/react-native-mcp-server to the app package’s devDependencies in package.json (skipped if already present), then runs the package manager install so dependencies are installed. Use --no-install to skip the install step.
- Single repo: Adds to the app root’s package.json, then runs install in the app root.
- Monorepo: Adds to the chosen app package’s package.json, then runs install from the monorepo root (updates the whole workspace).
Because init adds the dependency and runs install for you, in a monorepo you can just run init from the root — no need to add the package to package.json by hand.
Idempotent
Running init multiple times is safe:
$ npx -y @ohah/react-native-mcp-server init --client cursor -y