This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.

在 Expo 中使用模型上下文协议(MCP)

关于将模型上下文协议与 Expo 项目集成以增强 AI 模型能力的指南。


模型上下文协议(MCP)是一种标准协议,允许 AI 模型与外部数据源集成,为更精确的回应提供增强的上下文。它使像代理这样的 AI 辅助工具能够更深入地理解你的开发环境,从而在你的代码库上提供更好的帮助。

🌐 Model Context Protocol (MCP) is a standard protocol that allows AI models to integrate with external data sources, providing enhanced context for more precise responses. It enables AI-assisted tools like agents to understand your development environment more deeply, allowing them to provide better assistance with your codebase.

Expo MCP 服务器是由 Expo 托管的远程 MCP 服务器,它可以与流行的 AI 辅助工具例如 Claude、Claude Code、Cursor、VS Code 等集成,使它们能够直接与你的 Expo 项目互动。Expo MCP 也可以在 Claude Connectors 中使用,所以你可以通过网页、桌面和移动端的 Claude 连接使用,无需本地安装。

🌐 Expo MCP Server is a remote MCP server hosted by Expo that integrates with popular AI-assisted tools such as Claude, Claude Code, Cursor, VS Code, and others, enabling them to interact directly with your Expo projects. Expo MCP is also available in Claude Connectors, so you can connect from Claude on the web, desktop, and mobile apps with no local installation.

推出 Expo MCP 服务器:提供准确且具上下文感知的 AI 回应
推出 Expo MCP 服务器:提供准确且具上下文感知的 AI 回应

使用 Expo 提升你的 AI 辅助应用构建工具。

用 AI 构建移动应用你需要的 3 个工具
用 AI 构建移动应用你需要的 3 个工具

看看一个 AI 代理在使用 MCP 服务器的同时用 Expo 构建移动应用。

Expo MCP 服务器是做什么的?

🌐 What does Expo MCP Server do?

Expo MCP 服务器教会你的 AI 辅助工具关于 Expo SDK 的知识,并让它们与移动模拟器和 React Native 开发工具进行互动。以下是一些 Expo MCP 服务器增强的任务示例:

🌐 Expo MCP Server teaches your AI-assisted tools about the Expo SDK and lets them interact with mobile simulators and the React Native DevTools. These are some examples of the tasks Expo MCP Server enhances:

了解使用 Expo 开发。 你的 AI 辅助工具可以按需获取最新的官方 Expo 文档,并用它来回复如下提示信息:

  • 我该如何使用 Expo Router?
  • 在 Expo 文档中查找实现深度链接的方法
  • 阅读 Expo Router 文档页面
  • Expo CNG是什么?

管理依赖。 Expo MCP 服务器会引导你安装我们推荐的软件包,并使用 npx expo install 安装已知的兼容版本。

  • 添加带有基本 CRUD 操作的 SQLite
  • 安装 expo-camera 并教我如何拍照
  • 添加 expo-notifications 以启用推送通知

管理构建和工作流。 Expo MCP 服务器可以触发和监控 EAS 构建,运行工作流,并从 TestFlight 获取崩溃数据:

  • 调查为什么我最近在 EAS 上的 iOS 构建失败
  • 识别最近失败工作流中的任何模式
  • 创建一个运行 Maestro 测试的工作流程
  • 显示我最近的 TestFlight 崩溃
  • 显示我的应用的 TestFlight 反馈

自动化视觉验证和测试。 多模态 AI 辅助工具可以在模拟器中截图并与正在运行的应用互动。Expo MCP 服务器通过在项目依赖中添加 expo-mcp 包来启用本地功能。

  • 添加一个蓝色圆形视图,并确保它正确渲染
  • 添加一个按钮,然后点击它以验证交互是否正常
  • 添加一个点击会增加计数的按钮,并验证状态是否正确更新

你的 AI 辅助工具可以自主编写代码,捕捉截图以验证界面是否正确,测试交互,并修复发现的问题。

