CrawlForge
首页Playground应用场景集成价格文档博客
如何在 Zed AI 中使用 CrawlForge MCP 进行网页抓取
Tutorials
返回博客
教程

如何在 Zed AI 中使用 CrawlForge MCP 进行网页抓取

C
CrawlForge Team
工程团队
2026年4月14日
阅读时长 9 分钟

本页内容

Zed 很快。Zed AI 很强大。但 Zed AI 看不到网络——除非你接入一个 MCP server。CrawlForge 提供 20 个 scraping 工具,Zed AI 可以直接从 Assistant 面板调用它们。

Json
// ~/.config/zed/settings.json
{
  "context_servers": {
    "crawlforge": {
      "command": { "path": "crawlforge-mcp-server" },
      "settings": { "CRAWLFORGE_API_KEY": "cf_live_your_key" }
    }
  }
}

本指南将带你走完在 Zed AI 中抓取网站的每一步,附带真实代码和完整的故障排查章节。

目录

  • 为什么在 Zed AI 中做 web scraping 很重要
  • 前置条件
  • 步骤 1:安装 CrawlForge MCP
  • 步骤 2:配置 Zed 的 Context Server
  • 步骤 3:重启 Zed 并验证
  • 步骤 4:从 Assistant 发起第一次抓取
  • 完整可用示例:抓取一份 API 参考文档
  • 进阶:stealth 与结构化提取
  • 故障排查
  • 常见问题

为什么在 Zed AI 中做 web scraping 很重要

Zed AI 就在编辑器里。当你不离开 Assistant 就能在 Zed AI 中抓取网站时,下面这些模式就变得很廉价:

  • 阅读第三方 SDK 的文档,然后按你项目的风格生成一个 wrapper。
  • 抓取竞品的博客文章,然后总结其架构决策。
  • 拉取一份 sitemap,然后标记出你的 crawler 还没访问过的页面。

Zed 的 MCP 支持(在设置中称为 "Context Servers")于 2024 年推出,使用与 Claude Desktop 和 Cursor 相同的开放协议。CrawlForge 通过 MCP 暴露 20 个 scraping 工具,因此它们会出现在 Zed 的斜杠命令菜单中,无需任何胶水代码。关于协议背景,请参阅我们的 MCP 协议讲解。

前置条件

  • Zed 0.148+ —— 从 zed.dev 下载
  • Node.js 18+
  • CrawlForge 账户 —— 在 crawlforge.dev/signup 免费注册,含 1,000 credits

步骤 1:安装 CrawlForge MCP

Bash
npm install -g crawlforge-mcp-server
crawlforge-mcp-server --version
# crawlforge-mcp-server 4.8.1

步骤 2:配置 Zed 的 Context Server

用 Cmd+,(macOS)或 Ctrl+,(Linux/Windows)打开 Zed 设置。Zed 设置位于 ~/.config/zed/settings.json。添加一个 context_servers 区块:

Json
{
  "context_servers": {
    "crawlforge": {
      "command": {
        "path": "crawlforge-mcp-server",
        "args": [],
        "env": {
          "CRAWLFORGE_API_KEY": "cf_live_your_key_here"
        }
      }
    }
  }
}

把 cf_live_your_key_here 替换为 crawlforge.dev/dashboard/api-keys 中的 key。

步骤 3:重启 Zed 并验证

  1. 完全退出 Zed(Cmd+Q)。
  2. 重新打开并打开 Assistant 面板(Cmd+?)。
  3. 在 Assistant 提示框中输入 /。你应当在建议列表中看到 CrawlForge 工具:/fetch_url、/scrape_structured、/search_web 等等。

步骤 4:从 Assistant 发起第一次抓取

在 Assistant 面板中,试试:

Use CrawlForge to fetch https://news.ycombinator.com and return the top 5 story titles.

Zed 调用 fetch_url(1 credit),将 HTML 流式返回,然后 Zed AI 提取标题。响应会内联显示在 Assistant 面板中,随时可以粘贴到 buffer 里。

完整可用示例:抓取一份 API 参考文档

假设你正在集成 Stripe API,想要把完整的 PaymentIntent 字段列表生成为 TypeScript。粘贴这个提示:

Use CrawlForge's extract_content on https://docs.stripe.com/api/payment_intents/object. Then write a TypeScript interface that matches every documented field.

Zed 在底层发出这个调用:

Typescript
// What Zed AI sends to CrawlForge
const response = await fetch('https://crawlforge.dev/api/v1/tools/extract_content', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${process.env.CRAWLFORGE_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    url: 'https://docs.stripe.com/api/payment_intents/object',
    options: { format: 'markdown' },
  }),
});

const { content } = await response.json();
// content is clean markdown of the PaymentIntent object

成本:2 credits。Zed AI 读取这份 markdown 并生成:

Typescript
// types/stripe-payment-intent.ts
export interface StripePaymentIntent {
  id: string;
  object: 'payment_intent';
  amount: number;
  amount_capturable: number;
  amount_received: number;
  application: string | null;
  application_fee_amount: number | null;
  automatic_payment_methods: {
    enabled: boolean;
    allow_redirects?: 'always' | 'never';
  } | null;
  canceled_at: number | null;
  cancellation_reason: string | null;
  capture_method: 'automatic' | 'automatic_async' | 'manual';
  client_secret: string;
  confirmation_method: 'automatic' | 'manual';
  created: number;
  currency: string;
  customer: string | null;
  // ... remaining fields omitted for brevity
}

把它粘贴到 buffer 里,几秒钟内你就拥有了类型安全的 Stripe 集成。

进阶:stealth 与结构化提取

撞上了 Cloudflare 墙? 把 fetch_url 换成 stealth_mode:

Use CrawlForge's stealth_mode on https://locked-down-site.example.com and return the main article text.

成本从 1 credit 升至 5 credits,但能绕过大多数反爬虫系统。

想要 CSS 选择器级的精度? 使用 scrape_structured:

Use scrape_structured on https://ycombinator.com/companies with: - name: .company-name - batch: .batch-tag - description: .company-description

Zed AI 返回一个带类型的数组。每次运行 2 credits。

credits 参考

工具Credits何时使用
fetch_url1静态 HTML
extract_content2可读的文章 / 文档
scrape_structured2CSS 选择器字段
search_web5URL 未知
stealth_mode5反爬虫保护
scrape_with_actions5带交互的 SPA
deep_research10多来源综合

故障排查

斜杠菜单中缺少工具 —— Context server 配置未加载。检查 ~/.config/zed/logs/Zed.log 中是否有 context_servers 解析错误。JSON 中的尾随逗号会静默地禁用整个区块。

"Failed to spawn crawlforge-mcp-server" —— Zed 找不到二进制文件。把 "path": "crawlforge-mcp-server" 替换为 which crawlforge-mcp-server 给出的绝对路径,例如 "path": "/usr/local/bin/crawlforge-mcp-server"。

每次调用都返回 401 Unauthorized —— API key 错误或未设置。用 curl -H "Authorization: Bearer $CRAWLFORGE_API_KEY" https://crawlforge.dev/api/v1/credits/balance 进行验证。预期的响应会包含你剩余的 credits。

Assistant 选错了工具 —— 显式指定它:"Use CrawlForge's scrape_structured..." 而不是 "scrape this page."。当意图不明确时,Zed AI 默认选择最便宜的匹配项。

Zed 在长时间抓取时卡住 —— 深度研究可能运行 60 秒以上。Zed 会显示一个加载图标,但输入仍然有响应;请等待其完成,而不是取消。

后续步骤

  • 探索你可以从 Zed 调用的 全部 20 个 CrawlForge 工具
  • 阅读 完整的 MCP web scraping 指南 了解架构模式
  • 查看 快速上手文档 获取 API 参考
  • 如果你正在评估供应商,可与 Firecrawl 替代方案 进行对比

在 crawlforge.dev/signup 免费开始——1,000 credits,无需信用卡。

亲自试一试——无需注册

在 Playground 中运行 CrawlForge 的 27 个抓取与提取工具中的任意一个,然后免费开始,获取 1,000 credits。

1,000 免费 credits • 每月补充 • 无需信用卡

标签

