CLI Init — Quick Setup

Set up React Native MCP in your project with a single command.

npx -y @ohah/react-native-mcp-server init

This replaces all manual steps (babel config, client config, gitignore) with one interactive wizard.


How it works

Terminal
$ npx -y @ohah/react-native-mcp-server init

React Native MCP Setup

Detecting project...
✓ React Native 0.83.1
✓ Expo detected (expo@~52.0.0)
✓ Package manager: bun

Checking external tools...
✓ adb — found
✓ idb — found
All tools ready!

? Which MCP client do you use?
1. Cursor
2. Claude Code (CLI)
3. Claude Desktop
4. Windsurf
5. Antigravity
> 1

Applying changes...
✓ babel.config.js — preset added
✓ MCP config — created .cursor/mcp.json
✓ .gitignore — updated

Done! Next steps:
1. Start your app: npx expo start
2. Open Cursor — MCP tools are ready to use

Steps in detail

Step 1 — Project Detection

The init command reads your project directory and automatically detects:

WhatHow
React Native versiondependencies["react-native"] in package.json
Expodependencies["expo"], or app.json / app.config.ts exists
Babel configbabel.config.js, babel.config.cjs, .babelrc
Package managerbun.lock → bun, yarn.lock → yarn, pnpm-lock.yaml → pnpm, else npm

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.

ToolPurposeInstall
adbAndroid emulator tap/swipe/screenshotIncluded with Android Studio, or brew install android-platform-tools
idbiOS simulator tap/swipe/screenshotbrew tap facebook/fb && brew install idb-companion

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.

ClientConfig path
Cursor{project}/.cursor/mcp.json
Claude Code (CLI)Runs claude mcp add command
Claude Desktop~/Library/Application Support/Claude/claude_desktop_config.json (macOS)
Windsurf~/.codeium/windsurf/mcp_config.json
Antigravity~/.gemini/antigravity/mcp_config.json

The generated config contains:

{
  "mcpServers": {
    "react-native-mcp": {
      "command": "npx",
      "args": ["-y", "@ohah/react-native-mcp-server"]
    }
  }
}

If the file already exists, the react-native-mcp entry is merged in — existing settings are preserved.

Step 3 — Apply Changes

Three files are modified (after the tool check):

  1. babel.config.js — Appends @ohah/react-native-mcp-server/babel-preset to the presets array.
  2. MCP client config — Created or merged as described above.
  3. .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

FlagDescriptionExample
--client <name>Skip client prompt--client cursor
-y, --yesNon-interactive mode (default: Cursor)-y
-h, --helpShow help--help
# CI / automation
npx -y @ohah/react-native-mcp-server init --client cursor -y

# Specific client, still interactive for confirmations
npx -y @ohah/react-native-mcp-server init --client antigravity

Idempotent

Running init multiple times is safe:

Terminal — second run

$ npx -y @ohah/react-native-mcp-server init --client cursor -y


Applying changes...
✓ babel.config.js — preset already configured
✓ MCP config — already configured
✓ .gitignore — already has results/