🌐 Your AI-assisted tools can autonomously write the code, capture screenshots to verify the UI is correct, test interactions, and fix issues they find.

MCP 功能 的完整表格记录了 Expo MCP 服务器为 AI 辅助工具提供的工具和提示。

🌐 The complete table of MCP capabilities documents the tools and prompts Expo MCP Server provides to AI-assisted tools.

先决条件

3 要求

1.

Expo 账户

使用 Expo MCP 服务器需要一个 Expo 账户。

2.

一个关于最新 SDK 的 Expo 项目

使用 npx create-expo-app@latest 创建一个项目,或者确保你的现有项目已经安装了最新的 expo 包。

3.

一个具有远程MCP支持的AI辅助工具

Claude、Claude Code、Cursor、VS Code,或者任何支持远程 MCP 服务器的工具。

安装与设置

🌐 Installation and setup

1

安装 Expo MCP 服务器

🌐 Install Expo MCP Server

Expo MCP 服务器支持与各种 AI 辅助工具集成。使用下面的一般设置,或展开特定工具以获取详细说明:

🌐 Expo MCP Server supports integration with various AI-assisted tools. Use the general settings below or expand your specific tool for detailed instructions:

  • 服务器类型:可串流 HTTP
  • URL: https://mcp.expo.dev/mcp
  • 身份验证:OAuth

Claude 在网页、桌面和移动应用上

Expo MCP 可在 Claude Connectors 中使用。这个设置无需在你的电脑上安装任何东西。点击下面的按钮并按照提示将 Expo 连接器添加到你的 Claude 账户:

🌐 Expo MCP is available in Claude Connectors. This setup requires no installation on your machine. Click the following button and follow the prompts to add the Expo connector to your Claude account:

向Claude添加Expo连接器

在 Claude 团队或企业计划中,可以为整个组织启用 Expo 连接器。该组织的成员随后可以在任何设备上使用它,包括手机,而且无需手动安装。

🌐 On a Claude Team or Enterprise plan, the Expo connector can be enabled for the entire organization. Members of that organization can then use it on any device, including their phone, without a manual install.

克劳德代码

如果你已经安装了 expo 插件,它已经注册了这个服务器。跳过下面的命令,在你的会话中运行 /mcp 进行认证。

🌐 If you installed the expo plugin, it already registers this server. Skip the command below and run /mcp in your session to authenticate.

Terminal
- claude mcp add --transport http expo https://mcp.expo.dev/mcp

安装后,在你的 Claude Code 会话中运行 /mcp 以进行身份验证。

🌐 After installation, run /mcp in your Claude Code session to authenticate.

2

使用 Expo 进行身份验证

🌐 Authenticate with Expo

安装完 MCP 服务器后,你需要进行身份验证。

🌐 After installing the MCP server, you'll need to authenticate.

当提示时,在浏览器中使用你的 Expo 账号登录。服务器会自动生成一个访问令牌。

🌐 Sign in with your Expo account in the browser when prompted. The server will generate an access token automatically.

3

设置本地功能(推荐)

🌐 Set up local capabilities (Recommended)

要获得完整的 MCP 体验,包括从 iOS 模拟器截图、打开开发者工具和自动化功能,请设置本地 Expo 开发服务器:

🌐 For the full MCP experience with advanced features like taking screenshots from your iOS Simulator, opening DevTools, and automation capabilities, set up a local Expo development server:

Terminal
- cd /path/to/your-project

# Install the expo-mcp package
- npx expo install expo-mcp --dev

# Ensure you are logged in to Expo CLI with the same account as the one used to# authenticate with the MCP server
- npx expo whoami || npx expo login

# Start the dev server with MCP capabilities
- EXPO_UNSTABLE_MCP_SERVER=1 npx expo start
- cd /path/to/your-project

# Install the expo-mcp package
- yarn expo install expo-mcp --dev

