React Native Docs MCP

# React Native Docs MCP Server AI-powered semantic search over React Native documentation for Claude, Cursor, and other MCP clients. Looking for React docs instead? See [react-docs-mcp](https://www.npmjs.com/package/react-docs-mcp). ## 🚀 Installation (One Command) ### Claude Code ```bash claude mcp add --transport stdio react-native-docs -- npx react-native-docs-mcp ``` ### Claude Desktop Edit: `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows) ```json { "mcpServers": { "react-native-docs": { "command": "npx", "args": ["-y", "react-native-docs-mcp"] } } } ``` ### Cursor **Settings** → **Cursor settings** → **Tools and MCP** → Add server: ```json { "mcpServers": { "react-native-docs": { "command": "npx", "args": ["-y", "react-native-docs-mcp"] } } } ``` **That's it!** Restart your editor and ask about React Native. --- ## Features - **🔑 No API Key**: Unlike hosted docs services (Context7, GitMCP), everything runs on your machine — no account, no key, no rate limits - **🔌 Works Offline**: Clones the official react-native-website docs repo once, then searches locally — no network calls at query time - **🔍 Semantic Search**: AI-powered search using embeddings for conceptual matches - **⚡ Fast Results**: In-memory vector search with hybrid keyword+semantic ranking - **📦 Zero Config**: Works with `npx` - no installation needed - **🤖 Local AI**: Runs embeddings locally (no API costs) - **📝 Concise Responses**: Returns summaries instead of full documentation - **🔄 Auto-sync**: Pulls latest docs from the react-native-website repo automatically - **📌 Version Pinning**: `--docs-version=0.77` scopes docs to the React Native release your app actually uses ## Usage Once configured, the server provides the following capabilities to AI agents: ### Tools #### `search_react_native_docs` Search across React Native documentation. **Parameters**: - `query` (required): Search query string - `section` (optional): Filter by section (the-new-architecture, legacy, releases) - `limit` (optional): Maximum number of results (default: 10, max: 50) **Example**: ``` Search for "flexbox layout" in React Native docs ``` #### `get_doc` Get a specific documentation page. **Parameters**: - `path` (required): Document path (e.g., "getting-started", "the-new-architecture/using-codegen") - `full` (optional): Return the full raw page instead of the ~1500 char summary (default: false) **Example**: ``` Get the React Native flexbox documentation ``` **Why `full`?** The default summary is enough for most reference pages, but long guides — like "The New Architecture" migration docs, or a full native-modules walkthrough — can run well past 1500 chars, and the summary may stop before the part you actually need. Ask for the complete page when that happens: ``` Get the full page for the-new-architecture/using-codegen, I need every step ``` which calls `get_doc` with `{ "path": "the-new-architecture/using-codegen", "full": true }`. #### `list_sections` List all available documentation sections. #### `update_docs` Pull latest documentation from the Git repository. ### Docs version By default this server indexes the always-current `docs/` folder from the react-native-website repo — the same docs shown on reactnative.dev today. To pin it to a specific past release's frozen docs snapshot instead, pass `--docs-version`: ```bash npx react-native-docs-mcp --docs-version=0.77 ``` or set the `REACT_NATIVE_DOCS_VERSION` env var (the CLI flag wins if both are set). With Claude Code: ```bash claude mcp add --transport stdio react-native-docs -- npx react-native-docs-mcp --docs-version=0.77 ``` (Bare `--version` prints the package version, as you'd expect from any CLI.) **Why pin a version?** If your app is running React Native 0.77 but the agent searches always-current docs, it can suggest an API that only exists in 0.86, or miss that something was renamed/removed since your version. Pinning `--docs-version` to match your `react-native` dependency's version keeps suggestions consistent with the APIs actually available in your app — useful when working on an app that's a few releases behind latest, or when debugging something version-specific (e.g. "did this New Architecture behavior change between 0.78 and 0.82?" — run two instances, one per version, and compare). Only `latest` (the default) is fully verified against the current docs structure; older version snapshots are indexed best-effort with the same settings. ### Resources The server exposes documentation as resources with the URI pattern: ``` react-native-docs://{section}/{path} ``` ## Limitations - **Docs source**: content is cloned from the unversioned `docs/` folder in [facebook/react-native-website](https://github.com/facebook/react-native-website), which is upstream's live editing source. It may occasionally be a few days ahead of the latest published release rather than pinned to a specific React Native version. - **Sections**: most React Native docs pages live flat at the root of `docs/` with no meaningful section — only `the-new-architecture`, `legacy`, and `releases` are real subfolders. The `section` filter reliably narrows results only for those three; for everything else, search unfiltered. - **Blog posts**: `website/blog/` is not indexed yet. - **MDX rendering**: `.mdx`-only syntax (JSX component imports, admonitions) is stripped as best-effort plain text for search indexing, so snippets/summaries for some pages may include stray import lines. ## Development This package shares its engine with [react-docs-mcp](https://github.com/Sannnao/react-docs-mcp) — development happens in that monorepo (this standalone repo is a read-only mirror of `packages/react-native-docs-mcp/`; please file issues there). This package's own source only configures the shared engine with React Native-specific defaults (`src/index.ts`) and is bundled standalone with [tsup](https://tsup.egoist.dev/). ```bash npm install npm run build npm run dev # run directly with tsx, no build step ``` ## License MIT. React Native documentation content is © Meta Platforms, Inc. and licensed separately by the [react-native-website](https://github.com/facebook/react-native-website) project.