> ## 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.

# 在 Pi 中使用 MCP 网络搜索与抓取

> 为 Pi 编程智能体添加 Firecrawl 网页抓取与搜索功能

通过远程托管的 MCP 服务器，为 [Pi](https://pi.dev) 添加 Firecrawl 的搜索、抓取、爬取和映射工具。

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

[创建 Firecrawl API 密钥](https://www.firecrawl.dev/app/api-keys)，然后将其导出为环境变量，以便 Pi 读取：

```bash theme={null}
export FIRECRAWL_API_KEY=fc-YOUR_API_KEY
```

使用 Pi 内置的 MCP 命令添加该服务器：

```bash theme={null}
pi mcp add firecrawl --url https://mcp.firecrawl.dev/v2/mcp --bearer-token-env-var FIRECRAWL_API_KEY
```

此命令会将该条目写入 `~/.pi/agent/mcp.json`。你也可以手动粘贴；如果只想在单个项目中使用，可将其放入 `.pi/mcp.json`：

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

运行 `pi mcp list`，确认 `firecrawl` 显示为已连接，并列出了其工具，例如 `firecrawl_search` 和 `firecrawl_scrape`。然后启动 `pi`；如果已有打开的会话，请运行 `/reload`。

如果你使用 [pi-mcp-adapter](https://github.com/nicobailon/pi-mcp-adapter)，请将相同的配置项添加到 `~/.config/mcp/mcp.json` (或项目中的 `.mcp.json`) ，然后运行 `pi-mcp-adapter doctor` 检查连接。

<h3 id="run-it-locally-instead">
  改为在本地运行
</h3>

如需在本机运行 MCP 服务器，请将其添加为 stdio 服务器：

```bash theme={null}
pi mcp add firecrawl --env FIRECRAWL_API_KEY='${FIRECRAWL_API_KEY}' -- npx -y firecrawl-mcp
```

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

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

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

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

* **服务器显示为失败：**运行 `pi mcp list`，并检查是否已在启动 Pi 的同一个 shell 中导出了 `FIRECRAWL_API_KEY`。
* **已打开的会话中没有显示工具：**如果在会话外添加或更改了服务器，请运行 `/reload`。
* **Pi 缺少 MCP 命令：**将 Pi 更新到最新版本，或按上述配置使用 pi-mcp-adapter。


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