@scavio/mcp-server 0.20.0 → 0.21.0
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 +48 -12
- package/dist/lib/client.d.ts +2 -1
- package/dist/lib/client.js +11 -4
- package/dist/lib/client.js.map +1 -1
- package/dist/lib/errors.d.ts +5 -1
- package/dist/lib/errors.js +5 -1
- package/dist/lib/errors.js.map +1 -1
- package/dist/lib/tool-error.js +10 -2
- package/dist/lib/tool-error.js.map +1 -1
- package/dist/lib/web-jobs.d.ts +35 -0
- package/dist/lib/web-jobs.js +75 -0
- package/dist/lib/web-jobs.js.map +1 -0
- package/dist/tools/extract.js +192 -1
- package/dist/tools/extract.js.map +1 -1
- package/dist/tools/index.d.ts +6 -5
- package/dist/tools/index.js +19 -7
- package/dist/tools/index.js.map +1 -1
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|

|
|
4
4
|

|
|
5
5
|
|
|
6
|
-
[Scavio](https://scavio.dev?utm_source=npm-mcp&utm_medium=package&utm_campaign=readme) is a unified [Web Search API](https://scavio.dev/docs/search-api?utm_source=npm-mcp&utm_medium=package&utm_campaign=readme) and MCP server that gives AI agents web search, page extraction, and structured data from e-commerce, social, travel, jobs, real-estate, app-store, ad-library and company-filing sources.
|
|
6
|
+
[Scavio](https://scavio.dev?utm_source=npm-mcp&utm_medium=package&utm_campaign=readme) is a unified [Web Search API](https://scavio.dev/docs/search-api?utm_source=npm-mcp&utm_medium=package&utm_campaign=readme) and MCP server that gives AI agents web search, page extraction, and structured data from e-commerce, social, travel, jobs, real-estate, app-store, ad-library and company-filing sources. 255 tools across 36 platforms plus Extract, map, crawl and batch, one API key.
|
|
7
7
|
|
|
8
|
-
**The 22 platforms added in 0.13.0 are opt-in.** Registering all
|
|
8
|
+
**The 22 platforms added in 0.13.0 are opt-in.** Registering all 255 tools puts 243KB of tool definitions — roughly 61k tokens — into every session before you type anything. So the default is the platform set 0.12.x already had, plus Extract: 133 tools, 105KB. Upgrading never removes a tool you were using. Everything else is one env var away: see [Choosing which tools load](#choosing-which-tools-load).
|
|
9
9
|
|
|
10
10
|
## Remote MCP Server
|
|
11
11
|
|
|
@@ -207,8 +207,8 @@ Add to settings (`Cmd+,`):
|
|
|
207
207
|
|
|
208
208
|
## Choosing which tools load
|
|
209
209
|
|
|
210
|
-
Scavio exposes
|
|
211
|
-
roughly
|
|
210
|
+
Scavio exposes 255 tools. Loading all of them costs 243KB of `tools/list` —
|
|
211
|
+
roughly 61k tokens of context in every session before the user has said anything,
|
|
212
212
|
and more tools than some clients will accept at all. So the server registers a
|
|
213
213
|
curated subset by default and lets you pick the rest. The sizes below are
|
|
214
214
|
measured, not estimated: `npm run toolslist` reproduces them.
|
|
@@ -217,10 +217,10 @@ measured, not estimated: `npm run toolslist` reproduces them.
|
|
|
217
217
|
|
|
218
218
|
| Value | Registers |
|
|
219
219
|
|-------|-----------|
|
|
220
|
-
| *(unset)* or `default` | Every platform 0.12.x had, plus `extract` — **
|
|
221
|
-
| `all` | every platform — **
|
|
222
|
-
| `extract,sec,g2` | just those platforms —
|
|
223
|
-
| `default,zillow,metaads` | the default set plus two more —
|
|
220
|
+
| *(unset)* or `default` | Every platform 0.12.x had, plus `extract` — **133 tools, 105KB** |
|
|
221
|
+
| `all` | every platform — **255 tools, 243KB** |
|
|
222
|
+
| `extract,sec,g2` | just those platforms — 18 tools, 21KB |
|
|
223
|
+
| `default,zillow,metaads` | the default set plus two more — 139 tools, 113KB |
|
|
224
224
|
| `none` | no platform tools, only `get_usage` |
|
|
225
225
|
|
|
226
226
|
Keys are matched case- and punctuation-insensitively, so `meta-ads`, `metaads`
|
|
@@ -279,8 +279,8 @@ https://mcp.scavio.dev/mcp?platforms=all
|
|
|
279
279
|
|
|
280
280
|
Nothing to do. The default set is exactly the 10 platforms 0.12.x registered,
|
|
281
281
|
plus Extract — every tool you were using still loads. Those platforms keep gaining
|
|
282
|
-
tools (Walmart grew from 2 to 7; TikTok, YouTube, Reddit and X gained 19 in 0.20.0
|
|
283
|
-
which is why the default count is now
|
|
282
|
+
tools (Walmart grew from 2 to 7; TikTok, YouTube, Reddit and X gained 19 in 0.20.0;
|
|
283
|
+
Extract gained map, crawl and batch in 0.21.0), which is why the default count is now 133.
|
|
284
284
|
|
|
285
285
|
The 22 platforms added in 0.13.0 are opt-in. Add them additively:
|
|
286
286
|
|
|
@@ -306,14 +306,50 @@ are free.
|
|
|
306
306
|
| Tool | Description |
|
|
307
307
|
|------|-------------|
|
|
308
308
|
| `extract_url` | Read any web page and return it as clean Markdown, plain text, or raw HTML |
|
|
309
|
+
| `map_website` | List a site's page URLs from its sitemaps and start page, path-filtered, with `lastmod` when known |
|
|
310
|
+
| `crawl_website` | Crawl a site from one URL and extract every same-site page; waits up to `wait_seconds` and returns results, or the job id |
|
|
311
|
+
| `get_crawl_status` | A crawl's status, page counts, credits used and page results, paged by cursor; can wait for completion |
|
|
312
|
+
| `cancel_crawl` | Stop a running crawl; nothing more is billed, results so far stay readable |
|
|
313
|
+
| `batch_extract` | Extract a list of URLs in one job, results in input order; waits up to `wait_seconds` |
|
|
314
|
+
| `get_batch_status` | A batch's status and results, paged by cursor; can wait for completion |
|
|
315
|
+
| `cancel_batch` | Stop a running batch |
|
|
309
316
|
|
|
310
317
|
Extract is tier-priced by the `mode` parameter, not flat: `normal` (the default)
|
|
311
|
-
and `advanced` (
|
|
312
|
-
|
|
318
|
+
and `advanced` (renders JavaScript) cost 1 credit, `ultra` (for the hardest pages)
|
|
319
|
+
costs 2. Start at `normal` and escalate only when the
|
|
313
320
|
content comes back empty or blocked. You are billed only on a successful
|
|
314
321
|
extraction — a dead link, a bot wall or a timeout costs nothing. There is no
|
|
315
322
|
pagination: the whole page comes back in one call.
|
|
316
323
|
|
|
324
|
+
**Map, crawl and batch** (new in 0.21.0) are the multi-page operations:
|
|
325
|
+
|
|
326
|
+
- **Pricing.** `map_website` costs 1 credit. Crawl and batch bill per
|
|
327
|
+
*successful* page at Extract's price for the tier (normal 1, advanced 1,
|
|
328
|
+
ultra 2); failed and skipped pages are free, and status and cancel calls are
|
|
329
|
+
free. Credits are taken page by page, and a job stops cleanly with
|
|
330
|
+
`stopped_reason: "insufficient_credits"` if the balance runs out.
|
|
331
|
+
- **Plan limits** (max pages per crawl / active jobs / URLs per batch): Free
|
|
332
|
+
10 / 1 / 10, PAYG 100 / 1 / 50, Project 500 / 2 / 100, Bootstrap 2,000 / 3 / 500,
|
|
333
|
+
Startup 5,000 / 5 / 1,000, Growth 10,000 / 10 / 1,000. Starting a job past the
|
|
334
|
+
active-job limit returns a 429 that names the running jobs.
|
|
335
|
+
- **Behaviour.** Robots.txt is always obeyed for map and crawl. A crawl stays on
|
|
336
|
+
the start URL's site (subdomains optional) and visits pages under the start
|
|
337
|
+
path first. Results are kept for 3 days; a job runs for at most 6 hours.
|
|
338
|
+
- **Built for tool-call time limits.** MCP clients usually cancel a tool call
|
|
339
|
+
after about 60 seconds, so a crawl is a job, not one long call.
|
|
340
|
+
`crawl_website` / `batch_extract` start the job and wait up to `wait_seconds`
|
|
341
|
+
(default 30, max 50): a small job comes back finished with its first page of
|
|
342
|
+
results; a large one returns the job id (and `webhook_secret`, shown only
|
|
343
|
+
once, if you set `webhook_url`). `get_crawl_status` / `get_batch_status` take
|
|
344
|
+
the same `wait_seconds` to long-poll, and `cursor` to page.
|
|
345
|
+
- **Output stays small.** Status calls return 10 results per call by default
|
|
346
|
+
(`limit` up to 100) and clip each page's content to `max_content_chars`
|
|
347
|
+
(default 4,000); clipped pages carry `content_clipped: true` next to the full
|
|
348
|
+
`content_length`. `map_website` asks for 200 links when you set no `limit`
|
|
349
|
+
(the API default is 1,000). Every response that has more to read carries a
|
|
350
|
+
`_hint` naming the exact next call. Repeat a start call with the same
|
|
351
|
+
`idempotency_key` and you get the original job back instead of a second one.
|
|
352
|
+
|
|
317
353
|
### [Google Search API](https://scavio.dev/docs/search-api?utm_source=npm-mcp&utm_medium=package&utm_campaign=readme)
|
|
318
354
|
|
|
319
355
|
| Tool | Description |
|
package/dist/lib/client.d.ts
CHANGED
|
@@ -10,5 +10,6 @@ export declare class ScavioClient {
|
|
|
10
10
|
constructor(apiKey: string);
|
|
11
11
|
private request;
|
|
12
12
|
get<T>(path: string): Promise<T>;
|
|
13
|
-
post<T>(path: string, body?: unknown): Promise<T>;
|
|
13
|
+
post<T>(path: string, body?: unknown, headers?: Record<string, string>): Promise<T>;
|
|
14
|
+
delete<T>(path: string): Promise<T>;
|
|
14
15
|
}
|
package/dist/lib/client.js
CHANGED
|
@@ -14,7 +14,7 @@ export class ScavioClient {
|
|
|
14
14
|
this.baseUrl = env.SCAVIO_API_BASE_URL;
|
|
15
15
|
this.apiKey = apiKey;
|
|
16
16
|
}
|
|
17
|
-
async request(method, path, body) {
|
|
17
|
+
async request(method, path, body, extraHeaders) {
|
|
18
18
|
const response = await fetch(`${this.baseUrl}${path}`, {
|
|
19
19
|
method,
|
|
20
20
|
headers: {
|
|
@@ -22,6 +22,7 @@ export class ScavioClient {
|
|
|
22
22
|
"Authorization": `Bearer ${this.apiKey}`,
|
|
23
23
|
"User-Agent": USER_AGENT,
|
|
24
24
|
"X-Client-Source": CLIENT_SOURCE,
|
|
25
|
+
...extraHeaders,
|
|
25
26
|
},
|
|
26
27
|
...(body !== undefined ? { body: JSON.stringify(body) } : {}),
|
|
27
28
|
});
|
|
@@ -29,24 +30,30 @@ export class ScavioClient {
|
|
|
29
30
|
const text = await response.text();
|
|
30
31
|
let message;
|
|
31
32
|
let billingUrl;
|
|
33
|
+
let body;
|
|
32
34
|
try {
|
|
33
35
|
const json = JSON.parse(text);
|
|
34
36
|
message = json.error ?? json.message ?? text;
|
|
35
37
|
if (typeof json.billing_url === "string")
|
|
36
38
|
billingUrl = json.billing_url;
|
|
39
|
+
if (json && typeof json === "object" && !Array.isArray(json))
|
|
40
|
+
body = json;
|
|
37
41
|
}
|
|
38
42
|
catch {
|
|
39
43
|
message = text;
|
|
40
44
|
}
|
|
41
|
-
throw new ApiError(response.status, message, undefined, billingUrl);
|
|
45
|
+
throw new ApiError(response.status, message, undefined, billingUrl, body);
|
|
42
46
|
}
|
|
43
47
|
return response.json();
|
|
44
48
|
}
|
|
45
49
|
async get(path) {
|
|
46
50
|
return this.request("GET", path);
|
|
47
51
|
}
|
|
48
|
-
async post(path, body) {
|
|
49
|
-
return this.request("POST", path, body);
|
|
52
|
+
async post(path, body, headers) {
|
|
53
|
+
return this.request("POST", path, body, headers);
|
|
54
|
+
}
|
|
55
|
+
async delete(path) {
|
|
56
|
+
return this.request("DELETE", path);
|
|
50
57
|
}
|
|
51
58
|
}
|
|
52
59
|
//# sourceMappingURL=client.js.map
|
package/dist/lib/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/lib/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,CAAC,MAAM,UAAU,GAAG,cAAc,cAAc,EAAE,CAAC;AAEzD;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,CAAC,SAAS,KAAK,MAAM,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,YAAY,CAAC;AAE3F,MAAM,OAAO,YAAY;IACf,OAAO,CAAS;IAChB,MAAM,CAAS;IAEvB,YAAY,MAAc;QACxB,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC,mBAAmB,CAAC;QACvC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAEO,KAAK,CAAC,OAAO,CAAI,MAAc,EAAE,IAAY,EAAE,IAAc;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/lib/client.ts"],"names":[],"mappings":"AAAA,OAA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AI,CAAC;gBACH,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;gBAC9B,OAAO,GAAG,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC;gBAC7C,IAAI,OAAO,IAAI,CAAC,WAAW,KAAK,QAAQ;oBAAE,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC;gBACxE,IAAI,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;oBAAE,IAAI,GAAG,IAAI,CAAC;YAC5E,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,GAAG,IAAI,CAAC;YACjB,CAAC;YACD,MAAM,IAAI,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;QAC5E,CAAC;QAED,OAAO,QAAQ,CAAC,IAAI,EAAgB,CAAC;IACvC,CAAC;IAED,KAAK,CAAC,GAAG,CAAI,IAAY;QACvB,OAAO,IAAI,CAAC,OAAO,CAAI,KAAK,EAAE,IAAI,CAAC,CAAC;IACtC,CAAC;IAED,KAAK,CAAC,IAAI,CAAI,IAAY,EAAE,IAAc,EAAE,OAAgC;QAC1E,OAAO,IAAI,CAAC,OAAO,CAAI,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,MAAM,CAAI,IAAY;QAC1B,OAAO,IAAI,CAAC,OAAO,CAAI,QAAQ,EAAE,IAAI,CAAC,CAAC;IACzC,CAAC;CACF"}
|
package/dist/lib/errors.d.ts
CHANGED
|
@@ -3,7 +3,11 @@ export declare class ApiError extends Error {
|
|
|
3
3
|
readonly code?: string | undefined;
|
|
4
4
|
/** Where to top up, when the API sent one (402 responses do). */
|
|
5
5
|
readonly billingUrl?: string | undefined;
|
|
6
|
+
/** The parsed JSON error body, when there was one. */
|
|
7
|
+
readonly body?: Record<string, unknown> | undefined;
|
|
6
8
|
constructor(status: number, message: string, code?: string | undefined,
|
|
7
9
|
/** Where to top up, when the API sent one (402 responses do). */
|
|
8
|
-
billingUrl?: string | undefined
|
|
10
|
+
billingUrl?: string | undefined,
|
|
11
|
+
/** The parsed JSON error body, when there was one. */
|
|
12
|
+
body?: Record<string, unknown> | undefined);
|
|
9
13
|
}
|
package/dist/lib/errors.js
CHANGED
|
@@ -2,13 +2,17 @@ export class ApiError extends Error {
|
|
|
2
2
|
status;
|
|
3
3
|
code;
|
|
4
4
|
billingUrl;
|
|
5
|
+
body;
|
|
5
6
|
constructor(status, message, code,
|
|
6
7
|
/** Where to top up, when the API sent one (402 responses do). */
|
|
7
|
-
billingUrl
|
|
8
|
+
billingUrl,
|
|
9
|
+
/** The parsed JSON error body, when there was one. */
|
|
10
|
+
body) {
|
|
8
11
|
super(message);
|
|
9
12
|
this.status = status;
|
|
10
13
|
this.code = code;
|
|
11
14
|
this.billingUrl = billingUrl;
|
|
15
|
+
this.body = body;
|
|
12
16
|
this.name = "ApiError";
|
|
13
17
|
}
|
|
14
18
|
}
|
package/dist/lib/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/lib/errors.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,QAAS,SAAQ,KAAK;IAEf;IAEA;IAEA;
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/lib/errors.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,QAAS,SAAQ,KAAK;IAEf;IAEA;IAEA;IAEA;IAPlB,YACkB,MAAc,EAC9B,OAAe,EACC,IAAa;IAC7B,iEAAiE;IACjD,UAAmB;IACnC,sDAAsD;IACtC,IAA8B;QAE9C,KAAK,CAAC,OAAO,CAAC,CAAC;QARC,WAAM,GAAN,MAAM,CAAQ;QAEd,SAAI,GAAJ,IAAI,CAAS;QAEb,eAAU,GAAV,UAAU,CAAS;QAEnB,SAAI,GAAJ,IAAI,CAA0B;QAG9C,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;IACzB,CAAC;CACF"}
|
package/dist/lib/tool-error.js
CHANGED
|
@@ -17,8 +17,16 @@ import { ApiError } from "./errors.js";
|
|
|
17
17
|
*/
|
|
18
18
|
export function handleApiError(err) {
|
|
19
19
|
if (err instanceof ApiError) {
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
// The API's 429 message says which limit was hit (per-plan concurrency, or
|
|
21
|
+
// the active crawl/batch job cap, which names the running jobs to wait on).
|
|
22
|
+
if (err.status === 429) {
|
|
23
|
+
const b = err.body ?? {};
|
|
24
|
+
const parts = [err.message, typeof b.message === "string" ? b.message : ""].filter((p) => p && p !== "Too Many Requests");
|
|
25
|
+
if (Array.isArray(b.running_jobs) && b.running_jobs.length)
|
|
26
|
+
parts.push(`Running jobs: ${b.running_jobs.join(", ")}`);
|
|
27
|
+
const detail = parts.map((p) => ` ${/[.!?]$/.test(p) ? p : `${p}.`}`).join("");
|
|
28
|
+
return { isError: true, content: [{ type: "text", text: `Rate limited (429).${detail} Wait and retry.` }] };
|
|
29
|
+
}
|
|
22
30
|
// The API's 402 body carries billing_url; the bare "Insufficient credits"
|
|
23
31
|
// string used to be all the model saw, so it could not tell the user where
|
|
24
32
|
// to go. Surface the link, and say that nothing needs reconfiguring.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-error.js","sourceRoot":"","sources":["../../src/lib/tool-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,cAAc,CAAC,GAAY;IACzC,IAAI,GAAG,YAAY,QAAQ,EAAE,CAAC;QAC5B,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG;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AE,sBAAsB,MAAM,kBAAkB,EAAE,CAAC,EAAE,CAAC;QAC9G,CAAC;QACD,0EAA0E;QAC1E,2EAA2E;QAC3E,qEAAqE;QACrE,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;YACvB,MAAM,GAAG,GAAG,GAAG,CAAC,UAAU,IAAI,sCAAsC,CAAC;YACrE,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,qDAAqD,GAAG,mEAAmE,EAAE,CAAC;aAC/J,CAAC;QACJ,CAAC;QACD,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG;YAAE,MAAM,IAAI,QAAQ,CAAC,SAAS,CAAC,aAAa,EAAE,mDAAmD,CAAC,CAAC;QACzH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,qBAAqB,GAAG,CAAC,MAAM,MAAM,GAAG,CAAC,OAAO,EAAE,EAAE,CAAC,EAAE,CAAC;IAClH,CAAC;IACD,MAAM,IAAI,QAAQ,CAAC,SAAS,CAAC,aAAa,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;AAC3D,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP-side shaping for website map, crawl and batch (the Extract family's
|
|
3
|
+
* multi-page operations). The REST API is untouched; this only decides how much
|
|
4
|
+
* of a response lands in a model's context and what the model is told to do
|
|
5
|
+
* next.
|
|
6
|
+
*
|
|
7
|
+
* - map: a site can list 5,000 URLs. When the caller sets no `limit` the tool
|
|
8
|
+
* asks for MCP_MAP_DEFAULT_LIMIT, and a truncated list carries a hint.
|
|
9
|
+
* - crawl/batch status: a result page can hold up to 100 pages of up to 2 MB
|
|
10
|
+
* each. The tool asks for MCP_RESULTS_DEFAULT_LIMIT results per call and
|
|
11
|
+
* clips each page's content to `max_content_chars`, flagging the clip, so a
|
|
12
|
+
* status call stays inside a context window. `next_cursor` always survives.
|
|
13
|
+
*
|
|
14
|
+
* Deterministic and offline. Exported for scripts/trim-check.mjs.
|
|
15
|
+
*/
|
|
16
|
+
import { type JsonValue } from "./trim-response.js";
|
|
17
|
+
export declare const MCP_MAP_DEFAULT_LIMIT = 200;
|
|
18
|
+
export declare const MCP_RESULTS_DEFAULT_LIMIT = 10;
|
|
19
|
+
export declare const MCP_DEFAULT_CONTENT_CHARS = 4000;
|
|
20
|
+
/** MCP clients commonly cancel a tool call at 60 s; stay well inside it. */
|
|
21
|
+
export declare const MAX_WAIT_SECONDS = 50;
|
|
22
|
+
export declare const CRAWL_DEFAULT_WAIT_SECONDS = 30;
|
|
23
|
+
export declare const POLL_INTERVAL_MS = 3000;
|
|
24
|
+
export declare const TERMINAL_STATUSES: Set<string>;
|
|
25
|
+
/** Shape a map response: add a hint when the link list was cut. */
|
|
26
|
+
export declare function shapeMap(raw: unknown): JsonValue;
|
|
27
|
+
export interface JobShapeOptions {
|
|
28
|
+
type: "crawl" | "batch";
|
|
29
|
+
maxContentChars?: number;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Shape a crawl/batch status response: clip page content, then drop nulls, then
|
|
33
|
+
* tell the model what to call next (more results, or wait for a running job).
|
|
34
|
+
*/
|
|
35
|
+
export declare function shapeJobStatus(raw: unknown, opts: JobShapeOptions): JsonValue;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP-side shaping for website map, crawl and batch (the Extract family's
|
|
3
|
+
* multi-page operations). The REST API is untouched; this only decides how much
|
|
4
|
+
* of a response lands in a model's context and what the model is told to do
|
|
5
|
+
* next.
|
|
6
|
+
*
|
|
7
|
+
* - map: a site can list 5,000 URLs. When the caller sets no `limit` the tool
|
|
8
|
+
* asks for MCP_MAP_DEFAULT_LIMIT, and a truncated list carries a hint.
|
|
9
|
+
* - crawl/batch status: a result page can hold up to 100 pages of up to 2 MB
|
|
10
|
+
* each. The tool asks for MCP_RESULTS_DEFAULT_LIMIT results per call and
|
|
11
|
+
* clips each page's content to `max_content_chars`, flagging the clip, so a
|
|
12
|
+
* status call stays inside a context window. `next_cursor` always survives.
|
|
13
|
+
*
|
|
14
|
+
* Deterministic and offline. Exported for scripts/trim-check.mjs.
|
|
15
|
+
*/
|
|
16
|
+
import { shapeResponse } from "./trim-response.js";
|
|
17
|
+
export const MCP_MAP_DEFAULT_LIMIT = 200;
|
|
18
|
+
export const MCP_RESULTS_DEFAULT_LIMIT = 10;
|
|
19
|
+
export const MCP_DEFAULT_CONTENT_CHARS = 4000;
|
|
20
|
+
/** MCP clients commonly cancel a tool call at 60 s; stay well inside it. */
|
|
21
|
+
export const MAX_WAIT_SECONDS = 50;
|
|
22
|
+
export const CRAWL_DEFAULT_WAIT_SECONDS = 30;
|
|
23
|
+
export const POLL_INTERVAL_MS = 3000;
|
|
24
|
+
export const TERMINAL_STATUSES = new Set(["completed", "failed", "cancelled"]);
|
|
25
|
+
function isObject(v) {
|
|
26
|
+
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
27
|
+
}
|
|
28
|
+
/** Shape a map response: add a hint when the link list was cut. */
|
|
29
|
+
export function shapeMap(raw) {
|
|
30
|
+
const out = shapeResponse(raw);
|
|
31
|
+
if (isObject(out) && isObject(out.data) && out.data.truncated === true) {
|
|
32
|
+
const d = out.data;
|
|
33
|
+
return {
|
|
34
|
+
...out,
|
|
35
|
+
_hint: `${d.returned} of ${d.total_found} URLs returned. Raise limit (up to 5,000, or your plan's cap) or narrow with search / include_paths / exclude_paths.`,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
return out;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Shape a crawl/batch status response: clip page content, then drop nulls, then
|
|
42
|
+
* tell the model what to call next (more results, or wait for a running job).
|
|
43
|
+
*/
|
|
44
|
+
export function shapeJobStatus(raw, opts) {
|
|
45
|
+
const max = opts.maxContentChars ?? MCP_DEFAULT_CONTENT_CHARS;
|
|
46
|
+
const copy = structuredClone(raw ?? {});
|
|
47
|
+
let clipped = 0;
|
|
48
|
+
if (isObject(copy) && isObject(copy.data) && Array.isArray(copy.data.results)) {
|
|
49
|
+
for (const r of copy.data.results) {
|
|
50
|
+
if (isObject(r) && typeof r.content === "string" && r.content.length > max) {
|
|
51
|
+
r.content = r.content.slice(0, max);
|
|
52
|
+
r.content_clipped = true;
|
|
53
|
+
clipped++;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
const out = shapeResponse(copy);
|
|
58
|
+
if (!isObject(out) || !isObject(out.data))
|
|
59
|
+
return out;
|
|
60
|
+
const d = out.data;
|
|
61
|
+
const tool = `get_${opts.type}_status`;
|
|
62
|
+
const hints = [];
|
|
63
|
+
const status = typeof d.status === "string" ? d.status : "";
|
|
64
|
+
if (status && !TERMINAL_STATUSES.has(status)) {
|
|
65
|
+
hints.push(`The ${opts.type} is ${status}: call ${tool} with id="${d.id}" and wait_seconds (up to ${MAX_WAIT_SECONDS}) to wait for it.`);
|
|
66
|
+
}
|
|
67
|
+
if (typeof d.next_cursor === "string") {
|
|
68
|
+
hints.push(`More results: call ${tool} with id="${d.id}" and cursor="${d.next_cursor}".`);
|
|
69
|
+
}
|
|
70
|
+
if (clipped > 0) {
|
|
71
|
+
hints.push(`${clipped} page(s) clipped to ${max} characters (content_clipped: true; content_length is the full size). Raise max_content_chars, or filter with status, to read more.`);
|
|
72
|
+
}
|
|
73
|
+
return hints.length ? { ...out, _hint: hints.join(" ") } : out;
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=web-jobs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-jobs.js","sourceRoot":"","sources":["../../src/lib/web-jobs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,aAAa,EAAmC,MAAM,oBAAoB,CAAC;A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a,CAAC,CAAC,EAAE,6BAA6B,gBAAgB,mBAAmB,CAAC,CAAC;IAC3I,CAAC;IACD,IAAI,OAAO,CAAC,CAAC,WAAW,KAAK,QAAQ,EAAE,CAAC;QACtC,KAAK,CAAC,IAAI,CAAC,sBAAsB,IAAI,aAAa,CAAC,CAAC,EAAE,iBAAiB,CAAC,CAAC,WAAW,IAAI,CAAC,CAAC;IAC5F,CAAC;IACD,IAAI,OAAO,GAAG,CAAC,EAAE,CAAC;QAChB,KAAK,CAAC,IAAI,CAAC,GAAG,OAAO,uBAAuB,GAAG,qIAAqI,CAAC,CAAC;IACxL,CAAC;IACD,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;AACjE,CAAC"}
|
package/dist/tools/extract.js
CHANGED
|
@@ -1,6 +1,103 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { handleApiError } from "../lib/tool-error.js";
|
|
3
|
-
import { trimResponse } from "../lib/trim-response.js";
|
|
3
|
+
import { shapeResponse, trimResponse } from "../lib/trim-response.js";
|
|
4
|
+
import { CRAWL_DEFAULT_WAIT_SECONDS, MAX_WAIT_SECONDS, MCP_DEFAULT_CONTENT_CHARS, MCP_MAP_DEFAULT_LIMIT, MCP_RESULTS_DEFAULT_LIMIT, POLL_INTERVAL_MS, TERMINAL_STATUSES, shapeJobStatus, shapeMap, } from "../lib/web-jobs.js";
|
|
5
|
+
// Schemas mirror backend/src/routes/extract-web.ts field for field: same names,
|
|
6
|
+
// enums, ranges and optionality, and no .default() -- an omitted field is
|
|
7
|
+
// omitted on the wire and the API's own default applies. The MCP-only knobs
|
|
8
|
+
// (wait_seconds, max_content_chars) are stripped before the request.
|
|
9
|
+
const MAX_GLOBS = 50;
|
|
10
|
+
const MAX_GLOB_LENGTH = 200;
|
|
11
|
+
const PRICING = "Per successful page: normal 1cr, advanced 1cr, ultra 2cr; failed/skipped pages free. Obeys robots.txt.";
|
|
12
|
+
const mode = z.enum(["normal", "advanced", "ultra"]).optional()
|
|
13
|
+
.describe("PRICE-BEARING. 'normal'=1cr (default), 'advanced'=renders JavaScript 1cr, 'ultra'=hardest pages 2cr.");
|
|
14
|
+
const format = z.enum(["html", "markdown", "text"]).optional()
|
|
15
|
+
.describe("Page format: 'markdown' (default), 'text', or 'html'.");
|
|
16
|
+
const globs = (what) => z.array(z.string().max(MAX_GLOB_LENGTH)).max(MAX_GLOBS).optional()
|
|
17
|
+
.describe(`Path globs to ${what} (* one segment, ** any depth), e.g. ["/blog/**"].`);
|
|
18
|
+
const webhookUrl = z.string().max(2048).optional()
|
|
19
|
+
.describe("Optional https URL that gets a signed POST when the job ends; secret returned once as webhook_secret.");
|
|
20
|
+
const idempotencyKey = z.string().max(255).optional()
|
|
21
|
+
.describe("Optional; the same key within 24h returns the original job.");
|
|
22
|
+
const jobId = z.string().min(1).max(64).describe("Job id from the start call.");
|
|
23
|
+
const statusQuery = {
|
|
24
|
+
cursor: z.string().max(20).optional().describe("next_cursor from the previous call."),
|
|
25
|
+
limit: z.number().int().min(1).max(100).optional()
|
|
26
|
+
.describe(`Results per call (default ${MCP_RESULTS_DEFAULT_LIMIT} here).`),
|
|
27
|
+
status: z.enum(["succeeded", "failed", "skipped"]).optional().describe("Only results with this status."),
|
|
28
|
+
include_content: z.boolean().optional().describe("false = results without content. Default true."),
|
|
29
|
+
max_content_chars: z.number().int().min(200).max(200000).optional()
|
|
30
|
+
.describe(`Clip each page's content to this many chars (default ${MCP_DEFAULT_CONTENT_CHARS}).`),
|
|
31
|
+
};
|
|
32
|
+
const waitSeconds = (dflt) => z.number().int().min(0).max(MAX_WAIT_SECONDS).optional()
|
|
33
|
+
.describe(`Seconds to wait for the job to finish (default ${dflt}).`);
|
|
34
|
+
function statusPath(type, id, q) {
|
|
35
|
+
const p = new URLSearchParams();
|
|
36
|
+
if (q.cursor !== undefined)
|
|
37
|
+
p.set("cursor", q.cursor);
|
|
38
|
+
p.set("limit", String(q.limit ?? MCP_RESULTS_DEFAULT_LIMIT));
|
|
39
|
+
if (q.status !== undefined)
|
|
40
|
+
p.set("status", q.status);
|
|
41
|
+
if (q.include_content !== undefined)
|
|
42
|
+
p.set("include_content", String(q.include_content));
|
|
43
|
+
return `/api/v1/extract/${type}/${encodeURIComponent(id)}?${p.toString()}`;
|
|
44
|
+
}
|
|
45
|
+
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
46
|
+
/** Poll (content-free) until the job is terminal or the wait runs out. */
|
|
47
|
+
async function waitFor(client, type, id, seconds) {
|
|
48
|
+
const deadline = Date.now() + seconds * 1000;
|
|
49
|
+
for (;;) {
|
|
50
|
+
const s = await client.get(statusPath(type, id, { limit: 1, include_content: false }));
|
|
51
|
+
const progress = { status: s.data?.status, pages: s.data?.pages, credits_used: s.data?.credits_used };
|
|
52
|
+
if (TERMINAL_STATUSES.has(progress.status ?? ""))
|
|
53
|
+
return { done: true, progress };
|
|
54
|
+
const left = deadline - Date.now();
|
|
55
|
+
if (left <= 0)
|
|
56
|
+
return { done: false, progress };
|
|
57
|
+
await sleep(Math.min(POLL_INTERVAL_MS, left));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function text(value) {
|
|
61
|
+
return { content: [{ type: "text", text: JSON.stringify(value) }] };
|
|
62
|
+
}
|
|
63
|
+
function strip(params, keys) {
|
|
64
|
+
const out = {};
|
|
65
|
+
for (const [k, v] of Object.entries(params))
|
|
66
|
+
if (!keys.includes(k) && v !== undefined)
|
|
67
|
+
out[k] = v;
|
|
68
|
+
return out;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Start a crawl/batch, then wait up to wait_seconds. Finished in time: the
|
|
72
|
+
* first page of results. Still running: the job as created (id, status_url,
|
|
73
|
+
* webhook_secret, which is shown only once) plus a hint to poll.
|
|
74
|
+
*/
|
|
75
|
+
async function startJob(client, type, params, defaultWait) {
|
|
76
|
+
const { wait_seconds, max_content_chars, idempotency_key } = params;
|
|
77
|
+
const body = strip(params, ["wait_seconds", "max_content_chars", "idempotency_key"]);
|
|
78
|
+
const headers = idempotency_key ? { "Idempotency-Key": idempotency_key } : undefined;
|
|
79
|
+
const created = await client.post(`/api/v1/extract/${type}`, body, headers);
|
|
80
|
+
const id = created.data.id;
|
|
81
|
+
const wait = wait_seconds ?? defaultWait;
|
|
82
|
+
const waited = wait > 0 ? await waitFor(client, type, id, wait) : null;
|
|
83
|
+
if (waited?.done) {
|
|
84
|
+
const status = await client.get(statusPath(type, id, {}));
|
|
85
|
+
const shaped = shapeJobStatus(status, { type, maxContentChars: max_content_chars });
|
|
86
|
+
return text(created.data.webhook_secret ? { ...shaped, webhook_secret: created.data.webhook_secret } : shaped);
|
|
87
|
+
}
|
|
88
|
+
return text({
|
|
89
|
+
...shapeResponse(created),
|
|
90
|
+
...(waited ? { progress: shapeResponse(waited.progress) } : {}),
|
|
91
|
+
_hint: `Job ${id} is still running. Call get_${type}_status with id="${id}" (add wait_seconds up to ${MAX_WAIT_SECONDS} to wait) for progress and results.`,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
async function jobStatus(client, type, params) {
|
|
95
|
+
const { id, wait_seconds, max_content_chars, ...q } = params;
|
|
96
|
+
if (wait_seconds && wait_seconds > 0)
|
|
97
|
+
await waitFor(client, type, id, wait_seconds);
|
|
98
|
+
const status = await client.get(statusPath(type, id, q));
|
|
99
|
+
return text(shapeJobStatus(status, { type, maxContentChars: max_content_chars }));
|
|
100
|
+
}
|
|
4
101
|
export function registerExtractTool(server, getClient) {
|
|
5
102
|
server.tool("extract_url", `Read any web page as Markdown, text, or HTML. Tier-priced: normal=1cr, advanced(JS render)=1cr, ultra(hardest pages)=2cr. Start normal, escalate on empty/blocked. Only billed on success.`, {
|
|
6
103
|
url: z.string().min(1).max(2048)
|
|
@@ -18,5 +115,99 @@ export function registerExtractTool(server, getClient) {
|
|
|
18
115
|
return handleApiError(err);
|
|
19
116
|
}
|
|
20
117
|
});
|
|
118
|
+
server.tool("map_website", `List a site's page URLs from its sitemaps and start page (deduplicated, path-filtered, with lastmod when known). Obeys robots.txt. 1 credit (normal). Use to pick pages for batch_extract.`, {
|
|
119
|
+
url: z.string().min(1).max(2048).describe("Site to map, e.g. https://example.com."),
|
|
120
|
+
search: z.string().max(200).optional().describe("Only URLs containing every word of this text (case-insensitive)."),
|
|
121
|
+
limit: z.number().int().min(1).max(5000).optional()
|
|
122
|
+
.describe(`Max links (default ${MCP_MAP_DEFAULT_LIMIT} here). Plan caps: Free 500, PAYG 1,000, paid 5,000.`),
|
|
123
|
+
sitemap: z.enum(["include", "only", "skip"]).optional()
|
|
124
|
+
.describe("'include' (default) sitemaps + page links; 'only' sitemaps; 'skip' page links."),
|
|
125
|
+
include_subdomains: z.boolean().optional().describe("Include subdomains. Default false."),
|
|
126
|
+
include_paths: globs("keep"),
|
|
127
|
+
exclude_paths: globs("drop"),
|
|
128
|
+
ignore_query_parameters: z.boolean().optional().describe("Merge URLs differing only by query. Default true."),
|
|
129
|
+
mode,
|
|
130
|
+
}, async (params) => {
|
|
131
|
+
try {
|
|
132
|
+
const body = { ...strip(params, []), limit: params.limit ?? MCP_MAP_DEFAULT_LIMIT };
|
|
133
|
+
const data = await getClient().post("/api/v1/extract/map", body);
|
|
134
|
+
return text(shapeMap(data));
|
|
135
|
+
}
|
|
136
|
+
catch (err) {
|
|
137
|
+
return handleApiError(err);
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
server.tool("crawl_website", `Crawl a site from one URL and extract its same-site pages as Markdown/text/HTML. Starts a job and waits up to wait_seconds: returns results if done, else the job id for get_crawl_status. ${PRICING} Max pages: Free 10, PAYG 100, Project 500, Bootstrap 2k, Startup 5k, Growth 10k. Results kept 3 days.`, {
|
|
141
|
+
url: z.string().min(1).max(2048).describe("Start URL; pages under its path are crawled first."),
|
|
142
|
+
max_pages: z.number().int().min(1).max(10000).optional().describe("Max pages (default 100, capped by plan)."),
|
|
143
|
+
max_depth: z.number().int().min(0).max(10).optional().describe("Link depth to follow (default 3; 0 = start page only)."),
|
|
144
|
+
include_paths: globs("crawl"),
|
|
145
|
+
exclude_paths: globs("skip"),
|
|
146
|
+
allow_subdomains: z.boolean().optional().describe("Include subdomains. Default false."),
|
|
147
|
+
ignore_query_parameters: z.boolean().optional().describe("Merge URLs differing only by query. Default true."),
|
|
148
|
+
sitemap: z.enum(["include", "skip", "only"]).optional()
|
|
149
|
+
.describe("'include' (default) also seeds from the sitemap; 'skip' links only; 'only' sitemap pages, no link following."),
|
|
150
|
+
format,
|
|
151
|
+
mode,
|
|
152
|
+
webhook_url: webhookUrl,
|
|
153
|
+
idempotency_key: idempotencyKey,
|
|
154
|
+
wait_seconds: waitSeconds(CRAWL_DEFAULT_WAIT_SECONDS),
|
|
155
|
+
max_content_chars: statusQuery.max_content_chars,
|
|
156
|
+
}, async (params) => {
|
|
157
|
+
try {
|
|
158
|
+
return await startJob(getClient(), "crawl", params, CRAWL_DEFAULT_WAIT_SECONDS);
|
|
159
|
+
}
|
|
160
|
+
catch (err) {
|
|
161
|
+
return handleApiError(err);
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
server.tool("get_crawl_status", `A crawl's status, page counts, credits used and page results (paged by cursor). Can wait for it to finish. Free.`, { id: jobId, ...statusQuery, wait_seconds: waitSeconds(0) }, async (params) => {
|
|
165
|
+
try {
|
|
166
|
+
return await jobStatus(getClient(), "crawl", params);
|
|
167
|
+
}
|
|
168
|
+
catch (err) {
|
|
169
|
+
return handleApiError(err);
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
server.tool("cancel_crawl", `Stop a running crawl; nothing more is billed and results so far stay readable. 409 if already finished. Free.`, { id: jobId }, async ({ id }) => {
|
|
173
|
+
try {
|
|
174
|
+
return trimResponse(await getClient().delete(`/api/v1/extract/crawl/${encodeURIComponent(id)}`));
|
|
175
|
+
}
|
|
176
|
+
catch (err) {
|
|
177
|
+
return handleApiError(err);
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
server.tool("batch_extract", `Extract a list of URLs in one job, each as Markdown/text/HTML, results in input order; invalid URLs are reported, never billed. Waits up to wait_seconds: returns results if done, else the job id for get_batch_status. ${PRICING} Max URLs: Free 10, PAYG 50, Project 100, Bootstrap 500, Startup/Growth 1k.`, {
|
|
181
|
+
urls: z.array(z.string().max(2048)).min(1).max(1000).describe("Pages to extract (duplicates removed)."),
|
|
182
|
+
format,
|
|
183
|
+
mode,
|
|
184
|
+
webhook_url: webhookUrl,
|
|
185
|
+
idempotency_key: idempotencyKey,
|
|
186
|
+
wait_seconds: waitSeconds(CRAWL_DEFAULT_WAIT_SECONDS),
|
|
187
|
+
max_content_chars: statusQuery.max_content_chars,
|
|
188
|
+
}, async (params) => {
|
|
189
|
+
try {
|
|
190
|
+
return await startJob(getClient(), "batch", params, CRAWL_DEFAULT_WAIT_SECONDS);
|
|
191
|
+
}
|
|
192
|
+
catch (err) {
|
|
193
|
+
return handleApiError(err);
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
server.tool("get_batch_status", `A batch's status, page counts, credits used and results in input order (paged by cursor). Can wait for it to finish. Free.`, { id: jobId, ...statusQuery, wait_seconds: waitSeconds(0) }, async (params) => {
|
|
197
|
+
try {
|
|
198
|
+
return await jobStatus(getClient(), "batch", params);
|
|
199
|
+
}
|
|
200
|
+
catch (err) {
|
|
201
|
+
return handleApiError(err);
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
server.tool("cancel_batch", `Stop a running batch; nothing more is billed and results so far stay readable. 409 if already finished. Free.`, { id: jobId }, async ({ id }) => {
|
|
205
|
+
try {
|
|
206
|
+
return trimResponse(await getClient().delete(`/api/v1/extract/batch/${encodeURIComponent(id)}`));
|
|
207
|
+
}
|
|
208
|
+
catch (err) {
|
|
209
|
+
return handleApiError(err);
|
|
210
|
+
}
|
|
211
|
+
});
|
|
21
212
|
}
|
|
22
213
|
//# sourceMappingURL=extract.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract.js","sourceRoot":"","sources":["../../src/tools/extract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,MAAM,UAAU,mBAAmB,CAAC,MAAiB,EAAE,SAA6B;IAClF,MAAM,CAAC,IAAI,CACT,aAAa,EACb,4LAA4L,EAC5L;QACE,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC;aAC7B,QAAQ,CAAC,uEAAuE,CAAC;QACpF,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,QAAQ,EAAE;aACpD,QAAQ,CAAC,0CAA0C,CAAC;QACvD,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC,QAAQ,EAAE;aACrD,QAAQ,CAAC,6FAA6F,CAAC;KAC3G,EACD,KAAK,EAAE,MAAM,EAAE,EAAE;QACf,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,MAAM,SAAS,EAAE,CAAC,IAAI,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;YAC/D,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC;QAC5B,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,cAAc,CAAC,GAAG,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
1
|
+
{"version":3,"file":"extract.js","sourceRoot":"","sources":["../../src/tools/extract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,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C;IACH,CAAC,CACF,CAAC;IAEF,MAAM,CAAC,IAAI,CACT,cAAc,EACd,+GAA+G,EAC/G,EAAE,EAAE,EAAE,KAAK,EAAE,EACb,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE;QACf,IAAI,CAAC;YACH,OAAO,YAAY,CAAC,MAAM,SAAS,EAAE,CAAC,MAAM,CAAC,yBAAyB,kBAAkB,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QACnG,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,cAAc,CAAC,GAAG,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -4,12 +4,13 @@ export declare const PLATFORM_KEYS: string[];
|
|
|
4
4
|
/**
|
|
5
5
|
* What registers when SCAVIO_PLATFORMS is unset.
|
|
6
6
|
*
|
|
7
|
-
* Registering everything is not an option any more. The full surface is
|
|
8
|
-
* tools, which serialises to
|
|
7
|
+
* Registering everything is not an option any more. The full surface is 255
|
|
8
|
+
* tools, which serialises to 243KB of tools/list (measured with
|
|
9
9
|
* `npm run toolslist`, not estimated) — roughly 58k tokens pushed into the
|
|
10
10
|
* context of EVERY session before the user has typed anything, and past the
|
|
11
|
-
* hard tool-count ceiling some clients enforce. The default set below is
|
|
12
|
-
* tools,
|
|
11
|
+
* hard tool-count ceiling some clients enforce. The default set below is 133
|
|
12
|
+
* tools, 105KB (0.20.0: TikTok, YouTube, Reddit and X gained 19 tools; 0.21.0:
|
|
13
|
+
* Extract gained map, crawl and batch, 7 tools).
|
|
13
14
|
*
|
|
14
15
|
* The default is therefore exactly what 0.12.x registered, plus extract:
|
|
15
16
|
* upgrading must never silently remove a tool someone already depends on. A
|
|
@@ -26,7 +27,7 @@ export declare const DEFAULT_PLATFORMS: string[];
|
|
|
26
27
|
* Turn a SCAVIO_PLATFORMS value into the canonical platform keys to register.
|
|
27
28
|
*
|
|
28
29
|
* Accepts a comma-separated list of platform keys, plus three keywords:
|
|
29
|
-
* all — every platform (
|
|
30
|
+
* all — every platform (255 tools)
|
|
30
31
|
* default — expands to DEFAULT_PLATFORMS, so `default,sec,g2` is additive
|
|
31
32
|
* none — no platform tools at all, leaving only get_usage
|
|
32
33
|
*
|
package/dist/tools/index.js
CHANGED
|
@@ -105,12 +105,13 @@ export const PLATFORM_KEYS = Object.keys(PLATFORMS);
|
|
|
105
105
|
/**
|
|
106
106
|
* What registers when SCAVIO_PLATFORMS is unset.
|
|
107
107
|
*
|
|
108
|
-
* Registering everything is not an option any more. The full surface is
|
|
109
|
-
* tools, which serialises to
|
|
108
|
+
* Registering everything is not an option any more. The full surface is 255
|
|
109
|
+
* tools, which serialises to 243KB of tools/list (measured with
|
|
110
110
|
* `npm run toolslist`, not estimated) — roughly 58k tokens pushed into the
|
|
111
111
|
* context of EVERY session before the user has typed anything, and past the
|
|
112
|
-
* hard tool-count ceiling some clients enforce. The default set below is
|
|
113
|
-
* tools,
|
|
112
|
+
* hard tool-count ceiling some clients enforce. The default set below is 133
|
|
113
|
+
* tools, 105KB (0.20.0: TikTok, YouTube, Reddit and X gained 19 tools; 0.21.0:
|
|
114
|
+
* Extract gained map, crawl and batch, 7 tools).
|
|
114
115
|
*
|
|
115
116
|
* The default is therefore exactly what 0.12.x registered, plus extract:
|
|
116
117
|
* upgrading must never silently remove a tool someone already depends on. A
|
|
@@ -162,7 +163,7 @@ function warnOnce(message) {
|
|
|
162
163
|
* Turn a SCAVIO_PLATFORMS value into the canonical platform keys to register.
|
|
163
164
|
*
|
|
164
165
|
* Accepts a comma-separated list of platform keys, plus three keywords:
|
|
165
|
-
* all — every platform (
|
|
166
|
+
* all — every platform (255 tools)
|
|
166
167
|
* default — expands to DEFAULT_PLATFORMS, so `default,sec,g2` is additive
|
|
167
168
|
* none — no platform tools at all, leaving only get_usage
|
|
168
169
|
*
|
|
@@ -239,9 +240,20 @@ const READ_ONLY_ANNOTATIONS = {
|
|
|
239
240
|
destructiveHint: false,
|
|
240
241
|
openWorldHint: true,
|
|
241
242
|
};
|
|
243
|
+
/**
|
|
244
|
+
* The exceptions to "reads and changes nothing": starting a crawl or batch
|
|
245
|
+
* creates a server-side job (not idempotent unless idempotency_key is set), and
|
|
246
|
+
* cancelling one stops it for good. Still no change to any external site.
|
|
247
|
+
*/
|
|
248
|
+
const ANNOTATION_OVERRIDES = {
|
|
249
|
+
crawl_website: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
|
|
250
|
+
batch_extract: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
|
|
251
|
+
cancel_crawl: { readOnlyHint: false, destructiveHint: true, idempotentHint: true },
|
|
252
|
+
cancel_batch: { readOnlyHint: false, destructiveHint: true, idempotentHint: true },
|
|
253
|
+
};
|
|
242
254
|
/**
|
|
243
255
|
* Wrap the server so every tool() call is annotated at registration, instead
|
|
244
|
-
* of editing
|
|
256
|
+
* of editing 255 call sites. A tool added later picks this up automatically.
|
|
245
257
|
*/
|
|
246
258
|
function annotating(server) {
|
|
247
259
|
return new Proxy(server, {
|
|
@@ -251,7 +263,7 @@ function annotating(server) {
|
|
|
251
263
|
return (name, ...rest) => {
|
|
252
264
|
const registered = Reflect.apply(target.tool, target, [name, ...rest]);
|
|
253
265
|
const title = toolTitle(name);
|
|
254
|
-
registered.update({ title, annotations: { title, ...READ_ONLY_ANNOTATIONS } });
|
|
266
|
+
registered.update({ title, annotations: { title, ...READ_ONLY_ANNOTATIONS, ...ANNOTATION_OVERRIDES[name] } });
|
|
255
267
|
return registered;
|
|
256
268
|
};
|
|
257
269
|
},
|
package/dist/tools/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,mB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,EAAE,EAAE,KAAK,EAAE,GAAG,qBAAqB,EAAE,GAAG,oBAAoB,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;gBAC9G,OAAO,UAAU,CAAC;YACpB,CAAC,CAAC;QACJ,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAC9B,MAAiB,EACjB,SAA6B,EAC7B,eAAmC,GAAG,CAAC,gBAAgB;IAEvD,MAAM,SAAS,GAAG,gBAAgB,CAAC,YAAY,CAAC,CAAC;IACjD,MAAM,SAAS,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;IACrC,KAAK,MAAM,GAAG,IAAI,SAAS;QAAE,SAAS,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IAClE,iBAAiB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IACxC,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scavio/mcp-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"mcpName": "io.github.scavio-ai/scavio-mcp",
|
|
5
|
-
"description": "MCP server connecting AI agents to Scavio: web search, page extraction, and structured e-commerce, social, travel, jobs, real-estate, app-store, ad-library and company-filing data.
|
|
5
|
+
"description": "MCP server connecting AI agents to Scavio: web search, page extraction, and structured e-commerce, social, travel, jobs, real-estate, app-store, ad-library and company-filing data. 255 tools across 36 platforms plus Extract, site map, crawl and batch extraction, one API key.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"author": "Scavio",
|
|
@@ -43,6 +43,9 @@
|
|
|
43
43
|
"sec-filings",
|
|
44
44
|
"web-scraping",
|
|
45
45
|
"url-extraction",
|
|
46
|
+
"web-crawler",
|
|
47
|
+
"website-crawler",
|
|
48
|
+
"sitemap",
|
|
46
49
|
"tavily-alternative",
|
|
47
50
|
"serpapi-alternative"
|
|
48
51
|
],
|