本页内容
当你明确教会 Cursor 如何使用你的工具时,它会变得有用得多。一个 .cursorrules 文件会告诉 Cursor 在哪种任务下挑选哪个 CrawlForge 工具、如何优化 credit 用量,以及 scraping 时该遵循哪些模式。
本指南为你提供面向生产可用的 CrawlForge Cursor 规则,并附上每条规则背后的考量,方便你把它们调整到自己的工作流中。
目录
- 什么是 Cursor 规则?
- 前置条件
- 步骤 1:把 CrawlForge 配置为 MCP server
- 步骤 2:创建你的 .cursorrules 文件
- 步骤 3:网页研究规则
- 步骤 4:数据提取规则
- 步骤 5:credits 优化规则
- 步骤 6:进阶工作流规则
- 完整的 .cursorrules 模板
- credits 成本参考
- 下一步
什么是 Cursor 规则?
Cursor 规则是项目级的指令,用来告诉 Cursor AI 助手该如何行事。它们位于项目根目录下的 .cursorrules 文件中(或作为单独文件放在 .cursor/rules/ 里)。Cursor 处理任何请求时,会把这些规则作为系统级上下文读取。
没有规则时,Cursor 仍会使用 CrawlForge 工具,但会做出次优选择——比如在 fetch_url(1 credit)就足够的情况下使用 deep_research(10 credits)。规则通过把你的工具选择逻辑直接编码进去来解决这一点。
前置条件
- 已安装 Cursor(v0.45+)
- 已安装 CrawlForge MCP server:
npm install -g crawlforge-mcp-server - 一个 CrawlForge API key(免费套餐:1,000 credits)
步骤 1:把 CrawlForge 配置为 MCP server
把 CrawlForge 加入你的 Cursor MCP 设置。打开 Cursor Settings > MCP Servers 并添加:
{
"mcpServers": {
"crawlforge": {
"command": "crawlforge-mcp-server",
"env": {
"CRAWLFORGE_API_KEY": "cf_live_your_key_here"
}
}
}
}重启 Cursor。你应当能在可用的 MCP tools 列表中看到 CrawlForge,且全部 26 个工具均可访问。
步骤 2:创建你的 .cursorrules 文件
在你的项目根目录创建 .cursorrules:
// File: .cursorrules
// This file teaches Cursor how to use CrawlForge tools effectively.
// === CrawlForge MCP Tool Selection ===
// Always use the cheapest CrawlForge tool that accomplishes the task.
// Credit costs: fetch_url(1), extract_text(1), extract_links(1),
// extract_metadata(1), scrape_structured(2), extract_content(2),
// map_site(2), process_document(2), localization(2),
// track_changes(3), analyze_content(3),
// summarize_content(4), crawl_deep(4),
// search_web(5), batch_scrape(5),
// scrape_with_actions(5), stealth_mode(5), deep_research(10)现在我们来逐一充实每一类规则。
步骤 3:网页研究规则
这些规则教会 Cursor 何时进行网页搜索、何时直接获取一个已知 URL:
## Web Research with CrawlForge
When I ask you to research a topic or find information online:
1. If I provide a specific URL, use `fetch_url` (1 credit) or `extract_content` (2 credits) -- NEVER use `search_web` for known URLs.
2. If I ask a general question requiring web search, use `search_web` (5 credits) with a focused query.
3. Only use `deep_research` (10 credits) when I explicitly ask for comprehensive multi-source research or when the topic requires cross-referencing multiple sources.
4. After fetching content, use `summarize_content` (2 credits) only if the content exceeds 2,000 words and I need a summary. Do not summarize short pages.
### URL-Known Pattern (1-2 credits)
- "Fetch the Stripe API docs" -> extract_content("https://docs.stripe.com/api")
- "What does this page say?" -> fetch_url(provided_url)
### Search Pattern (5 credits)
- "Find the best TypeScript testing frameworks" -> search_web("best TypeScript testing frameworks 2026")
- "What are competitors charging?" -> search_web("web scraping API pricing comparison")
### Deep Research Pattern (10 credits)
- "Do a comprehensive analysis of MCP adoption" -> deep_research("MCP protocol adoption trends")步骤 4:数据提取规则
根据用户所需选择正确提取工具的规则:
## Data Extraction with CrawlForge
When I ask you to extract data from websites:
1. For plain text content: use `extract_text` (1 credit)
2. For links/navigation: use `extract_links` (1 credit)
3. For page title, description, OG tags: use `extract_metadata` (1 credit)
4. For article content with readability: use `extract_content` (2 credits)
5. For specific elements via CSS selectors: use `scrape_structured` (2 credits)
6. For JavaScript-rendered pages or interactions: use `scrape_with_actions` (5 credits)
7. For anti-bot protected sites: try `fetch_url` first, then `stealth_mode` (5 credits) only if blocked
### Batch Operations
When I need data from 3+ URLs, always use `batch_scrape` (5 credits) instead of calling individual tools in a loop. batch_scrape handles concurrency and is more credit-efficient for bulk operations.
### CSS Selector Examples
When using scrape_structured, provide precise selectors:
- Product prices: `scrape_structured(url, {selectors: {price: ".price", name: "h1.product-title"}})`
- Article lists: `scrape_structured(url, {selectors: {titles: "article h2", links: "article a[href]"}})`步骤 5:credits 优化规则
这些规则可避免 Cursor 不必要地消耗 credits:
## Credit Optimization Rules
1. NEVER call the same URL twice in one conversation. Cache the result and reference it.
2. Prefer 1-credit tools over 5-credit tools. The decision tree:
- Do I know the URL? -> fetch_url (1cr) NOT search_web (5cr)
- Do I need clean text? -> extract_text (1cr) NOT extract_content (2cr)
- Can I parse HTML locally? -> fetch_url (1cr) then parse the response
3. Before using scrape_with_actions, try fetch_url first. Many "JavaScript-rendered" pages actually serve content in the initial HTML.
4. Combine operations: fetch_url + local parsing is always cheaper than multiple specialized tool calls.
5. When asked about current credit balance, remind the user to check their dashboard at crawlforge.dev/dashboard.步骤 6:进阶工作流规则
面向复杂的多步骤 scraping 流程的规则:
## Multi-Step Workflows
### Competitive Analysis Workflow
When asked to analyze competitors:
1. search_web to find competitor URLs (5 credits)
2. batch_scrape their pricing/feature pages (5 credits)
3. Present structured comparison table -- do NOT use deep_research unless explicitly asked
### Documentation Indexing Workflow
When asked to index documentation:
1. map_site to discover all doc pages (3 credits)
2. batch_scrape the discovered URLs (5 credits)
3. Store extracted content locally for RAG
### Content Monitoring Workflow
When asked to track website changes:
1. extract_content to capture current state (2 credits)
2. Store baseline locally
3. On subsequent checks, extract_content again and diff against baseline
### Site Audit Workflow
When asked to audit a website:
1. map_site for structure (3 credits)
2. extract_metadata on key pages for SEO data (1 credit each)
3. analyze_content on main pages for quality assessment (3 credits each)完整的 .cursorrules 模板
下面是完整的、可直接复制粘贴的模板,它整合了上面所有规则:
# CrawlForge MCP Integration Rules
## Tool Selection Priority (cheapest first)
Always select the lowest-cost CrawlForge tool that accomplishes the task:
- 1 credit: fetch_url, extract_text, extract_links, extract_metadata
- 2 credits: scrape_structured, extract_content, map_site, process_document, localization
- 3 credits: track_changes, analyze_content
- 4 credits: summarize_content, crawl_deep
- 5 credits: search_web, batch_scrape, scrape_with_actions, stealth_mode
- 10 credits: deep_research (use ONLY when explicitly requested)
## Core Rules
1. Known URL -> fetch_url (1cr). NEVER search_web for a known URL.
2. 3+ URLs -> batch_scrape (5cr). NEVER loop individual calls.
3. Try fetch_url before scrape_with_actions. Most pages work without JS rendering.
4. Cache all results. Never fetch the same URL twice per conversation.
5. Only use deep_research when user explicitly asks for multi-source research.
## Output Formatting
- Present scraped data in markdown tables when comparing items
- Include source URLs as references
- Flag any pages that returned errors or empty contentcredits 成本参考
| Credits | 工具 | 典型用例 |
|---|---|---|
| 1 | fetch_url, extract_text, extract_links, extract_metadata | 快速获取页面、发现链接 |
| 2 | scrape_structured, extract_content, map_site, process_document, localization | 提取特定数据、映射站点、处理文档 |
| 3 | track_changes, analyze_content | 跟踪变化、分析内容 |
| 4 | summarize_content, crawl_deep | 摘要、多页爬取 |
| 5 | search_web, batch_scrape, scrape_with_actions, stealth_mode | 网页搜索、批量操作、浏览器自动化 |
| 10 | deep_research | 详尽的多源分析 |
下一步
- CrawlForge 快速上手 -- 60 秒安装 CrawlForge
- 构建一个研究助手 -- 用 Claude 完成的完整项目教程
- 26 个工具参考 -- 完整的工具文档
- GitHub 上的 awesome-cursorrules -- 社区维护的 Cursor 规则合集
开始更聪明地 scraping。 免费注册即可获得 1,000 个 credits,安装 CrawlForge,把这些规则放进你的 .cursorrules 文件。你的 Cursor AI 每次都会选对工具。
亲自试一试——无需注册
在 Playground 中运行 CrawlForge 的 27 个抓取与提取工具中的任意一个,然后免费开始,获取 1,000 credits。
1,000 免费 credits • 每月补充 • 无需信用卡
标签
及时获取最新洞察
将教程、产品更新与 Web 抓取技巧直接发送到你的收件箱。
拒绝垃圾邮件,随时可取消订阅。