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

# 在 LM Studio 中使用 MCP 进行网页搜索与抓取

> 为 LM Studio 的 MCP 宿主添加 Firecrawl 网页抓取与搜索功能

通过远程托管的 MCP 服务器，将 Firecrawl 的搜索、抓取和爬取工具添加到 [LM Studio](https://lmstudio.ai)，让你的本地模型能够访问实时网页内容。

LM Studio 0.3.17 及更高版本可作为 MCP 宿主，从 `mcp.json` 文件读取服务器配置，配置格式与 Cursor 相同。

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

1. [创建 Firecrawl API 键](https://www.firecrawl.dev/app/api-keys)。
2. 在 LM Studio 中，打开右侧边栏的 **Program** 选项卡，然后选择 **Install > Edit mcp.json**。
3. 在 `mcpServers` 下添加 Firecrawl，然后保存：

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

如果 `mcp.json` 中已列出其他服务器，只需将 `"firecrawl": { ... }` 条目复制到现有的 `mcpServers` object 中。

保存文件后，LM Studio 即会加载该服务器。选择一个支持工具使用的模型打开对话，确认对话的工具列表中出现了 `firecrawl_search` 和 `firecrawl_scrape`。

切勿在共享的截图或源代码管理中泄露 API 键。LM Studio 将 `mcp.json` 存放在主目录下的数据文件夹中 (`~/.lmstudio/mcp.json`) 。

<h2 id="sign-in-instead-of-using-a-key">
  使用登录代替键
</h2>

LM Studio 支持远程服务器的 MCP OAuth。将 `https://mcp.firecrawl.dev/v2/mcp-oauth` 设为服务器的 `url`，无需设置 `headers`，然后按照浏览器中的提示完成登录。请参见[面向人类用户](/zh/mcp-server/oauth)。

<h2 id="run-the-local-server-instead">
  改为运行本地服务器
</h2>

如需在本地机器上运行 Firecrawl，请将 `url` 条目替换为一个用于启动 npm 包的 `command` 条目。有关最新的命令和选项，请参见[本地 MCP 服务器指南](/zh/mcp-server/local)。

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

```text theme={null}
使用 Firecrawl 进行网页搜索，查找“LM Studio MCP”相关内容，并总结各信息来源。
```

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

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

* **工具未显示：** 确认模型支持工具使用，然后检查 `mcp.json` 是否为有效的 JSON，以及 `firecrawl` 条目是否位于 `mcpServers` 中。
* **身份验证失败：** 确认标头内容为 `Bearer` 加一个空格再加你的键，并确认该键在 [Firecrawl 控制台](https://www.firecrawl.dev/app/api-keys)中处于启用状态。
* **模型变慢或上下文不足：** Firecrawl 工具可能返回很长的页面。可以请求具体的 URL、改用上下文窗口更大的模型，或只启用所需的工具。
* **审查工具调用：** LM Studio 默认会在运行 MCP 工具前请求确认。请只从可信的来源安装 MCP 服务器。


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