@fouradata/mcp 0.2.11 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # @fouradata/mcp
2
2
 
3
- [FourA Web Scraping API](https://foura.ai/) as three [Model Context Protocol](https://modelcontextprotocol.io) tools plus five built-in workflow prompts. Plug it into Claude Desktop, Claude Code, Cursor, Windsurf, or any other MCP client and fetch arbitrary public web pages, bypass anti-bot challenges, and render JavaScript-heavy sites without writing a line of integration code.
3
+ [FourA Web Scraping API](https://foura.ai/) as four [Model Context Protocol](https://modelcontextprotocol.io) tools plus six built-in workflow prompts. Plug it into Claude Desktop, Claude Code, Cursor, Windsurf, or any other MCP client and fetch arbitrary public web pages, bypass anti-bot challenges, and render JavaScript-heavy sites - without writing a line of integration code.
4
4
 
5
- Three tools, five prompts, one API key.
5
+ Four tools, six prompts, one API key.
6
6
 
7
- ## Quick Start local stdio (recommended for Claude Desktop)
7
+ ## Quick Start - local stdio (recommended for Claude Desktop)
8
8
 
9
9
  Grab a key at [foura.ai/dashboard#api-keys](https://foura.ai/dashboard#api-keys) (one click, shown once on creation, format `pk_live_...`). Then drop this into your MCP client's config:
10
10
 
@@ -24,7 +24,7 @@ Grab a key at [foura.ai/dashboard#api-keys](https://foura.ai/dashboard#api-keys)
24
24
 
25
25
  > **Claude Desktop gotcha:** fully quit Claude Desktop (`Cmd+Q` on macOS) **before** editing the config file. If the app is still running, it will overwrite your edits with its in-memory config on exit.
26
26
 
27
- The npx command downloads the package on first launch (~10s) and runs it as a subprocess of your MCP client. No global install needed. Same JSON works in every major client just point it at the right file:
27
+ The npx command downloads the package on first launch (~10s) and runs it as a subprocess of your MCP client. No global install needed. Same JSON works in every major client - just point it at the right file:
28
28
 
29
29
  | Client | Where the config lives |
30
30
  |---|---|
@@ -35,9 +35,9 @@ The npx command downloads the package on first launch (~10s) and runs it as a su
35
35
  | Windsurf | `~/.codeium/windsurf/mcp_config.json` |
36
36
  | VS Code (MCP extension) | `.vscode/mcp.json` in your workspace |
37
37
 
38
- Restart the client and `foura_single`, `foura_proxy`, `foura_browser` show up in your tool list, plus five prompts under `/prompts`.
38
+ Restart the client and `foura_auto`, `foura_single`, `foura_proxy`, `foura_browser` show up in your tool list, plus six prompts under `/prompts`.
39
39
 
40
- ## Quick Start hosted (Streamable HTTP)
40
+ ## Quick Start - hosted (Streamable HTTP)
41
41
 
42
42
  For clients that support the Streamable HTTP transport (Cursor, Windsurf, VS Code, Claude Code with `--transport http`), point them at the hosted endpoint instead of running a local subprocess:
43
43
 
@@ -54,7 +54,7 @@ For clients that support the Streamable HTTP transport (Cursor, Windsurf, VS Cod
54
54
  }
55
55
  ```
56
56
 
57
- Current Claude Desktop builds reject the bare `url` form use the stdio config above for Claude Desktop, or bridge through `mcp-remote`:
57
+ Current Claude Desktop builds reject the bare `url` form - use the stdio config above for Claude Desktop, or bridge through `mcp-remote`:
58
58
 
59
59
  ```json
60
60
  {
@@ -67,15 +67,34 @@ Current Claude Desktop builds reject the bare `url` form — use the stdio confi
67
67
  }
68
68
  ```
69
69
 
70
- ## The Three Tools
70
+ ## The Tools
71
71
 
72
- All three are marked `readOnlyHint: true` and `openWorldHint: true` per the [MCP spec](https://modelcontextprotocol.io/specification/2025-06-18/server/tools) clients that auto-approve trusted read-only tools (Claude Desktop, Cursor in 2026) call them without a per-request confirmation modal.
72
+ `foura_auto` is the **default** - give it a URL and it returns the content, picking the fetch method for you. The other three are the lower-level primitives it orchestrates; reach for them when you want explicit control.
73
+
74
+ All four are marked `readOnlyHint: true` and `openWorldHint: true` per the [MCP spec](https://modelcontextprotocol.io/specification/2025-06-18/server/tools) - clients that auto-approve trusted read-only tools (Claude Desktop, Cursor in 2026) call them without a per-request confirmation modal.
73
75
 
74
76
  Every response carries both human-readable text (`content`) and a typed `structuredContent` JSON object validated against the tool's `outputSchema`. Clients pass `structuredContent` to your LLM natively, skipping the re-tokenization tax on stringified JSON.
75
77
 
76
- ### `foura_single` fast HTTP
78
+ ### `foura_auto` - smart fetch (the default)
79
+
80
+ Give a URL, get the content back. Use this first when you just want the page and don't want to choose a method. Internally it walks a cost-aware ladder - a fast direct request, then a rotating proxy, then a full browser session - escalating only as far as the target forces it, solving common bot challenges on the way, and cheaply replaying a warm session on repeat calls to the same host. It learns the right settings per host, so there are no `maxTries` / pool / retry knobs to tune.
81
+
82
+ ```jsonc
83
+ {
84
+ "url": "https://example.com",
85
+ // optional: a substring the REAL page must contain, so auto can tell a
86
+ // real page from a challenge page on protected targets
87
+ "validate": { "data": { "accept": ["Example Domain"] } }
88
+ }
89
+ ```
90
+
91
+ The client surface is intentionally minimal: `url` (required), plus optional `method`, `headers`, `data`, `validate`, `returnSession` (default `true`), `forceProxy` (default `true`), `timeout_ms` (5000-180000, default 120000), `ignoreProxies`.
92
+
93
+ `structuredContent` shape: `{status, headers, data, meta, session}`. `meta` is always present - `{rung, solved, attempts, credits}` - the trace of which rung delivered and what it cost. `session` (`{proxy, cookies, userAgent}`) is returned by default so you can replay the same session through `foura_single` / `foura_proxy` afterwards (pass `session.proxy` into their `proxy` field). Send `returnSession: false` to omit it. There is no `total_time` field on auto.
94
+
95
+ ### `foura_single` - fast HTTP
77
96
 
78
- One HTTP request, response back. Typically 200ms2s. Use it for static pages, JSON APIs, server-rendered HTML the bread and butter of scraping. Set `unblocker: true` if the target is picky about wire-level signals.
97
+ One HTTP request, response back. Typically 200ms-2s. Use it for static pages, JSON APIs, server-rendered HTML - the bread and butter of scraping. Set `unblocker: true` if the target is picky about wire-level signals.
79
98
 
80
99
  ```jsonc
81
100
  {
@@ -85,11 +104,11 @@ One HTTP request, response back. Typically 200ms–2s. Use it for static pages,
85
104
  }
86
105
  ```
87
106
 
88
- Supports custom headers, a body, per-stage timeouts, redirect controls, JSON auto-parse, a binary-buffer mode, and built-in response validation (`validate.status.accept`, `validate.data.fail`, and so on). If `foura_single` comes back blocked status 403/429, captcha page, OR response headers `x-vercel-mitigated: challenge` / `cf-mitigated: challenge`, OR body title matches `Vercel Security Checkpoint` / `Just a moment` / `Attention Required` escalate to `foura_proxy` with `maxTries: 25-30` for these tier-1 WAFs. If the page also needs JavaScript to render, chain `foura_proxy`'s returned `proxy` ID into `foura_browser.proxy`.
107
+ Supports custom headers, a body, per-stage timeouts, redirect controls, JSON auto-parse, a binary-buffer mode, and built-in response validation (`validate.status.accept`, `validate.data.fail`, and so on). If `foura_single` comes back blocked - status 403/429, captcha page, OR response headers `x-vercel-mitigated: challenge` / `cf-mitigated: challenge`, OR body title matches `Vercel Security Checkpoint` / `Just a moment` / `Attention Required` - escalate to `foura_proxy` with `maxTries: 25-30` for these tier-1 WAFs. If the page also needs JavaScript to render, chain `foura_proxy`'s returned `proxy` ID into `foura_browser.proxy`.
89
108
 
90
109
  `structuredContent` shape: `{status, headers, data, total_time, ...}`.
91
110
 
92
- ### `foura_proxy` rotating proxies with retry
111
+ ### `foura_proxy` - rotating proxies with retry
93
112
 
94
113
  Same target shape as `foura_single`, but routed through a pool of proxies with automatic retry on failure. Per-host scoring picks the proxies most likely to succeed against this particular target, so you're not burning attempts on known-bad routes.
95
114
 
@@ -104,9 +123,9 @@ Same target shape as `foura_single`, but routed through a pool of proxies with a
104
123
  }
105
124
  ```
106
125
 
107
- Typical latency 15s. `structuredContent` adds `proxy` (the encoded ID of the proxy that succeeded pass it to `ignoreProxies` next time if it later goes bad) and `total` (outer timing including selection + retries). For tier-1 WAF challenges (Vercel Security Checkpoint, Cloudflare 'Just a moment', Akamai Bot Manager) use `maxTries: 25-30` the default 5 is sized for lightly-blocked sites. If still blocked after 30 attempts the gate is likely country / ASN allowlist (not solvable by rotation) pivot strategy. If the target needs JavaScript render, chain the returned `proxy` ID into `foura_browser.proxy` the browser then exits through the IP that already cleared the challenge for this target.
126
+ Typical latency 1-5s. `structuredContent` adds `proxy` (the encoded ID of the proxy that succeeded - pass it to `ignoreProxies` next time if it later goes bad) and `total` (outer timing including selection + retries). For tier-1 WAF challenges (Vercel Security Checkpoint, Cloudflare 'Just a moment', Akamai Bot Manager) use `maxTries: 25-30` - the default 5 is sized for lightly-blocked sites. If still blocked after 30 attempts the gate is likely country / ASN allowlist (not solvable by rotation) - pivot strategy. If the target needs JavaScript render, chain the returned `proxy` ID into `foura_browser.proxy` - the browser then exits through the IP that already cleared the challenge for this target.
108
127
 
109
- ### `foura_browser` full browser session
128
+ ### `foura_browser` - full browser session
110
129
 
111
130
  A real browser session. JavaScript runs, the DOM finishes rendering, cookies come back with the response. Use it when the page is a single-page app, when content lazy-loads after first paint, or when there's an anti-bot challenge that needs a real browser to clear.
112
131
 
@@ -118,33 +137,34 @@ A real browser session. JavaScript runs, the DOM finishes rendering, cookies com
118
137
  }
119
138
  ```
120
139
 
121
- Slowest of the three (210s) but the only tool that handles JavaScript end-to-end. `checkText` is a one-shot post-render validator (substring search on the rendered HTML AFTER navigation completes not a waiter, does not poll): if the substring is missing, the call fails with an error envelope. Useful when a page returns 200 but the actual content is missing.
140
+ Slowest of the lower-level tools (2-10s) but the only tool that handles JavaScript end-to-end. `checkText` is a one-shot post-render validator (substring search on the rendered HTML AFTER navigation completes - not a waiter, does not poll): if the substring is missing, the call fails with an error envelope. Useful when a page returns 200 but the actual content is missing. `unblocker` defaults to `true` - the session actively solves an anti-bot / captcha challenge (Cloudflare Turnstile and similar) it meets along the way; set `unblocker: false` to render and return the page exactly as it loads, challenge page included.
122
141
 
123
142
  `structuredContent` shape is intentionally different from single/proxy: `{status, headers (object, not array), body (not data), cookies (full browser cookie shape), userAgent}`.
124
143
 
125
144
  ## Built-in Prompts
126
145
 
127
- Five workflow templates surfaced under `/prompts` in your MCP client. They orchestrate one or more tools without you spelling out the steps.
146
+ Six workflow templates surfaced under `/prompts` in your MCP client. They orchestrate one or more tools without you spelling out the steps.
128
147
 
129
148
  | Prompt | Arguments | What it does |
130
149
  |---|---|---|
150
+ | `smart_fetch` | `url, must_contain?, extract?` | Auto fetch (picks the method, handles bot protection) → return or extract content |
131
151
  | `scrape_product_page` | `url` | Browser fetch → extract title, price, image, stock, SKU as JSON |
132
152
  | `extract_article` | `url` | Single → fallback to proxy → strip nav/ads → return clean article JSON |
133
153
  | `monitor_pricing` | `url, target_price?` | Proxy fetch → extract price → compare to target |
134
154
  | `check_endpoint_health` | `url, expected_text?` | Single with strict validation → reachable/status/timing report |
135
155
  | `bulk_fetch_urls` | `urls` (comma-separated) | Parallel single → auto-fallback to proxy per URL → metadata only |
136
156
 
137
- Each prompt arrives as a templated user message your LLM executes with the right tools. They cost zero tokens at idle only invoked prompts enter the context window.
157
+ Each prompt arrives as a templated user message your LLM executes with the right tools. They cost zero tokens at idle - only invoked prompts enter the context window.
138
158
 
139
159
  Full recipe text + manual fallback prompts: [foura.ai/docs/mcp/recipes](https://foura.ai/docs/mcp/recipes). For the full error code list, see [foura.ai/docs/mcp/errors](https://foura.ai/docs/mcp/errors).
140
160
 
141
161
  ## Authentication
142
162
 
143
- Your `Bearer` token (or the `FOURA_API_KEY` env var in stdio mode) forwards to the FourA API as `X-API-Key`. One key, all three tools.
163
+ Your `Bearer` token (or the `FOURA_API_KEY` env var in stdio mode) forwards to the FourA API as `X-API-Key`. One key, all four tools.
144
164
 
145
- Keys are managed in the [dashboard](https://foura.ai/dashboard#api-keys) shown once on creation, rotate or deactivate any time. See [foura.ai/docs/getting-started/authentication](https://foura.ai/docs/getting-started/authentication) for the full key-management walkthrough.
165
+ Keys are managed in the [dashboard](https://foura.ai/dashboard#api-keys) - shown once on creation, rotate or deactivate any time. See [foura.ai/docs/getting-started/authentication](https://foura.ai/docs/getting-started/authentication) for the full key-management walkthrough.
146
166
 
147
- ## Error envelope typed contract for agent retries
167
+ ## Error envelope - typed contract for agent retries
148
168
 
149
169
  Every error (`isError: true`) carries a `structuredContent` envelope with at minimum these three fields:
150
170
 
@@ -160,27 +180,27 @@ Where the upstream returned a status, you also get `status` (HTTP code) and on r
160
180
 
161
181
  | `code` | When | Retry safe? |
162
182
  |---|---|---|
163
- | `ssrf_blocked` | Target IP in a private / reserved range (RFC 5735+6598+IPv6 reserved) | No change the URL |
164
- | `upstream_non_json` | Upstream returned malformed body | Maybe investigate |
165
- | `bad_request` (400) | Input shape rejected by FourA | No fix arguments |
166
- | `auth_failed` (401) | Key missing, invalid, or deactivated | No fix the key |
183
+ | `ssrf_blocked` | Target IP in a private / reserved range (RFC 5735+6598+IPv6 reserved) | No - change the URL |
184
+ | `upstream_non_json` | Upstream returned malformed body | Maybe - investigate |
185
+ | `bad_request` (400) | Input shape rejected by FourA | No - fix arguments |
186
+ | `auth_failed` (401) | Key missing, invalid, or deactivated | No - fix the key |
167
187
  | `forbidden` (403) | Authenticated but not allowed | No |
168
188
  | `not_found` (404) | Target / endpoint doesn't exist | No |
169
- | `rate_limited` (429) | RPM cap hit | Yes wait `retryAfter` |
170
- | `at_capacity` (503) | Concurrency cap hit | Yes wait `retryAfter` |
171
- | `service_disabled` (503) | Maintenance window | Yes wait `retryAfter` |
172
- | `service_unavailable` (503) | Generic 503 | Yes short backoff |
173
- | `upstream_error` (≥500) | Upstream 5xx | Yes exponential backoff |
189
+ | `rate_limited` (429) | RPM cap hit | Yes - wait `retryAfter` |
190
+ | `at_capacity` (503) | Concurrency cap hit | Yes - wait `retryAfter` |
191
+ | `service_disabled` (503) | Maintenance window | Yes - wait `retryAfter` |
192
+ | `service_unavailable` (503) | Generic 503 | Yes - short backoff |
193
+ | `upstream_error` (≥500) | Upstream 5xx | Yes - exponential backoff |
174
194
  | `upstream_client_error` (4xx) | Other 4xx | Usually no |
175
195
 
176
196
  LLM agents can read `code` directly for retry logic without parsing prose. Spec reference: [foura.ai/docs/api/errors](https://foura.ai/docs/api/errors).
177
197
 
178
- ## Combining the tools sticky exit IPs
198
+ ## Combining the tools - sticky exit IPs
179
199
 
180
- The three tools compose. `foura_proxy` returns the base36 ID of the exit it used. Pass that ID back into `foura_single.proxy` or `foura_browser.proxy` and the next call exits through the **same IP** same session, same fingerprint, same geo.
200
+ The lower-level tools compose. `foura_proxy` returns the base36 ID of the exit it used. Pass that ID back into `foura_single.proxy` or `foura_browser.proxy` and the next call exits through the **same IP** - same session, same fingerprint, same geo.
181
201
 
182
202
  ```jsonc
183
- // 1. Find a working exit for the target use maxTries:25-30 for tier-1 WAFs
203
+ // 1. Find a working exit for the target - use maxTries:25-30 for tier-1 WAFs
184
204
  const r = await foura_proxy({
185
205
  maxTries: 30,
186
206
  request: { method: "GET", url: "https://probe.example.com", unblocker: true }
@@ -190,17 +210,17 @@ const r = await foura_proxy({
190
210
  // 2. Reuse it for follow-up HTTP (cookies, multi-step flows)
191
211
  await foura_single({ method: "GET", url: "https://target/api", proxy: r.proxy });
192
212
 
193
- // 3. Or render JS through the same egress exits through the IP that already
213
+ // 3. Or render JS through the same egress - exits through the IP that already
194
214
  // cleared the challenge for this target, so the snapshot captures the real
195
215
  // post-challenge content instead of a challenge page.
196
216
  await foura_browser({ url: "https://target/spa", proxy: r.proxy });
197
217
  ```
198
218
 
199
- This chain is the canonical pattern for **tier-1 WAF + JavaScript-rendered targets** (Vercel Security Checkpoint, Cloudflare 'Just a moment', Akamai Bot Manager protecting SPAs). Calling `foura_browser` directly against a WAF target usually captures the challenge page the snapshot fires before the challenge's deferred reload completes. Solve via `foura_proxy` first, then chain.
219
+ This chain is the canonical pattern for **tier-1 WAF + JavaScript-rendered targets** (Vercel Security Checkpoint, Cloudflare 'Just a moment', Akamai Bot Manager protecting SPAs). Calling `foura_browser` directly against a WAF target usually captures the challenge page - the snapshot fires before the challenge's deferred reload completes. Solve via `foura_proxy` first, then chain.
200
220
 
201
221
  To rotate AWAY from a known-bad proxy on the next `foura_proxy` call, pass it as `ignoreProxies: ["4DZ3VE"]`. The `proxy` field on `foura_single` and `foura_browser` also accepts raw URLs (`http://host:port`, `socks5://...`) if you have your own list.
202
222
 
203
- ## Large responses `offload_large` (default: inline)
223
+ ## Large responses - `offload_large` (default: inline)
204
224
 
205
225
  By default (since v0.2.0), full response bodies are returned inline in `structuredContent` regardless of size. This works in every MCP client.
206
226
 
@@ -216,7 +236,7 @@ If your client supports MCP `resources/read` (and you want to save tokens on big
216
236
 
217
237
  | Client | `offload_large: true` |
218
238
  |---|---|
219
- | Claude Desktop | not yet leave default `false` |
239
+ | Claude Desktop | not yet - leave default `false` |
220
240
  | Claude Code, Cursor, Windsurf | supported |
221
241
  | VS Code MCP extension | supported |
222
242
 
@@ -231,7 +251,7 @@ Tenant-isolated: only the API key that stored a payload can read it back.
231
251
 
232
252
  ## Self-Hosting
233
253
 
234
- The MCP server runs in one container, statelessly each request brings its own key, so there's no session state, no sticky load balancing, nothing to coordinate. Scale horizontally behind any load balancer.
254
+ The MCP server runs in one container, statelessly - each request brings its own key, so there's no session state, no sticky load balancing, nothing to coordinate. Scale horizontally behind any load balancer.
235
255
 
236
256
  Configurable environment:
237
257
 
package/dist/http.js CHANGED
@@ -4,7 +4,7 @@ import { SUPPORTED_PROTOCOL_VERSIONS } from "@modelcontextprotocol/sdk/types.js"
4
4
  import { createServer } from "./server.js";
5
5
  import { withApiKey } from "./auth.js";
6
6
  const PORT = Number(process.env.PORT ?? 3076);
7
- const SERVER_VERSION = "0.2.11";
7
+ const SERVER_VERSION = "0.3.1";
8
8
  // Spec MUSTs covered in this file:
9
9
  // audit 1.1 — Origin + Host validation (CVE-2025-66414 DNS rebinding)
10
10
  // audit 1.2 — WWW-Authenticate on 401
package/dist/http.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"http.js","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA,OAAO,OAA2D,MAAM,SAAS,CAAC;AAClF,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AACnG,OAAO,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AACjF,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,GAA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Ae,CAAC,CAAC;IAC7D,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;QACnB,IAAI,GAAG,EAAE,CAAC;YACR,OAAO,CAAC,KAAK,CAAC,oCAAoC,EAAE,GAAG,CAAC,CAAC;YACzD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;IACH,UAAU,CAAC,GAAG,EAAE;QACd,OAAO,CAAC,KAAK,CAAC,0DAA0D,CAAC,CAAC;QAC1E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,EAAE,MAAM,CAAC,CAAC,KAAK,EAAE,CAAC;AACrB,CAAC;AACD,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC;AACjD,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC"}
package/dist/prompts.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
2
  /**
3
- * MCP Prompts pre-written workflow templates the user can invoke from the
3
+ * MCP Prompts - pre-written workflow templates the user can invoke from the
4
4
  * MCP client UI (Claude Desktop / Cursor / etc) instead of figuring out the
5
5
  * tool orchestration themselves.
6
6
  *
7
- * Prompts are LAZY context they only enter the LLM's window when invoked,
7
+ * Prompts are LAZY context - they only enter the LLM's window when invoked,
8
8
  * unlike tool descriptions which are loaded on every turn. So we can be more
9
9
  * verbose here.
10
10
  */
package/dist/prompts.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import { z } from "zod";
2
2
  /**
3
- * MCP Prompts pre-written workflow templates the user can invoke from the
3
+ * MCP Prompts - pre-written workflow templates the user can invoke from the
4
4
  * MCP client UI (Claude Desktop / Cursor / etc) instead of figuring out the
5
5
  * tool orchestration themselves.
6
6
  *
7
- * Prompts are LAZY context they only enter the LLM's window when invoked,
7
+ * Prompts are LAZY context - they only enter the LLM's window when invoked,
8
8
  * unlike tool descriptions which are loaded on every turn. So we can be more
9
9
  * verbose here.
10
10
  */
@@ -21,7 +21,7 @@ export function registerPrompts(server) {
21
21
  role: "user",
22
22
  content: {
23
23
  type: "text",
24
- text: `Fetch the product page at ${url} using the foura_browser tool most product pages are single-page apps and need JavaScript to render.\n\n` +
24
+ text: `Fetch the product page at ${url} using the foura_browser tool - most product pages are single-page apps and need JavaScript to render.\n\n` +
25
25
  `From the response body extract:\n` +
26
26
  `- product title\n` +
27
27
  `- price (with currency)\n` +
@@ -48,7 +48,7 @@ export function registerPrompts(server) {
48
48
  content: {
49
49
  type: "text",
50
50
  text: `Fetch ${url} using the foura_single tool with unblocker:true. Most news and blog sites are server-rendered, so HTTP is fastest (200ms-2s).\n\n` +
51
- `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.\n\n` +
51
+ `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.\n\n` +
52
52
  `From the response, extract:\n` +
53
53
  `- headline (the main H1, not the page title bar)\n` +
54
54
  `- author byline (may be inside .author / [rel=author] / itemprop)\n` +
@@ -137,10 +137,42 @@ export function registerPrompts(server) {
137
137
  type: "text",
138
138
  text: `Parse the following comma-separated URLs and fetch each one concurrently using foura_single (unblocker:true).\n\n` +
139
139
  `URLs: ${urls}\n\n` +
140
- `For any URL that returns 403, captcha page, or empty body retry that single URL with foura_proxy (maxTries:3).\n\n` +
140
+ `For any URL that returns 403, captcha page, or empty body - retry that single URL with foura_proxy (maxTries:3).\n\n` +
141
141
  `Return a JSON array, one entry per URL in input order:\n` +
142
142
  `[{"url": "...", "status": 200, "success": true, "body_size_bytes": 0, "via": "single|proxy", "error": null}, ...]\n\n` +
143
- `Do NOT inline full response bodies in the output only metadata. If the caller needs body content, they should call foura_single individually.`,
143
+ `Do NOT inline full response bodies in the output - only metadata. If the caller needs body content, they should call foura_single individually.`,
144
+ },
145
+ },
146
+ ],
147
+ }));
148
+ server.registerPrompt("smart_fetch", {
149
+ title: "Fetch a URL the smart way (auto)",
150
+ description: "Fetch any URL with foura_auto - one call that picks the method (direct / proxy / browser), gets past common bot protection, and returns the content. Use when you just want the page and don't want to choose a tool.",
151
+ argsSchema: {
152
+ url: z.string().describe("URL to fetch"),
153
+ must_contain: z
154
+ .string()
155
+ .optional()
156
+ .describe("Optional substring the real page must contain - lets auto tell a real page from a challenge page on protected targets."),
157
+ extract: z
158
+ .string()
159
+ .optional()
160
+ .describe("Optional plain-English description of what to pull out of the page (e.g. \"title, price, image\")."),
161
+ },
162
+ }, ({ url, must_contain, extract }) => ({
163
+ messages: [
164
+ {
165
+ role: "user",
166
+ content: {
167
+ type: "text",
168
+ text: `Fetch ${url} using the foura_auto tool. It picks the fetch method for you (direct request, rotating proxy, or full browser) and gets past common bot protection automatically - you do not need to choose between foura_single / foura_proxy / foura_browser.\n\n` +
169
+ (must_contain
170
+ ? `Pass validate.data.accept:["${must_contain}"] so auto keeps escalating until the real page (containing "${must_contain}") comes back, not a challenge page.\n\n`
171
+ : `If the first response looks like a challenge / block page rather than real content, re-call with validate.data.accept:["<a string the real page must contain>"] so auto knows what success looks like.\n\n`) +
172
+ `The response includes a meta trace (which rung delivered, credits spent) and a session ({proxy, cookies, userAgent}). If you need more pages from the same site afterwards, you can replay that session through foura_single / foura_proxy by passing session.proxy into their proxy field.\n\n` +
173
+ (extract
174
+ ? `From the returned content, extract: ${extract}. Return the result as JSON.`
175
+ : `Return the fetched content (or a concise summary of it, if it is large).`),
144
176
  },
145
177
  },
146
178
  ],
@@ -1 +1 @@
1
- {"version":3,"file":"prompts.js","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAA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ACJ,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
2
  /**
3
- * Resources offload large response bodies (>= THRESHOLD bytes) onto host
3
+ * Resources - offload large response bodies (>= THRESHOLD bytes) onto host
4
4
  * disk and return a MCP resource_link instead of inlining megabytes into the
5
5
  * LLM context.
6
6
  *
@@ -9,10 +9,10 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
9
9
  * which response field is the "large payload" (single/proxy use `data`,
10
10
  * browser uses `body`).
11
11
  *
12
- * Audit 1.5 tenant isolation. Payloads are stored under
12
+ * Audit 1.5 - tenant isolation. Payloads are stored under
13
13
  * `<PAYLOADS_DIR>/<keyhash>/<uuid>.{bin,meta.json}`, where `keyhash` is the
14
14
  * first 16 hex chars of sha256(apiKey). The resource handler validates the
15
- * caller's keyhash matches the storage path before serving any other
15
+ * caller's keyhash matches the storage path before serving - any other
16
16
  * tenant gets a `resource not found` (no leaking whether the UUID exists).
17
17
  */
18
18
  export declare const THRESHOLD_BYTES = 50000;
package/dist/resources.js CHANGED
@@ -5,7 +5,7 @@ import { tmpdir } from "node:os";
5
5
  import { ResourceTemplate, } from "@modelcontextprotocol/sdk/server/mcp.js";
6
6
  import { getApiKey } from "./auth.js";
7
7
  /**
8
- * Resources offload large response bodies (>= THRESHOLD bytes) onto host
8
+ * Resources - offload large response bodies (>= THRESHOLD bytes) onto host
9
9
  * disk and return a MCP resource_link instead of inlining megabytes into the
10
10
  * LLM context.
11
11
  *
@@ -14,16 +14,16 @@ import { getApiKey } from "./auth.js";
14
14
  * which response field is the "large payload" (single/proxy use `data`,
15
15
  * browser uses `body`).
16
16
  *
17
- * Audit 1.5 tenant isolation. Payloads are stored under
17
+ * Audit 1.5 - tenant isolation. Payloads are stored under
18
18
  * `<PAYLOADS_DIR>/<keyhash>/<uuid>.{bin,meta.json}`, where `keyhash` is the
19
19
  * first 16 hex chars of sha256(apiKey). The resource handler validates the
20
- * caller's keyhash matches the storage path before serving any other
20
+ * caller's keyhash matches the storage path before serving - any other
21
21
  * tenant gets a `resource not found` (no leaking whether the UUID exists).
22
22
  */
23
23
  export const THRESHOLD_BYTES = 50_000;
24
24
  export const PAYLOADS_DIR = process.env.FOURA_MCP_PAYLOADS_DIR ?? path.join(tmpdir(), "foura-mcp-payloads");
25
25
  const URI_PREFIX = "foura-mcp://payload/";
26
- // sha256(apiKey).hex().slice(0, 16) gives 64 bits of namespacing entropy,
26
+ // sha256(apiKey).hex().slice(0, 16) - gives 64 bits of namespacing entropy,
27
27
  // short enough for a filesystem path component and unguessable for an
28
28
  // attacker who doesn't have the corresponding API key.
29
29
  export function hashApiKey(apiKey) {
@@ -100,7 +100,7 @@ export function registerResourceHandler(server) {
100
100
  throw new Error(`Payload not found: ${uuidStr}`);
101
101
  }
102
102
  const meta = JSON.parse(metaRaw);
103
- // Defense in depth even if filesystem permissions ever got bypassed,
103
+ // Defense in depth - even if filesystem permissions ever got bypassed,
104
104
  // the meta sidecar carries the keyhash; reject on mismatch.
105
105
  if (meta.keyhash !== keyhash) {
106
106
  throw new Error(`Payload not found: ${uuidStr}`);
package/dist/server.js CHANGED
@@ -2,16 +2,20 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
2
  import { registerSingleTool } from "./tools/single.js";
3
3
  import { registerProxyTool } from "./tools/proxy.js";
4
4
  import { registerBrowserTool } from "./tools/browser.js";
5
+ import { registerAutoTool } from "./tools/auto.js";
5
6
  import { registerResourceHandler } from "./resources.js";
6
7
  import { registerPrompts } from "./prompts.js";
7
8
  export function createServer() {
8
9
  const server = new McpServer({
9
10
  name: "foura-mcp",
10
- version: "0.2.11",
11
+ version: "0.3.1",
11
12
  });
12
13
  registerSingleTool(server);
13
14
  registerProxyTool(server);
14
15
  registerBrowserTool(server);
16
+ // foura_auto is the smart default (URL in → content out); registered after the
17
+ // three primitives it orchestrates so the primitives keep their tools/list order.
18
+ registerAutoTool(server);
15
19
  registerResourceHandler(server);
16
20
  registerPrompts(server);
17
21
  return server;
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,MAAM,UAAU,YAAY;IAC1B,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;QAC3B,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,QAAQ;KAClB,CAAC,CAAC;IAEH,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC3B,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAC1B,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAC5B,uBAAuB,CAAC,MAAM,CAAC,CAAC;IAChC,eAAe,CAAC,MAAM,CAAC,CAAC;IAExB,OAAO,MAAM,CAAC;AAChB,CAAC"}
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,MAAM,UAAU,YAAY;IAC1B,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;QAC3B,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,OAAO;KACjB,CAAC,CAAC;IAEH,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC3B,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAC1B,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAC5B,+EAA+E;IAC/E,kFAAkF;IAClF,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACzB,uBAAuB,CAAC,MAAM,CAAC,CAAC;IAChC,eAAe,CAAC,MAAM,CAAC,CAAC;IAExB,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,101 @@
1
+ import { z } from "zod";
2
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
+ declare function deriveCode(status: number, envelope: Record<string, unknown>): string;
4
+ declare function guardHandler(service: "auto", outputSchema: z.ZodObject<any>, fn: () => Promise<any>): Promise<any>;
5
+ export declare function registerAutoTool(server: McpServer): void;
6
+ export declare const __test: {
7
+ deriveCode: typeof deriveCode;
8
+ HeaderInfoSchema: z.ZodObject<{
9
+ result: z.ZodOptional<z.ZodObject<{
10
+ version: z.ZodOptional<z.ZodString>;
11
+ code: z.ZodOptional<z.ZodNumber>;
12
+ reason: z.ZodOptional<z.ZodString>;
13
+ }, z.core.$strip>>;
14
+ }, z.core.$catchall<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>>;
15
+ AutoValidateSchema: z.ZodOptional<z.ZodObject<{
16
+ status: z.ZodOptional<z.ZodObject<{
17
+ accept: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
18
+ fail: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
19
+ }, z.core.$strip>>;
20
+ headers: z.ZodOptional<z.ZodObject<{
21
+ accept: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
22
+ fail: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
23
+ }, z.core.$strip>>;
24
+ data: z.ZodOptional<z.ZodObject<{
25
+ accept: z.ZodOptional<z.ZodArray<z.ZodString>>;
26
+ fail: z.ZodOptional<z.ZodArray<z.ZodString>>;
27
+ }, z.core.$strip>>;
28
+ }, z.core.$strip>>;
29
+ autoInputShape: {
30
+ url: z.ZodString;
31
+ method: z.ZodOptional<z.ZodString>;
32
+ headers: z.ZodOptional<z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodString], null>>>;
33
+ data: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
34
+ validate: z.ZodOptional<z.ZodObject<{
35
+ status: z.ZodOptional<z.ZodObject<{
36
+ accept: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
37
+ fail: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
38
+ }, z.core.$strip>>;
39
+ headers: z.ZodOptional<z.ZodObject<{
40
+ accept: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
41
+ fail: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
42
+ }, z.core.$strip>>;
43
+ data: z.ZodOptional<z.ZodObject<{
44
+ accept: z.ZodOptional<z.ZodArray<z.ZodString>>;
45
+ fail: z.ZodOptional<z.ZodArray<z.ZodString>>;
46
+ }, z.core.$strip>>;
47
+ }, z.core.$strip>>;
48
+ returnSession: z.ZodOptional<z.ZodBoolean>;
49
+ forceProxy: z.ZodOptional<z.ZodBoolean>;
50
+ timeout_ms: z.ZodOptional<z.ZodNumber>;
51
+ ignoreProxies: z.ZodOptional<z.ZodArray<z.ZodString>>;
52
+ followRedirects: z.ZodOptional<z.ZodNumber>;
53
+ offload_large: z.ZodOptional<z.ZodBoolean>;
54
+ };
55
+ autoOutputShape: {
56
+ status: z.ZodOptional<z.ZodNumber>;
57
+ headers: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodObject<{
58
+ result: z.ZodOptional<z.ZodObject<{
59
+ version: z.ZodOptional<z.ZodString>;
60
+ code: z.ZodOptional<z.ZodNumber>;
61
+ reason: z.ZodOptional<z.ZodString>;
62
+ }, z.core.$strip>>;
63
+ }, z.core.$catchall<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>>>, z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
64
+ data: z.ZodOptional<z.ZodUnknown>;
65
+ meta: z.ZodOptional<z.ZodObject<{
66
+ rung: z.ZodOptional<z.ZodString>;
67
+ solved: z.ZodOptional<z.ZodBoolean>;
68
+ attempts: z.ZodOptional<z.ZodNumber>;
69
+ credits: z.ZodOptional<z.ZodNumber>;
70
+ }, z.core.$catchall<z.ZodUnknown>>>;
71
+ session: z.ZodOptional<z.ZodObject<{
72
+ proxy: z.ZodOptional<z.ZodString>;
73
+ cookies: z.ZodOptional<z.ZodUnknown>;
74
+ userAgent: z.ZodOptional<z.ZodString>;
75
+ }, z.core.$catchall<z.ZodUnknown>>>;
76
+ offloaded_resource_uri: z.ZodOptional<z.ZodString>;
77
+ size_bytes: z.ZodOptional<z.ZodNumber>;
78
+ error: z.ZodOptional<z.ZodString>;
79
+ attempts: z.ZodOptional<z.ZodNumber>;
80
+ service: z.ZodOptional<z.ZodEnum<{
81
+ single: "single";
82
+ proxy: "proxy";
83
+ browser: "browser";
84
+ api: "api";
85
+ auto: "auto";
86
+ }>>;
87
+ retryAfter: z.ZodOptional<z.ZodNumber>;
88
+ current: z.ZodOptional<z.ZodObject<{
89
+ concurrency: z.ZodOptional<z.ZodNumber>;
90
+ rpm: z.ZodOptional<z.ZodNumber>;
91
+ }, z.core.$strip>>;
92
+ limits: z.ZodOptional<z.ZodObject<{
93
+ maxConcurrency: z.ZodOptional<z.ZodNumber>;
94
+ maxRpm: z.ZodOptional<z.ZodNumber>;
95
+ }, z.core.$strip>>;
96
+ code: z.ZodOptional<z.ZodString>;
97
+ };
98
+ guardHandler: typeof guardHandler;
99
+ AUTO_API_URL: string;
100
+ };
101
+ export {};