> ## Documentation Index
> Fetch the complete documentation index at: https://docs.firecrawl.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# 在 Qwen Code 中使用 MCP 网页搜索与抓取

> 为 Qwen Code 添加 Firecrawl 网页搜索与抓取功能

将 Firecrawl 作为远程 HTTP MCP 服务器连接到 Qwen Code，让 Qwen Code 能够进行网页搜索并读取网页内容。

<h2 id="requirements">
  前提条件
</h2>

* Qwen Code 0.25 或更高版本。
* [Firecrawl API 键](https://www.firecrawl.dev/app/api-keys)，并导出为环境变量 `FIRECRAWL_API_KEY`。

<h2 id="quick-setup">
  快速配置
</h2>

1. 在用于启动 Qwen Code 的 shell 中导出你的 API 键：

```bash theme={null}
export FIRECRAWL_API_KEY="fc-YOUR-API-KEY"
```

2. 添加服务器。使用单引号可防止 shell 展开变量，这样设置文件中保存的是变量引用，而不是你的键：

```bash theme={null}
qwen mcp add --scope user --transport http firecrawl https://mcp.firecrawl.dev/v2/mcp \
  --header 'Authorization: Bearer $FIRECRAWL_API_KEY'
```

3. 确认服务器已连接：

```bash theme={null}
qwen mcp list
```

4. 启动 Qwen Code，运行 `/mcp` 查看 Firecrawl 工具，然后让它执行搜索或抓取。

<Accordion title="想直接编辑设置文件？">
  将该服务器添加到 `~/.qwen/settings.json`，或项目中的 `.qwen/settings.json`：

  ```json theme={null}
  {
    "mcpServers": {
      "firecrawl": {
        "httpUrl": "https://mcp.firecrawl.dev/v2/mcp",
        "headers": {
          "Authorization": "Bearer $FIRECRAWL_API_KEY"
        }
      }
    }
  }
  ```
</Accordion>

有关键的更多信息，请参见[配置 API 键](/zh/mcp-server/keyless#add-an-api-key)。

<h2 id="try-it">
  试一试
</h2>

```text theme={null}
进行网页搜索，查找最新的 Rust 版本发布说明，并总结这些信息来源的内容。
```

```text theme={null}
抓取 https://firecrawl.dev 并说明它的功能。
```

<h2 id="what-you-can-do">
  你可以做什么
</h2>

<CardGroup cols={2}>
  <Card title="搜索" icon="magnifying-glass" href="/zh/features/search">
    查找最新信息，并读取相关结果的内容。
  </Card>

  <Card title="抓取" icon="file-lines" href="/zh/features/scrape">
    将 URL 转换为干净的 markdown 或结构化数据。
  </Card>

  <Card title="交互" icon="hand-pointer" href="/zh/features/interact">
    通过页面导航、点击和表单填写，获取所需数据。
  </Card>

  <Card title="Alexandria" icon="books" href="/zh/features/alexandria">
    发现结构化数据工具，查看其输入参数和定价，然后通过 Firecrawl 运行这些工具。
  </Card>
</CardGroup>

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

* **正在运行的会话中找不到该服务器：** 添加服务器后，请在同一项目中重新启动 Qwen Code。
* **服务器显示未连接：** 运行 `qwen mcp list`，并检查启动 Qwen Code 的 shell 中是否已导出 `FIRECRAWL_API_KEY`。
* **工具调用因键无效而被拒绝：** 确认标头值为 `Bearer $FIRECRAWL_API_KEY`，且该变量中存放的是有效的键。
* **工具未被调用：** 不同模型调用 MCP 工具的稳定性有所差异，请尝试换用其他模型。


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