MCP 配方

MCP Recipes

安装 FourA MCP server 后,可在任何兼容 MCP 的客户端(Claude Desktop、Claude Code、Cursor、Windsurf、VS Code)中直接运行的 9 个即用型 prompt。

每个 recipe 都针对常见抓取任务,调用 foura_auto(智能默认项)或一个/多个更底层的 foura_single、foura_proxy、foura_browser。有两种使用方式:

  1. 调用内置 prompt:所有 MCP 客户端都会将服务端提供的 prompt 展示为斜杠命令或 /prompts 面板。选择 prompt,填写参数并运行。MCP server 会返回模板化工作流,LLM 将使用正确的工具执行它。
  2. 复制下方文本到您自己的对话中。效果相同,但发现成本稍高。

MCP server 原生提供以下 prompt:smart_fetch、scrape_product_page、extract_article、monitor_pricing、check_endpoint_health、bulk_fetch_urls。

关于大页面的说明(v0.2.0+): 默认情况下,无论大小,响应体都会在 structuredContent 中内联返回,这适用于包括 Claude Desktop 在内的所有 MCP 客户端。如果您使用的客户端支持 MCP resources/read 且希望在大页面上节省 token,请在工具调用中传入 offload_large: true。此时大于等于 50 KB 的响应将作为 resource_link 返回,由客户端按需获取。下方的内置 prompt 均采用默认配置(内联)。

已在 GitHub 开源;在 npm 发布为 @fouradata/mcp。

智能获取(自动):从这里开始

最简单的 recipe:将 URL 传给 foura_auto,让其在可用 request 方法中进行有上限的尝试。只要您需要获取内容且无需自行选择首选工具,即可使用此方式。

内置:smart_fetch(url, must_contain?, extract?)

手动 prompt:

Fetch <URL> using foura_auto.

Pass validate.data.accept:["<a string the real page must contain>"] so only the real page counts as success. Auto makes bounded attempts and returns an error if none satisfies the validation.

For a plain follow-up, call foura_single with session.proxy as proxy, session.cookies serialized as a Cookie header, and session.userAgent as a User-Agent header. For JavaScript, pass the session values to the matching foura_browser fields.

Return the content, or extract the requested fields as JSON.

适用场景:首次尝试且应由 FourA 选择方法时,尤其适用于内容验证可区分真实页面与拒绝访问页面的情况。

1. 抓取商品页面

适用于电商商品详情页,包括单页面应用(SPA)站点及包含站点验证的页面。

内置:scrape_product_page(url)

手动 prompt:

Fetch the product page at <URL> using foura_browser - most product pages are single-page apps and need JavaScript to render.

From the response body extract:
- product title
- price (with currency)
- primary product image URL (absolute, not relative)
- availability / stock status
- product SKU or ID if visible

Return as JSON: {"title": "...", "price": 0, "currency": "USD", "image_url": "...", "in_stock": true, "sku": "..."}

适用场景:比价 Agent、到货通知程序、竞品分析表格。

2. 提取文章

适用于新闻文章、博客文章、技术文档等任何需要纯净阅读文本、去除导航、广告和页脚干扰的场景。

内置:extract_article(url)

手动 Prompt:

Fetch <URL> using foura_single with unblocker:true. Use plain HTTP first when the article is present in the server-rendered response.

If foura_single returns a 403, a verification page, or empty content, retry the same URL with foura_proxy (maxTries:3) - it routes through a rotating proxy pool.

From the response, extract:
- headline (the main H1, not the page title bar)
- author byline (may be inside .author, [rel=author], itemprop)
- publication date (look for <time>, .published, or JSON-LD)
- main article body (strip navigation, ads, related-content, footer, comments)
- canonical URL (rel=canonical or og:url)

Return as JSON: {"title": "...", "author": "...", "date_published": "ISO8601", "body": "...", "canonical_url": "..."}

适用场景:研究摘要生成器、单站点 RSS 订阅、每日新闻汇总。

3. 监控价格

适用于定价页面和商品优惠,支持与目标价格进行可选对比。

内置:monitor_pricing(url, target_price?)

手动 prompt:

Use foura_proxy with maxTries:5 to fetch <URL>. Pricing pages often have aggressive bot detection, so go through the proxy pool from the start.

Extract the current price (look for visible $/€/£ amounts, JSON-LD Offer schema, [itemprop=price]).

If a target price is provided, compare: report whether current is below/at/above target and the absolute difference.

Return as JSON: {"url": "...", "current_price": 0.00, "currency": "USD", "target_price": 0, "difference": 0, "status": "below|at|above"}

适用场景:降价提醒 Agent、差旅票价监控、B2B 竞品价格追踪。

4. 检查 endpoint 健康状态

适用于正常运行时间探测和 API endpoint 验证。

内置:check_endpoint_health(url, expected_text?)

手动提示词:

Use foura_single with GET on <URL>, timeout_ms:5000, and validate.status.accept:[200]. If an expected substring is provided, also set validate.data.accept:["<EXPECTED>"] so the request only counts as success when the body contains it.

Report:
- reachable (true if any response came back, false on connection error/timeout)
- status_code (HTTP code from target)
- total_time_ms (the total_time field is in seconds: multiply by 1000)
- validation_passed (true if status + body validation conditions were met)

Return as JSON: {"url": "...", "reachable": true, "status_code": 200, "total_time_ms": 0, "validation_passed": true}