Zed-AIweb-scrapingMCPtutorialcontext-serverseditorAI-agents

关于作者

C

CrawlForge Team

工程团队

我们正在打造功能最全面的 Web 抓取 MCP server。我们开发的工具帮助开发者为 AI 应用提取、分析和转换 Web 数据。

及时获取最新洞察

将教程、产品更新与 Web 抓取技巧直接发送到你的收件箱。

拒绝垃圾邮件,随时可取消订阅。

付诸实践

在任意 URL 上测试 CrawlForge 的工具——免费,无需注册。

本页内容

Frequently Asked Questions

Zed AI 开箱即支持 MCP servers 吗?+

是的。Zed 0.148 及更高版本以 "context servers" 之名支持 MCP。配置位于 ~/.config/zed/settings.json 的 context_servers 键下。配置完成后,工具就会出现在 Assistant 面板的斜杠菜单中。

没有付费套餐也能在 Zed 中使用 CrawlForge 吗?+

Zed AI 同时提供免费和付费层级,CrawlForge 在两者上都能用。CrawlForge 免费层每月提供 1,000 credits——足够约 1,000 次基础抓取或 100 次深度研究查询。

如何在 Zed 中调试 context server 错误?+

打开 ~/.config/zed/logs/Zed.log 并搜索 "context_servers"。JSON 语法错误、缺失的二进制文件以及无效的环境变量都会在这里暴露出来。一个常见的元凶是 settings.json 中的尾随逗号,它会静默地禁用整个区块。

是什么让 Zed AI 很适合 web scraping 任务?+

Zed 由原生代码驱动,速度快,因此把大量抓取结果流式返回到 Assistant 会感觉是即时的。再加上 Zed AI 会自动选择正确的 MCP 工具,你可以在不打断心流的情况下完成研究、提取和代码生成。

多个 MCP servers 能在 Zed 中同时运行吗?+

可以。context_servers 区块接受多个条目。你可以让 CrawlForge 与 filesystem、git 或数据库 MCP servers 并行运行。Zed AI 会把所有暴露出来的工具呈现在一个统一的斜杠菜单中。

相关文章

如何用 Claude Code 抓取网站(2026 指南)
Tutorials

如何用 Claude Code 抓取网站(2026 指南)

用 Claude Code 和 CrawlForge MCP 从你的终端抓取任何网站。抓取页面、提取数据并绕过反爬虫,全程不到 2 分钟。

C
CrawlForge Team
|
4月14日
|
10 分钟
如何在 Cursor IDE 中使用 CrawlForge MCP 抓取网站
Tutorials

如何在 Cursor IDE 中使用 CrawlForge MCP 抓取网站

把 Cursor IDE 变成网页抓取工作站。接入 CrawlForge MCP,无需离开编辑器即可从任意站点提取结构化数据。

C
CrawlForge Team
|
4月14日
|
9 分钟
如何在 VS Code 中用 GitHub Copilot agent 抓取网站
Tutorials

如何在 VS Code 中用 GitHub Copilot agent 抓取网站

为 VS Code 中的 GitHub Copilot agent 添加 web scraping 能力。配置 CrawlForge MCP,让 Copilot 能按需获取、提取并研究实时网页数据。

C
CrawlForge Team
|
4月14日
|
10 分钟

页脚

CrawlForge

面向 AI Agent 的企业级网页抓取。27 个专业 MCP 工具,专为构建智能系统的现代开发者而设计。

产品

  • 功能
  • Playground
  • 价格
  • 应用场景
  • 集成
  • 替代方案
  • 更新日志

资源

  • 快速上手
  • API 参考
  • 模板
  • 指南
  • 博客
  • 术语表
  • 常见问题
  • 网站地图

开发者

  • MCP 协议
  • Claude Desktop
  • Cursor IDE
  • LangChain
  • LlamaIndex

公司

  • 关于我们
  • 联系我们
  • 隐私政策
  • 服务条款
  • 可接受使用政策
  • Cookie

保持更新

获取新工具和新功能的最新动态。

基于 Next.js 和 MCP 协议构建

© 2025-2026 CrawlForge。保留所有权利。