> ## Documentation Index
> Fetch the complete documentation index at: https://firecrawl-claude-eager-dijkstra-ul56gh.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 在 Codex CLI 中通过 MCP 使用网页搜索与抓取

> 为 OpenAI Codex CLI 添加 Firecrawl 的网页抓取与搜索功能

通过托管的 OAuth MCP 服务器将 [OpenAI Codex CLI](https://github.com/openai/codex) 连接到 Firecrawl。

<h2 id="quick-setup">
  快速开始
</h2>

<h3 id="1-add-firecrawl">
  1. 添加 Firecrawl
</h3>

```bash theme={null}
codex mcp add firecrawl --url https://mcp.firecrawl.dev/v2/mcp-oauth
codex mcp login firecrawl
```

该 URL 是客户端配置值，不是可在浏览器中直接打开的页面。Codex 会启动 Firecrawl 登录流程，你可在其中选择团队并授权连接。

<h3 id="2-start-codex-and-verify">
  2. 启动 Codex 并验证
</h3>

```bash theme={null}
codex
```

输入 `/mcp`，确认 `firecrawl` 已连接。如果你修改了现有的 Firecrawl 连接，请在重试前新建一个 Codex 会话。

试试：

```text theme={null}
Search the web for the latest Next.js App Router release notes and summarize the sources.
```

```text theme={null}
Scrape https://docs.firecrawl.dev and list the top-level sections.
```

<h2 id="other-connection-modes">
  其他连接方式
</h2>

* 使用[免密钥 MCP](/zh/mcp-server/keyless#try-keyless)试用 Search、Scrape 和 Parse，无需账户或密钥。
* 使用 `bearer_token_env_var` [配置 API 密钥](/zh/mcp-server/keyless#add-an-api-key)，以便无人值守运行。请勿在代理聊天或源代码管理中泄露密钥。
* 仅在需要本地进程或自托管 Firecrawl API 时，[在本地运行 MCP](/zh/mcp-server/local)。本地软件包要求 Node.js 22 或更高版本。

<h2 id="optional-literature-research">
  可选：文献研究
</h2>

处理论文和文献相关任务时，research-index 技能会将这些查询转发至 `firecrawl_research_*` 工具和[研究索引](/zh/features/research)，而非通用网页搜索：

```bash theme={null}
npx skills add firecrawl/skills@firecrawl-research-index
```

<h2 id="troubleshooting">
  故障排除
</h2>

* \*\*Codex 看不到工具：\*\*运行 `codex mcp list`，确认只有一个 `firecrawl` 条目，然后重启 Codex。
* \*\*OAuth 返回 `401`：\*\*运行 `codex mcp login firecrawl` 并完成登录。身份验证前，直接请求 OAuth 服务器预期会返回 `401`。
* \*\*使用 API 密钥的连接返回 `401`：\*\*替换用于启动 Codex 的环境中的密钥，然后启动新会话。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.