适用场景:外部正常运行时间监控、部署冒烟测试、第三方 API 看门狗。

5. 并行获取 URL 列表

适用于需要获取多个 URL 的元数据但无需内联其 body 的批处理任务。

内置:bulk_fetch_urls(urls)

手动 prompt:

Parse the following comma-separated URLs and fetch each one concurrently using foura_single (unblocker:true).

URLs: <COMMA_SEPARATED>

For any URL that returns 403, a verification page, or empty body - retry that single URL with foura_proxy (maxTries:3).

Return a JSON array, one entry per URL in input order:
[{"url": "...", "status": 200, "success": true, "body_size_bytes": 0, "via": "single|proxy", "error": null}, ...]

Do NOT inline full response bodies in the output - only metadata. If you need body content, call foura_single individually after this report.

适用场景:站点地图可达性排查、失效链接审计,以及“检查这 50 个产品 URL 中有哪些仍然存在”等需求。

6. 选择并复用指定国家/地区的出口

当目标必须接收来自特定国家/地区列表的 request 时使用此方案,包括必须在浏览器渲染前完成 proxy 选择的 JavaScript 页面。

手动 prompt:

First call foura_proxy for the actual target:
{
  "maxTries": 5,
  "exitCountries": ["FR", "GB"],
  "request": { "method": "GET", "url": "<TARGET_URL>" }
}

Treat exitCountries as a strict allowlist. On success, verify that exitCountry is FR or GB and capture the returned proxy ID.

If the page then needs JavaScript, call foura_browser with the returned proxy ID in foura_browser.proxy. Do not start a new proxy selection, because that may choose a different exit.

If foura_proxy returns no_eligible_proxy, preserve the requested country scope and retry later. Change or widen the list only after the user explicitly changes the requirement. Never retry silently without exitCountries.

适用场景:区域内容、授权市场、特定地区定价,或任何需要已验证的目标可见国家并随后复用所选出口的工作流。国家范围限定包含在 Startup 及以上方案中;在其他方案中,foura_proxy 会返回 plan_limit_feature,重试无法解决该问题。

7. 受保护页面:优先使用 proxy,需要 JavaScript 时使用浏览器

当直接 request 返回拒绝页面时,使用带有内容验证的有限 proxy 尝试。如果验证后的 response 成功,但所需内容仍需要 JavaScript,请在浏览器中复用该确切 proxy ID。存在可见的防护厂商并不保证任何方法都能成功。

手动提示词:

Step 1 - call foura_proxy for <TARGET_URL>. Put a string unique to the real page in request.validate.data.accept. If the user supplied an allowed country list, pass it as exitCountries; do not guess country codes.

Step 2 - if the response passes validation and JavaScript is still required, call foura_browser with the returned proxy ID in the proxy field.

Do not call foura_proxy again after a successful selection, because the new call may choose a different exit. If the bounded attempt fails, report the failure honestly instead of claiming support for the target's protection vendor.

适用场景:受保护的目标站点,其中 HTTP 可以选择可用的出口,但最终内容需要 JavaScript 渲染。

8. 在静态页面被拦截:更改呈现的浏览器

当静态目标返回拦截或质询页面且问题并非由 JavaScript 引起时使用此方案。请求默认呈现最新的 Google Chrome,某些目标可能会接受其他浏览器或平台。

手动提示词:

Step 1 - call foura_single for <TARGET_URL> with request validation: put a string unique to the real page in validate.data.accept.

Step 2 - if the response is a refusal page, or defense comes back with solved false, call foura_single again with a different presented browser, for example {"browser": "Firefox"} or {"browser": "Chrome", "os": "Android"}. Keep the same validation.

If the tool answers that the combination does not exist, pick one from the list it returns. Do not retry the same impossible combination, and do not assume another browser was used instead: the request was refused, not substituted.

Step 3 - if changing the presented browser does not help, escalate to foura_proxy for a different exit, and to foura_browser only when the content genuinely needs JavaScript.

适用场景:目标网站采用服务端渲染,且过滤规则基于客户端特征而非出口 IP 地址。更改呈现的浏览器无需额外成本,值得在进行 proxy 轮换前尝试。

通用提示

  • 不确定使用哪个工具?请使用 foura_auto。 它会自动选择方法并处理升级策略。仅在需要显式控制时才指定具体工具。
  • 纯 HTTP 足够时,从 foura_single 开始。 当直接 request 被阻止时升级到 foura_proxy,当所需内容需要 JavaScript 时升级到 foura_browser。
  • 类浏览器 request header 默认启用 (unblocker)。 请保持内容验证开启,避免将拦截页面判定为成功;当目标拒绝默认配置时,可通过 browser、os 或 version 更改呈现的浏览器。
  • 验证规则可节省重试次数。 设置 validate.data.fail:["captcha", "blocked"],以便将明显被拦截的 response 视为失败并触发重试或 proxy 升级,而不是将其解析为成功。
  • 国家/地区范围限制严格。 出现 no_eligible_proxy 结果并不意味着可以在不指定 exitCountries 的情况下重试;请保留该要求,或在更改前询问用户。
  • 大型 body 默认内联返回 (v0.2.0+)。 在支持相关功能的客户端上,可传入 offload_large: true 切换为 resource_link + resources/read。

需要此处未列出的方案?

请将使用场景发送邮件至 support@foura.ai。MCP server 会以与 REST API 发布相同的节奏更新 prompt。

更新于: 2026年9月27日