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

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

> 为 MCPorter（TypeScript MCP 运行时与 CLI）添加 Firecrawl 网页抓取与搜索功能

[MCPorter](https://mcporter.sh) 是一款面向 MCP 服务器的 TypeScript 运行时与 CLI。你可以通过远程托管的 MCP 服务器将其连接到 Firecrawl。

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

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

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

将 Firecrawl 添加到项目的 `config/mcporter.json` 中；如需全局使用，则添加到 `~/.mcporter/mcporter.json`：

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

MCPorter 会用环境变量中的值替换 `${FIRECRAWL_API_KEY}`，因此密钥不会写入文件。确认连接是否正常：

```bash theme={null}
npx mcporter list firecrawl
```

想使用本地进程？请改用 stdio 方式：

```json theme={null}
{
  "mcpServers": {
    "firecrawl": {
      "command": "npx",
      "args": ["-y", "firecrawl-mcp"],
      "env": { "FIRECRAWL_API_KEY": "${FIRECRAWL_API_KEY}" }
    }
  }
}
```

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

```bash theme={null}
npx mcporter call firecrawl.firecrawl_scrape url=https://firecrawl.dev 'formats=["markdown"]'
```

该命令会以 markdown 格式输出页面内容。在代码中也可以通过 `createRuntime` 使用同一配置条目 (请参见 [MCPorter 文档](https://mcporter.sh)) 。

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

* **找不到服务器：**运行 `npx mcporter config list`，查看 MCPorter 加载了哪个配置文件；`--config <file>` 或 `MCPORTER_CONFIG` 只能指定一个文件。
* **身份验证错误：**MCPorter 不支持 `${env:VAR}` 写法；请将占位符写为 `${FIRECRAWL_API_KEY}`，并检查该变量是否已在同一 shell 中导出。
* **工具参数被拒绝：**传入 JSON 值时，请按所用 shell 的规则加引号，参见上文的 `formats` 示例。


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