# Ensure you are logged in to Expo CLI with the same account as the one used to# authenticate with the MCP server
- yarn expo whoami || yarn expo login

# Start the dev server with MCP capabilities
- EXPO_UNSTABLE_MCP_SERVER=1 yarn expo start
- cd /path/to/your-project

# Install the expo-mcp package
- pnpm expo install expo-mcp --dev

# Ensure you are logged in to Expo CLI with the same account as the one used to# authenticate with the MCP server
- pnpm expo whoami || pnpm expo login

# Start the dev server with MCP capabilities
- EXPO_UNSTABLE_MCP_SERVER=1 pnpm expo start
- cd /path/to/your-project

# Install the expo-mcp package
- bun expo install expo-mcp --dev

# Ensure you are logged in to Expo CLI with the same account as the one used to# authenticate with the MCP server
- bun expo whoami || bun expo login

# Start the dev server with MCP capabilities
- EXPO_UNSTABLE_MCP_SERVER=1 bun expo start

服务器能力与本地能力

🌐 Server capabilities versus local capabilities

Expo MCP 服务器根据你的设置提供两种类型的功能:

🌐 Expo MCP Server provides two types of capabilities depending on your setup:

服务器功能

🌐 Server capabilities

服务器功能仅通过远程 MCP 服务器连接即可使用,无需搭建本地开发服务器。

🌐 Server capabilities are available with just the remote MCP server connection, without needing to set up a local development server.

本地能力

🌐 Local capabilities

本地功能需要本地 Expo 开发服务器运行,并提供与本地开发环境交互的高级功能:

🌐 Local capabilities require a local Expo development server to be running and provide advanced features that interact with your local development environment:

  • 自动化工具:截屏、点击视图、通过 testID 查找元素
  • 开发工具:打开 React Native 开发工具
  • 项目分析:生成 expo-router 网站地图

这些功能使更复杂的工作流程成为可能,例如自动化测试、视觉验证和更深入的项目分析。要使用本地功能,你需要遵循上文的设置本地功能部分。

🌐 These capabilities enable more sophisticated workflows like automated testing, visual verification, and deeper project introspection. To use local capabilities, you will need to follow the Set up local capabilities section above.

可用的MCP功能

🌐 Available MCP capabilities

工具

🌐 Tools

