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

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

> 为 Visual Studio 中 GitHub Copilot 的智能体模式添加 Firecrawl 网页搜索与抓取功能

通过远程托管的 MCP 服务器，将 Firecrawl 连接到 Visual Studio 中的 GitHub Copilot 智能体模式，然后使用你的 Firecrawl 账户登录。

<h2 id="requirements">
  环境要求
</h2>

* Visual Studio 2022 17.14 或更高版本，或 Visual Studio 2026。
* 已登录 GitHub Copilot，并将 Copilot Chat 切换到 **智能体** 模式。

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

1. 创建 `%USERPROFILE%\.mcp.json`，即可在所有解决方案中使用 Firecrawl；或创建 `<SOLUTIONDIR>\.mcp.json`，将其作用范围限定为单个解决方案，并通过源代码管理共享。
2. 添加以下配置并保存文件：

```json theme={null}
{
  "servers": {
    "firecrawl": {
      "url": "https://mcp.firecrawl.dev/v2/mcp-oauth"
    }
  }
}
```

3. 在该文件中，点击服务器上方 CodeLens 中的 **Authentication Required**，然后在浏览器中完成 Firecrawl 登录。如果看不到 CodeLens，请依次前往 **Tools**、**Options**、**Text Editor**、**CodeLens** 将其启用。
4. 在 Copilot Chat 中切换到 **智能体** 模式，打开 **Tools**，然后启用 Firecrawl 工具。Visual Studio 默认禁用新添加的 MCP 工具，需要你手动开启。

<Accordion title="想通过聊天添加服务器？">
  在 Copilot Chat 中切换到 **智能体** 模式，打开 **Tools**，点击加号按钮，然后选择 **Add custom MCP server**。名称填写 `firecrawl`，URL 填写 `https://mcp.firecrawl.dev/v2/mcp-oauth`。
</Accordion>

<Accordion title="想使用带 API 密钥的本地服务器？">
  Visual Studio 也支持运行本地服务器。请参见[在本地运行 MCP](/zh/mcp-server/local)，并在同一文件中定义命令：

  ```json theme={null}
  {
    "servers": {
      "firecrawl": {
        "command": "npx",
        "args": ["-y", "firecrawl-mcp@3.33.2"],
        "env": {
          "FIRECRAWL_API_KEY": "fc-YOUR-API-KEY"
        }
      }
    }
  }
  ```
</Accordion>

更多详情，请参见 [OAuth 连接指南](/zh/mcp-server/oauth)。如需无人值守使用，请[配置 API 密钥](/zh/mcp-server/keyless#add-an-api-key)。

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

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

```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>

* **工具选择器中没有 Firecrawl 工具：** 打开工具选择器并启用这些工具。每当服务器的工具列表发生变更时，Visual Studio 都会重置工具审批。
* **需要重新登录：** 在 `.mcp.json` 中，通过 `firecrawl` 服务器的 CodeLens 选择 **Manage Authentication**。
* **文件被忽略：** Visual Studio 配置文件的顶层键是 `servers`，而不是 `mcpServers`。
* **存在另一个 `firecrawl` 定义：** Visual Studio 还会读取解决方案文件夹中的 `.vscode\mcp.json` 和 `.cursor\mcp.json`。请只保留一个 Firecrawl 条目。


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