mcpscraper-cli 0.27.0 → 0.28.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 +12 -3
- package/dist/bin/cli.js +151 -12
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ Command-line interface for [mcpscraper.dev](https://mcpscraper.dev) and [memory.
|
|
|
4
4
|
|
|
5
5
|
[Release history](https://github.com/VilovietaSEO/mcpscraper-sdk/blob/main/CHANGELOG.md)
|
|
6
6
|
|
|
7
|
-
The CLI provides friendly shortcuts for common operations plus universal discovery and invocation for every one of the
|
|
7
|
+
The CLI provides friendly shortcuts for common operations plus universal discovery and invocation for every one of the 254 unified MCP tools (153 MCP Scraper plus 101 mirrored Memory tools).
|
|
8
8
|
|
|
9
9
|
## Install
|
|
10
10
|
|
|
@@ -37,7 +37,7 @@ mcpscraper tools call archive_read --args '{"url":"https://github.com/octocat/He
|
|
|
37
37
|
mcpscraper tools call list_scheduled_runs --args '{"view":"inbox","limit":30}' --json
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
-
`tools list` contains exactly
|
|
40
|
+
`tools list` contains exactly 254 manifest-backed names. `tools call` accepts any one of them. Tools marked destructive require `--yes`.
|
|
41
41
|
|
|
42
42
|
Google SERP searches cost 60 Credits. PAA harvests cost 400 Credits plus 10 Credits per returned question. For additional throughput, one optional $5/month concurrency pack adds two browser slots; pack quantity scales both slots and monthly price linearly.
|
|
43
43
|
|
|
@@ -71,7 +71,16 @@ Options: `--screenshot`, `--deposit-to-vault`, `--vault <name>`, `--json`.
|
|
|
71
71
|
|
|
72
72
|
### `mcpscraper crawl <url>`
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
Starts a durable background export that retains complete JSON, acquired HTML, and Markdown for every successful page. Options: `--max-pages <n>` (default 100), `--preserve-media`, `--idempotency-key <key>`, `--json`.
|
|
75
|
+
|
|
76
|
+
Poll and read the export without downloading and unpacking the ZIP:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
mcpscraper export-status <job-id>
|
|
80
|
+
mcpscraper export-read <job-id> --representation manifest
|
|
81
|
+
mcpscraper export-read <job-id> --representation html --page-id <page-id> --output page.html
|
|
82
|
+
mcpscraper export-image <job-id> <image-id> --output image.jpg
|
|
83
|
+
```
|
|
75
84
|
|
|
76
85
|
### `mcpscraper map <url>`
|
|
77
86
|
|
package/dist/bin/cli.js
CHANGED
|
@@ -5,11 +5,12 @@ import { Command } from "commander";
|
|
|
5
5
|
import { fileURLToPath } from "url";
|
|
6
6
|
import { mkdirSync, realpathSync, writeFileSync } from "fs";
|
|
7
7
|
import { homedir } from "os";
|
|
8
|
-
import { join } from "path";
|
|
8
|
+
import { dirname, join } from "path";
|
|
9
|
+
import { randomUUID } from "crypto";
|
|
9
10
|
import { ScraperClient, ScraperApiError } from "mcpscraper-sdk";
|
|
10
11
|
|
|
11
12
|
// src/version.ts
|
|
12
|
-
var CLI_VERSION = "0.
|
|
13
|
+
var CLI_VERSION = "0.28.0";
|
|
13
14
|
|
|
14
15
|
// src/generated-tools.ts
|
|
15
16
|
var MCP_TOOL_CATALOG = [
|
|
@@ -513,7 +514,7 @@ var MCP_TOOL_CATALOG = [
|
|
|
513
514
|
"name": "extract_site",
|
|
514
515
|
"category": "web",
|
|
515
516
|
"title": "Multi-Page Site Content Crawl",
|
|
516
|
-
"description": "Crawl a public website and
|
|
517
|
+
"description": "Crawl a public website and durably retain complete per-page JSON, acquired HTML, and Markdown. Each page is fetched with a plain HTTP request first; a browser retries only pages that were blocked or hit a bot check. A Wayback replay URL produces one archived site snapshot; the optional wayback plan produces timelines across explicit months or a month range. Pass a new idempotencyKey for each intended crawl and reuse it only when retrying that call. Poll check_site_export, then use site_export_read for complete page representations and site_export_image for preserved images; a saved ZIP is also produced. For a technical SEO audit use audit_site instead.",
|
|
517
518
|
"inputSchema": {
|
|
518
519
|
"type": "object",
|
|
519
520
|
"properties": {
|
|
@@ -588,12 +589,13 @@ var MCP_TOOL_CATALOG = [
|
|
|
588
589
|
"maximum": 100
|
|
589
590
|
},
|
|
590
591
|
"formats": {
|
|
591
|
-
"description": "
|
|
592
|
+
"description": "Requested export views. Every successful page is durably retained as complete JSON, acquired HTML, and Markdown; links and image references are included in page JSON. branding adds a browser-based site summary.",
|
|
592
593
|
"type": "array",
|
|
593
594
|
"items": {
|
|
594
595
|
"type": "string",
|
|
595
596
|
"enum": [
|
|
596
597
|
"markdown",
|
|
598
|
+
"html",
|
|
597
599
|
"links",
|
|
598
600
|
"json",
|
|
599
601
|
"images",
|
|
@@ -603,7 +605,7 @@ var MCP_TOOL_CATALOG = [
|
|
|
603
605
|
},
|
|
604
606
|
"background": {
|
|
605
607
|
"default": true,
|
|
606
|
-
"description": "MCP multi-page crawls always run as durable background jobs. Poll check_site_export for
|
|
608
|
+
"description": "MCP multi-page crawls always run as durable background jobs. Poll check_site_export, then use site_export_read for complete JSON/HTML/Markdown and site_export_image for downloaded images.",
|
|
607
609
|
"type": "boolean",
|
|
608
610
|
"const": true
|
|
609
611
|
},
|
|
@@ -718,7 +720,7 @@ var MCP_TOOL_CATALOG = [
|
|
|
718
720
|
"name": "check_site_export",
|
|
719
721
|
"category": "web",
|
|
720
722
|
"title": "Check Site Export",
|
|
721
|
-
"description": "Poll a background extract_site or audit_site job. Reports discovered, attempted, successful, failed, and remaining pages. Complete and partial jobs
|
|
723
|
+
"description": "Poll a background extract_site or audit_site job. Reports discovered, attempted, successful, failed, and remaining pages plus a stable public error envelope when terminal. Complete and partial jobs expose direct AI readback through site_export_read/site_export_image and also return a downloadable ZIP.",
|
|
722
724
|
"inputSchema": {
|
|
723
725
|
"type": "object",
|
|
724
726
|
"properties": {
|
|
@@ -17819,6 +17821,96 @@ var MCP_TOOL_CATALOG = [
|
|
|
17819
17821
|
"idempotentHint": true,
|
|
17820
17822
|
"openWorldHint": true
|
|
17821
17823
|
}
|
|
17824
|
+
},
|
|
17825
|
+
{
|
|
17826
|
+
"name": "site_export_image",
|
|
17827
|
+
"category": "web",
|
|
17828
|
+
"title": "Read Site Export Image",
|
|
17829
|
+
"description": "Return one downloaded site-export image as a standard MCP image content block with source-page and source-URL provenance. Obtain imageId from site_export_read manifest.",
|
|
17830
|
+
"inputSchema": {
|
|
17831
|
+
"type": "object",
|
|
17832
|
+
"properties": {
|
|
17833
|
+
"jobId": {
|
|
17834
|
+
"type": "string",
|
|
17835
|
+
"minLength": 1,
|
|
17836
|
+
"description": "Site export job ID returned by extract_site or audit_site."
|
|
17837
|
+
},
|
|
17838
|
+
"imageId": {
|
|
17839
|
+
"type": "string",
|
|
17840
|
+
"pattern": "^[a-f0-9]{64}$",
|
|
17841
|
+
"description": "Downloaded image ID returned by a site_export_read manifest."
|
|
17842
|
+
}
|
|
17843
|
+
},
|
|
17844
|
+
"required": [
|
|
17845
|
+
"jobId",
|
|
17846
|
+
"imageId"
|
|
17847
|
+
],
|
|
17848
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema"
|
|
17849
|
+
},
|
|
17850
|
+
"annotations": {
|
|
17851
|
+
"title": "Read Site Export Image",
|
|
17852
|
+
"readOnlyHint": true,
|
|
17853
|
+
"destructiveHint": false,
|
|
17854
|
+
"idempotentHint": false,
|
|
17855
|
+
"openWorldHint": true
|
|
17856
|
+
}
|
|
17857
|
+
},
|
|
17858
|
+
{
|
|
17859
|
+
"name": "site_export_read",
|
|
17860
|
+
"category": "web",
|
|
17861
|
+
"title": "Read Site Export Page",
|
|
17862
|
+
"description": "List a site export manifest or read complete JSON, HTML, or Markdown for one page in resumable UTF-8 windows. Uses owner-scoped durable content directly and does not load the final ZIP.",
|
|
17863
|
+
"inputSchema": {
|
|
17864
|
+
"type": "object",
|
|
17865
|
+
"properties": {
|
|
17866
|
+
"jobId": {
|
|
17867
|
+
"type": "string",
|
|
17868
|
+
"minLength": 1,
|
|
17869
|
+
"description": "Site export job ID returned by extract_site or audit_site."
|
|
17870
|
+
},
|
|
17871
|
+
"pageId": {
|
|
17872
|
+
"description": "Page ID returned by a manifest read. Omit to list the export manifest.",
|
|
17873
|
+
"type": "string",
|
|
17874
|
+
"pattern": "^[a-f0-9]{64}$"
|
|
17875
|
+
},
|
|
17876
|
+
"format": {
|
|
17877
|
+
"default": "manifest",
|
|
17878
|
+
"description": "manifest lists page/image IDs; JSON, HTML, and Markdown read one page representation.",
|
|
17879
|
+
"type": "string",
|
|
17880
|
+
"enum": [
|
|
17881
|
+
"manifest",
|
|
17882
|
+
"json",
|
|
17883
|
+
"html",
|
|
17884
|
+
"markdown"
|
|
17885
|
+
]
|
|
17886
|
+
},
|
|
17887
|
+
"offset": {
|
|
17888
|
+
"default": 0,
|
|
17889
|
+
"description": "UTF-8 byte offset. Continue from nextOffset until it is null.",
|
|
17890
|
+
"type": "integer",
|
|
17891
|
+
"minimum": 0,
|
|
17892
|
+
"maximum": 9007199254740991
|
|
17893
|
+
},
|
|
17894
|
+
"maxBytes": {
|
|
17895
|
+
"default": 64e3,
|
|
17896
|
+
"description": "Maximum UTF-8 bytes returned in this window.",
|
|
17897
|
+
"type": "integer",
|
|
17898
|
+
"minimum": 1,
|
|
17899
|
+
"maximum": 1e6
|
|
17900
|
+
}
|
|
17901
|
+
},
|
|
17902
|
+
"required": [
|
|
17903
|
+
"jobId"
|
|
17904
|
+
],
|
|
17905
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema"
|
|
17906
|
+
},
|
|
17907
|
+
"annotations": {
|
|
17908
|
+
"title": "Read Site Export Page",
|
|
17909
|
+
"readOnlyHint": true,
|
|
17910
|
+
"destructiveHint": false,
|
|
17911
|
+
"idempotentHint": false,
|
|
17912
|
+
"openWorldHint": true
|
|
17913
|
+
}
|
|
17822
17914
|
}
|
|
17823
17915
|
];
|
|
17824
17916
|
var MCP_TOOL_NAMES = MCP_TOOL_CATALOG.map((tool) => tool.name);
|
|
@@ -18015,21 +18107,68 @@ Vault deposit: ${page.memory.deposited ? `saved to ${page.memory.vault}` : "fail
|
|
|
18015
18107
|
});
|
|
18016
18108
|
});
|
|
18017
18109
|
});
|
|
18018
|
-
program.command("crawl <url>").description("
|
|
18110
|
+
program.command("crawl <url>").description("Start a durable site export with complete per-page JSON, acquired HTML, and Markdown").option("--max-pages <n>", "maximum pages to crawl", (v) => parseInt(v, 10)).option("--idempotency-key <key>", "stable retry key; defaults to a new UUID for this intended crawl").option("--preserve-media", "download supported images into the export").option("--json", "print raw JSON").action(async (url, opts, cmd) => {
|
|
18019
18111
|
await run(async () => {
|
|
18020
18112
|
const result = await client(cmd).extractSite({
|
|
18021
18113
|
url,
|
|
18022
18114
|
maxPages: opts.maxPages ?? 100,
|
|
18023
|
-
background:
|
|
18115
|
+
background: true,
|
|
18024
18116
|
downloadImages: false,
|
|
18117
|
+
preserveMedia: Boolean(opts.preserveMedia),
|
|
18025
18118
|
rotateProxies: false,
|
|
18026
18119
|
rotateProxyEvery: 30,
|
|
18027
|
-
browserFallback: false
|
|
18028
|
-
|
|
18120
|
+
browserFallback: false,
|
|
18121
|
+
formats: ["json", "html", "markdown", "links"]
|
|
18122
|
+
}, { idempotencyKey: opts.idempotencyKey ?? randomUUID() });
|
|
18029
18123
|
printResult(result, Boolean(opts.json), (r) => {
|
|
18030
|
-
const
|
|
18031
|
-
console.log(`
|
|
18124
|
+
const job = r;
|
|
18125
|
+
console.log(`Export ${job.status ?? "started"}: ${job.jobId ?? "(missing job id)"}`);
|
|
18126
|
+
console.log(`Poll: mcpscraper export-status ${job.jobId ?? "<job-id>"}`);
|
|
18127
|
+
});
|
|
18128
|
+
});
|
|
18129
|
+
});
|
|
18130
|
+
program.command("export-status <job-id>").description("Poll a durable site export with progress, public errors, and artifact metadata").option("--json", "print raw JSON").action(async (jobId, opts, cmd) => {
|
|
18131
|
+
await run(async () => {
|
|
18132
|
+
const result = await client(cmd).getExtractSiteStatus(jobId);
|
|
18133
|
+
printResult(result, Boolean(opts.json), (value) => {
|
|
18134
|
+
const status = value;
|
|
18135
|
+
console.log(`${status.status ?? "unknown"} \xB7 discovered ${status.discovered ?? 0} \xB7 attempted ${status.attempted ?? 0} \xB7 successful ${status.successful ?? 0} \xB7 failed ${status.failed ?? 0} \xB7 remaining ${status.remaining ?? 0}`);
|
|
18136
|
+
if (status.error) console.log(status.error);
|
|
18137
|
+
if (["complete", "partial", "failed"].includes(status.status ?? "")) console.log(`Manifest: mcpscraper export-read ${jobId}`);
|
|
18138
|
+
});
|
|
18139
|
+
});
|
|
18140
|
+
});
|
|
18141
|
+
program.command("export-read <job-id>").description("List an export manifest or read one complete JSON, HTML, or Markdown representation").option("--page-id <id>", "page ID returned by the manifest").option("--format <format>", "manifest, json, html, or markdown", "manifest").option("--offset <n>", "UTF-8 byte offset", (value) => parseInt(value, 10), 0).option("--max-bytes <n>", "maximum bytes in this window", (value) => parseInt(value, 10), 64e3).option("--output <path>", "write the returned text window to a file").option("--json", "print response metadata and text as JSON").action(async (jobId, opts, cmd) => {
|
|
18142
|
+
await run(async () => {
|
|
18143
|
+
if (!["manifest", "json", "html", "markdown"].includes(opts.format)) throw new Error("--format must be manifest, json, html, or markdown");
|
|
18144
|
+
const result = await client(cmd).readExtractSiteExport({
|
|
18145
|
+
jobId,
|
|
18146
|
+
pageId: opts.pageId,
|
|
18147
|
+
format: opts.format,
|
|
18148
|
+
offset: opts.offset,
|
|
18149
|
+
maxBytes: opts.maxBytes
|
|
18032
18150
|
});
|
|
18151
|
+
if (opts.output) writeFileSync(opts.output, result.text, { mode: 384 });
|
|
18152
|
+
if (opts.json) console.log(JSON.stringify(result, null, 2));
|
|
18153
|
+
else {
|
|
18154
|
+
if (opts.output) console.log(`Saved ${Buffer.byteLength(result.text)} bytes to ${opts.output}`);
|
|
18155
|
+
else process.stdout.write(result.text);
|
|
18156
|
+
if (result.nextOffset != null) console.error(`
|
|
18157
|
+
Continue with --offset ${result.nextOffset}`);
|
|
18158
|
+
}
|
|
18159
|
+
});
|
|
18160
|
+
});
|
|
18161
|
+
program.command("export-image <job-id> <image-id>").description("Download one preserved site-export image by image ID").option("--output <path>", "output path; defaults under ~/Downloads/mcp-scraper").option("--json", "print image metadata after saving").action(async (jobId, imageId, opts, cmd) => {
|
|
18162
|
+
await run(async () => {
|
|
18163
|
+
const result = await client(cmd).readExtractSiteImage({ jobId, imageId });
|
|
18164
|
+
const target = opts.output ?? join(homedir(), "Downloads", "mcp-scraper", `${imageId}.${mediaExtension(result.mimeType)}`);
|
|
18165
|
+
mkdirSync(dirname(target), { recursive: true });
|
|
18166
|
+
const bytes = decodeBase64(result.dataBase64);
|
|
18167
|
+
writeFileSync(target, bytes, { mode: 384 });
|
|
18168
|
+
const metadata = { ...result, dataBase64: void 0, savedPath: target };
|
|
18169
|
+
if (opts.json) console.log(JSON.stringify(metadata, null, 2));
|
|
18170
|
+
else console.log(`Saved ${bytes.length} bytes to ${target}
|
|
18171
|
+
Source: ${result.sourceUrl ?? "unknown"}`);
|
|
18033
18172
|
});
|
|
18034
18173
|
});
|
|
18035
18174
|
program.command("map <url>").description("Discover all URLs on a site").option("--json", "print raw JSON").action(async (url, opts, cmd) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcpscraper-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.0",
|
|
4
4
|
"description": "Command-line interface for mcpscraper.dev and memory.mcpscraper.dev",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"commander": "^12.0.0",
|
|
22
|
-
"mcpscraper-sdk": "^0.
|
|
22
|
+
"mcpscraper-sdk": "^0.29.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@types/node": "^22.0.0"
|