在 OpenCode 中通过 MCP 使用网页搜索与抓取
为 OpenCode 添加 Firecrawl 的网页抓取与搜索功能
通过 MCP 为 OpenCode 添加 Firecrawl 的搜索、抓取、爬取和浏览器工具。
在 firecrawl.dev/app 注册,然后复制您的 API 密钥。
OpenCode 会从 ~/.config/opencode/config.json (全局) 或项目中的 ./opencode.json 读取配置。添加:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"firecrawl": {
"type": "local",
"command": ["npx", "-y", "firecrawl-mcp"],
"environment": {
"FIRECRAWL_API_KEY": "fc-YOUR-API-KEY"
}
}
}
}将 fc-YOUR-API-KEY 替换为你的 Firecrawl API 密钥。
opencodeOpenCode 会在启动时加载 MCP 服务器。请确认已接入 Firecrawl:
/mcp进行网页搜索,查找 "Bun 2.0 changelog" 并总结排名靠前的结果。抓取 https://docs.firecrawl.dev/introduction and list the code examples.爬取 https://example.com/blog and save each post as markdown.{
"mcp": {
"firecrawl": {
"type": "remote",
"url": "https://mcp.firecrawl.dev/v2/mcp"
}
}
}此配置使用免密钥 Firecrawl 工具集。若需连接账户或进行无人值守设置,请参阅托管 MCP 连接模式;请将 API 密钥存储在 Authorization 请求头或安全密钥存储中,切勿放入 URL。
- 服务器未连接 — 运行
opencode doctor检查 MCP 加载错误。 npx权限被拒绝 — 安装 Node.js 18+,并确保 shell 已正确识别该安装 (which npx) 。
Was this page helpful?Suggest editsRaise issue