ToolDescriptionExample promptAvailability
add_libraryAdd an Expo library to the project using expo install and attach usage instructions when available."add sqlite and basic CRUD to the app"Server
read_documentationFetch a single Expo documentation page and return its content as markdown. Returns up to ~5000 tokens per call. Use offset to paginate through long pages."read the Expo Router docs page"Server
search_documentationSearch the official Expo documentation and return page URLs ranked by relevance for a user query. Use read_documentation to fetch the full content of specific pages, starting from the top."search documentation for CNG"Server (requires an EAS paid plan)
learnLearn Expo how-to for a specific topic and remember it for future conversations. Use this to teach the assistant about specific Expo features or workflows."learn how to use expo-router"Server
workflow_createCreates a new EAS workflow YAML file for Expo projects or fetches workflow syntax documentation. Use this when users want to create CI/CD workflows in .eas/workflows/ or need to learn EAS workflow syntax. After creating, use workflow_validate to validate the file."create a CI/CD workflow for building and deploying"Server
workflow_infoFetches detailed information about a specific EAS workflow run by ID. Use this to check the status, job results, errors, and artifacts of a workflow run. If workflow has multiple jobs, draw them in a diagram to show the dependencies between jobs."get the status of the latest workflow run"Server
workflow_listLists recent EAS workflow runs for a project. Provide either appId (from app.json "extra.eas.projectId") OR appFullName (e.g., "@owner/my-app")."list the recent workflow runs"Server
workflow_logsFetches logs for a specific job in an EAS workflow run. Call without sectionIndex or phase to get a summary of log sections (phase names and line ranges); then call again with sectionIndex or phase to fetch that section."show me the logs for the build job in the workflow"Server
workflow_runTriggers an EAS workflow run from a git reference. Provide either appId (from app.json "extra.eas.projectId") OR appFullName (e.g., "@owner/my-app"). The workflow file must exist at the specified git reference."run the build-and-deploy workflow"Server
workflow_cancelCancels a running EAS workflow. Use workflow_info to get the workflow run ID."cancel the running workflow"Server
workflow_validateValidates EAS workflow YAML syntax and configuration. Use this after creating a workflow to ensure it is valid. Provide either appId (from app.json "extra.eas.projectId") OR appFullName (e.g., "@owner/my-app")."validate my workflow file"Server
build_listLists EAS builds for a project. Provide either appId (from app.json "extra.eas.projectId") OR appFullName (e.g., "@owner/my-app"). Use this to see recent builds, their status, and available artifacts."list the recent builds for this project"Server
build_infoFetches the status and detailed information about a specific EAS build by ID. Use this to check build status, errors, artifacts, and other details."get the status of my latest iOS build"Server
build_logsFetches the logs for a specific EAS build. The build must be completed (finished or errored) to have logs available."show me the logs for the failed build"Server
build_submitSubmits an EAS build to the app store (Google Play Store for Android, App Store for iOS). The build must be a finished build with the appropriate distribution type. Provide either appId (from app.json "extra.eas.projectId") OR appFullName (e.g., "@owner/my-app")."submit the latest build to the App Store"Server
build_runTriggers a new EAS build using a build profile from eas.json. Requires a GitHub repository to be connected to the project. Provide either appId (from app.json "extra.eas.projectId") OR appFullName (e.g., "@owner/my-app")."run a production build for iOS"Server
build_cancelCancels an EAS build that is queued or in progress. Use build_info to check the current status first."cancel the build that is currently in progress"Server
testflight_crashesFetch TestFlight crash data. Without crashId, lists recent crashes. With crashId, returns the full crash log with stack trace."show me recent TestFlight crashes"Server
testflight_feedbackFetch screenshot feedback from TestFlight. Returns feedback metadata including device info, user comments, and screenshot URLs."show TestFlight feedback for my app"Server
appstore_reviewsFetch public App Store customer reviews for an app (rating, title, body, reviewer, territory). For TestFlight beta feedback use testflight_feedback instead.""Server
appstore_reply_reviewPost or edit the public developer response to an App Store customer review. This is a write action: the response is visible to everyone on the App Store, and Apple publishes it after a short review. App Store Connect allows a single response per review, so any existing response is replaced.""Server
appstore_delete_review_responseDelete the public developer response on an App Store customer review. This is a write action: it removes the response from the App Store. No-op-safe — if the review has no response, it reports that nothing was deleted.""Server
playstore_crashesFetch crash and ANR data from Google Play (Android Vitals). Without issueId, lists recent crash/ANR issues. With issueId, returns the full error report with stack trace.""Server
playstore_reviewsFetch user reviews from Google Play. Returns review metadata including author, star rating, device info, and comment text. Note: Google Play only exposes production reviews with text from approximately the last week.""Server
playstore_reply_reviewPost a public developer reply to a Google Play user review, or edit the existing reply. This is a write action: the reply is visible to users on the store listing. Each review has a single developer reply, so replying again replaces it. Reply text is limited to 350 characters.""Server
expo_router_sitemapList all routes (the sitemap) of the current Expo Router project. Use this when you are working with Expo Router and need to know which routes or screens exist in the app."check the expo-router-sitemap output"Local (requires expo-router library)
open_devtoolsOpen React Native DevTools for the running app to debug JavaScript, inspect the component tree, and view console output. Requires a running dev server (Metro) for the project."open devtools"Local
collect_app_logsCollect logs over a short time window from the native device (Android logcat / iOS syslog) and/or the JavaScript console. Use this to debug runtime errors, crashes, or unexpected behavior in a running app."collect app logs from the iOS simulator"Local
automation_tapTap on the running app at the given screen coordinates (x, y) or on the view with the given React Native testID. Provide either both x and y, or testID. Prefer testID when available, as it is resilient to layout changes."tap the screen at x=12, y=22"Local
automation_take_screenshotTake a screenshot of the running app — the full screen, or a specific view if a React Native testID is provided. Use this to visually verify the current UI state."take a screenshot and verify the blue circle view"Local
automation_find_viewFind a view by its React Native testID and return its properties (position, size, and visibility). Use this to verify a view rendered correctly, or to obtain coordinates before calling automation_tap."dump properties for testID 'button-123'"Local

