MCP 配方

MCP 配方

安装 FourA MCP server 后,您可以将以下 6 个提示词复制粘贴并在任何兼容 MCP 的客户端(Claude Desktop、Claude Code、Cursor、Windsurf、VS Code)中运行。

每个配方均使用 foura_auto(智能默认选项)或结合使用更底层的 foura_singlefoura_proxyfoura_browser 来完成常见的抓取任务。有两种使用方式:

  1. 调用内置提示词:所有 MCP 客户端都会将服务器提供的提示词显示为斜杠命令或 /prompts 面板。选择提示词,填写参数并运行。MCP 服务器将返回模板化工作流,LLM 使用正确的工具执行该工作流。
  2. 复制文本:将下方的文本复制到您的聊天中。效果相同,但发现性较差。

MCP 服务器原生提供这些提示词:smart_fetchscrape_product_pageextract_articlemonitor_pricingcheck_endpoint_healthbulk_fetch_urls

关于大型页面的说明 (v0.2.0+): 默认情况下,无论大小如何,响应体都会在 structuredContent 中内联返回,这适用于包括 Claude Desktop 在内的所有 MCP 客户端。如果您的客户端支持 MCP resources/read,且希望在处理大页面时节省 token,请在工具调用中传入 offload_large: true。对于大于等于 50 KB 的响应,它们将作为 resource_link 返回,客户端可按需获取。以下内置提示词假定使用默认设置(内联)。

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

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

最简单的配方:将 URL 传给 foura_auto,让其在可用的请求方法中进行有限次数的尝试。当您只需要获取内容而不需要自己选择第一个工具时,请使用此配方。

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

手动提示词:

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. 抓取产品页面

适用于电子商务产品详情页,包括单页应用站点和受反机器人验证保护的页面。

内置:scrape_product_page(url)

手动提示:

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)

手动提示词:

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, captcha 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?)

手动提示词:

Use foura_proxy with maxTries:5 and unblocker:true 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"}

适用场景:降价提醒代理、机票价格监控、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 (from the total_time field)
- 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 的元数据而无需内联其正文的批处理任务。

内置:bulk_fetch_urls(urls)

手动提示:

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, captcha 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. 选择并复用特定国家出口

当目标必须看到请求来自特定国家列表中的某个国家时使用此方法,包括必须在浏览器渲染前进行 proxy 选择的 JavaScript 页面。

手动提示:

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.

适用此方案的场景:区域内容、许可市场、特定地理定价,或任何需要验证目标可见国家/地区并随后重用所选出口的工作流。

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 时,请使用此方法。request 默认提供最新的 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 block 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 的情况下重试;请保留该要求,或在更改前询问用户。
  • 大体积响应体会默认内联 (v0.2.0+)。 在支持这些功能的客户端上,传递 offload_large: true 以切换至 resource_link + resources/read

需要此处未提供的方案?

请发送邮件至 support@foura.ai 说明用例。MCP 服务器与 REST API 的发布节奏保持一致,同步提供新的提示词。

更新于: 2026年8月6日