提示

🌐 Prompts

如果你的 AI 辅助工具支持 MCP 提示,你可能会看到额外的菜单选项,例如 Claude Code 中的斜杠命令:

🌐 If your AI-assisted tool supports MCP prompts, you may see additional menu options, such as slash commands in Claude Code:

PromptDescriptionAvailability
expo_router_sitemapQuery the all routes of the current expo-router project using expo-router-sitemap.Local

局限性

🌐 Limitations

当前的实现存在以下限制:

🌐 The current implementation has the following limitations:

  • 一次仅支持连接 单个开发服务器
  • iOS 对本地功能的支持仅限于模拟器(尚不支持物理设备)
  • iOS 对本地功能的支持仅在 macOS 主机上可用。

数据隐私

🌐 Data privacy

Expo 不会使用发送到 Expo MCP 服务器的数据来训练 AI 模型。Expo MCP 服务器本身也不会运行 AI 模型。它提供 MCP 工具和提示给你连接的 AI 辅助工具,比如 Claude、Claude Code、Cursor 或 VS Code。

🌐 Expo does not use data sent to Expo MCP Server to train AI models. Expo MCP Server does not run an AI model itself. It provides MCP tools and prompts to the AI-assisted tool you connect, such as Claude, Claude Code, Cursor, or VS Code.

对于服务器功能,Expo MCP 服务器可能会访问完成所请求工具调用所需的 Expo 账户和项目数据,例如构建、工作流、文档或与 TestFlight 相关的数据。结果将通过 MCP 连接返回给你的 AI 辅助工具。

🌐 For server capabilities, Expo MCP Server may access Expo account and project data needed to complete the requested tool call, such as build, workflow, documentation, or TestFlight-related data. The result is returned to your AI-assisted tool over the MCP connection.

对于本地功能,来自你的开发机器的数据会通过 Expo MCP 服务器代理,并返回到你的 AI 辅助工具。例如,当 AI 辅助工具请求拍摄模拟器屏幕截图时,数据流如下:

🌐 For local capabilities, data from your development machine is proxied through Expo MCP Server and returned to your AI-assisted tool. For example, when an AI-assisted tool asks to take a simulator screenshot, the data flow is:

  1. 本地 Expo 开发服务器会从你的模拟器捕获屏幕截图。
  2. 屏幕截图已发送到 Expo MCP 服务器。
  3. Expo MCP 服务器将屏幕截图返回到你的本地 MCP 客户端或 AI 辅助工具。

Expo MCP 服务器会将数据返回给你连接的 MCP 客户端,例如 Claude、Claude Code、Cursor、VS Code 或 Codex。之后,客户端及其模型提供方可能会应用他们自己的数据保留、零数据保留(ZDR)和训练政策。在为处理敏感数据的项目启用 MCP 访问之前,请先查看这些政策,包括 HIPAA、SOC 2 或其他受监管的工作负载。

🌐 Expo MCP Server returns data to the MCP client you connect, such as Claude, Claude Code, Cursor, VS Code, or Codex. From there, the client and its model provider may apply their own retention, zero data retention (ZDR), and training policies. Review those policies before enabling MCP access for projects that handle sensitive data, including HIPAA, SOC 2, or other regulated workloads.

其他资源

🌐 Additional resources

模型上下文协议文档

了解有关 MCP 规范和协议详情的更多信息。