mcp-scraper 0.3.15 → 0.3.16
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/dist/bin/api-server.cjs +290 -23
- package/dist/bin/api-server.cjs.map +1 -1
- package/dist/bin/api-server.js +1 -1
- package/dist/bin/browser-agent-stdio-server.cjs +1 -1
- package/dist/bin/browser-agent-stdio-server.cjs.map +1 -1
- package/dist/bin/browser-agent-stdio-server.js +2 -2
- package/dist/bin/mcp-scraper-cli.cjs +1 -1
- package/dist/bin/mcp-scraper-cli.cjs.map +1 -1
- package/dist/bin/mcp-scraper-cli.js +1 -1
- package/dist/bin/mcp-scraper-combined-stdio-server.cjs +253 -19
- package/dist/bin/mcp-scraper-combined-stdio-server.cjs.map +1 -1
- package/dist/bin/mcp-scraper-combined-stdio-server.js +4 -4
- package/dist/bin/mcp-scraper-install.cjs +3 -3
- package/dist/bin/mcp-scraper-install.cjs.map +1 -1
- package/dist/bin/mcp-scraper-install.js +2 -2
- package/dist/bin/mcp-stdio-server.cjs +251 -17
- package/dist/bin/mcp-stdio-server.cjs.map +1 -1
- package/dist/bin/mcp-stdio-server.js +2 -2
- package/dist/{chunk-WQAIOY2D.js → chunk-7XARJHS6.js} +254 -18
- package/dist/chunk-7XARJHS6.js.map +1 -0
- package/dist/{chunk-7Y6JDBML.js → chunk-ACIUCZ27.js} +3 -3
- package/dist/chunk-ACIUCZ27.js.map +1 -0
- package/dist/{chunk-WJ2LWHPA.js → chunk-ISZWGIWL.js} +2 -2
- package/dist/chunk-SOMBZK3V.js +7 -0
- package/dist/chunk-SOMBZK3V.js.map +1 -0
- package/dist/{server-UOQ2JIUQ.js → server-LPVBSE2E.js} +35 -8
- package/dist/server-LPVBSE2E.js.map +1 -0
- package/docs/mcp-tool-manifest.generated.json +45 -10
- package/package.json +1 -1
- package/dist/chunk-2MX5WOII.js +0 -7
- package/dist/chunk-2MX5WOII.js.map +0 -1
- package/dist/chunk-7Y6JDBML.js.map +0 -1
- package/dist/chunk-WQAIOY2D.js.map +0 -1
- package/dist/server-UOQ2JIUQ.js.map +0 -1
- /package/dist/{chunk-WJ2LWHPA.js.map → chunk-ISZWGIWL.js.map} +0 -0
|
@@ -232,6 +232,9 @@ var HttpMcpToolExecutor = class {
|
|
|
232
232
|
extractSite(input) {
|
|
233
233
|
return this.call("/extract-site", input);
|
|
234
234
|
}
|
|
235
|
+
auditSite(input) {
|
|
236
|
+
return this.call("/extract-site", input);
|
|
237
|
+
}
|
|
235
238
|
youtubeHarvest(input) {
|
|
236
239
|
return this.call("/youtube/harvest", input);
|
|
237
240
|
}
|
|
@@ -453,7 +456,7 @@ render();
|
|
|
453
456
|
}
|
|
454
457
|
|
|
455
458
|
// src/version.ts
|
|
456
|
-
var PACKAGE_VERSION = "0.3.
|
|
459
|
+
var PACKAGE_VERSION = "0.3.16";
|
|
457
460
|
|
|
458
461
|
// src/mcp/browser-agent-tool-schemas.ts
|
|
459
462
|
var import_zod = require("zod");
|
|
@@ -2075,6 +2078,137 @@ _Thresholds: title ${TITLE_MAX}ch/${TITLE_PX_MAX}px, meta ${META_MAX}ch, H1 ${H1
|
|
|
2075
2078
|
].join("\n");
|
|
2076
2079
|
}
|
|
2077
2080
|
|
|
2081
|
+
// src/api/image-audit.ts
|
|
2082
|
+
var OVER_BYTES = 100 * 1024;
|
|
2083
|
+
var MODERN = /* @__PURE__ */ new Set(["webp", "avif", "svg", "svg+xml"]);
|
|
2084
|
+
function formatBytes(n) {
|
|
2085
|
+
if (n == null) return null;
|
|
2086
|
+
if (n < 1024) return `${n} B`;
|
|
2087
|
+
if (n < 1024 * 1024) return `${(n / 1024).toFixed(1)} KB`;
|
|
2088
|
+
return `${(n / (1024 * 1024)).toFixed(2)} MB`;
|
|
2089
|
+
}
|
|
2090
|
+
var decodeEntities = (u) => u.replace(/&/g, "&").replace(/�?38;/g, "&").replace(/&/gi, "&").trim();
|
|
2091
|
+
var dedupKey = (u) => u.replace(/^https?:\/\//i, "//").replace(/\/$/, "");
|
|
2092
|
+
var formatOf = (ct, url) => {
|
|
2093
|
+
if (ct) {
|
|
2094
|
+
const m = ct.split(";")[0].trim().toLowerCase();
|
|
2095
|
+
if (m.startsWith("image/")) return m.replace("image/", "");
|
|
2096
|
+
}
|
|
2097
|
+
return (url.split("?")[0].match(/\.([a-z0-9]+)$/i)?.[1] || "unknown").toLowerCase();
|
|
2098
|
+
};
|
|
2099
|
+
function collectUrls(pages) {
|
|
2100
|
+
const byKey = /* @__PURE__ */ new Map();
|
|
2101
|
+
for (const p of pages) for (const raw of p.imageLinks || []) {
|
|
2102
|
+
const u = decodeEntities(raw);
|
|
2103
|
+
if (!/^https?:\/\//i.test(u)) continue;
|
|
2104
|
+
if (/[{}]|%7[bd]/i.test(u)) continue;
|
|
2105
|
+
const k = dedupKey(u);
|
|
2106
|
+
const prev = byKey.get(k);
|
|
2107
|
+
if (!prev || /^https:/i.test(u) && /^http:/i.test(prev)) byKey.set(k, u);
|
|
2108
|
+
}
|
|
2109
|
+
return [...byKey.values()];
|
|
2110
|
+
}
|
|
2111
|
+
async function sizeAndType(url, timeoutMs) {
|
|
2112
|
+
const ctrl = new AbortController();
|
|
2113
|
+
const t = setTimeout(() => ctrl.abort(), timeoutMs);
|
|
2114
|
+
const read = (res) => ({
|
|
2115
|
+
len: res.headers.get("content-length"),
|
|
2116
|
+
cr: res.headers.get("content-range"),
|
|
2117
|
+
ct: res.headers.get("content-type"),
|
|
2118
|
+
status: res.status
|
|
2119
|
+
});
|
|
2120
|
+
try {
|
|
2121
|
+
let bytes = null;
|
|
2122
|
+
let ct = null;
|
|
2123
|
+
let status = null;
|
|
2124
|
+
try {
|
|
2125
|
+
const h = read(await fetch(url, { method: "HEAD", redirect: "follow", signal: ctrl.signal }));
|
|
2126
|
+
status = h.status;
|
|
2127
|
+
ct = h.ct;
|
|
2128
|
+
if (h.len) bytes = Number(h.len);
|
|
2129
|
+
} catch {
|
|
2130
|
+
}
|
|
2131
|
+
if (bytes == null) {
|
|
2132
|
+
const g = await fetch(url, { method: "GET", headers: { Range: "bytes=0-0" }, redirect: "follow", signal: ctrl.signal });
|
|
2133
|
+
const r = read(g);
|
|
2134
|
+
status = status ?? r.status;
|
|
2135
|
+
ct = ct ?? r.ct;
|
|
2136
|
+
if (r.cr && r.cr.includes("/")) {
|
|
2137
|
+
const tail = r.cr.split("/")[1];
|
|
2138
|
+
if (tail && tail !== "*") bytes = Number(tail);
|
|
2139
|
+
} else if (r.len) bytes = Number(r.len);
|
|
2140
|
+
try {
|
|
2141
|
+
await g.body?.cancel();
|
|
2142
|
+
} catch {
|
|
2143
|
+
}
|
|
2144
|
+
}
|
|
2145
|
+
return { url, status, bytes: Number.isFinite(bytes) ? bytes : null, contentType: ct };
|
|
2146
|
+
} catch (e) {
|
|
2147
|
+
return { url, status: null, bytes: null, contentType: null, error: String(e.message || e) };
|
|
2148
|
+
} finally {
|
|
2149
|
+
clearTimeout(t);
|
|
2150
|
+
}
|
|
2151
|
+
}
|
|
2152
|
+
async function pool(items, n, fn) {
|
|
2153
|
+
const out = new Array(items.length);
|
|
2154
|
+
let i = 0;
|
|
2155
|
+
await Promise.all(Array.from({ length: Math.min(n, items.length) }, async () => {
|
|
2156
|
+
while (i < items.length) {
|
|
2157
|
+
const idx = i++;
|
|
2158
|
+
out[idx] = await fn(items[idx]);
|
|
2159
|
+
}
|
|
2160
|
+
}));
|
|
2161
|
+
return out;
|
|
2162
|
+
}
|
|
2163
|
+
async function auditImages(pages, opts = {}) {
|
|
2164
|
+
const concurrency = opts.concurrency ?? 12;
|
|
2165
|
+
const timeoutMs = opts.timeoutMs ?? 12e3;
|
|
2166
|
+
const urls = collectUrls(pages).slice(0, opts.max ?? 5e3);
|
|
2167
|
+
const heads = await pool(urls, concurrency, (u) => sizeAndType(u, timeoutMs));
|
|
2168
|
+
const rows = heads.map((r) => {
|
|
2169
|
+
const format = formatOf(r.contentType, r.url);
|
|
2170
|
+
return {
|
|
2171
|
+
...r,
|
|
2172
|
+
size: formatBytes(r.bytes),
|
|
2173
|
+
format,
|
|
2174
|
+
over100kb: r.bytes != null && r.bytes > OVER_BYTES,
|
|
2175
|
+
legacyFormat: format !== "unknown" && !MODERN.has(format)
|
|
2176
|
+
};
|
|
2177
|
+
});
|
|
2178
|
+
const sized = rows.filter((r) => r.bytes != null);
|
|
2179
|
+
const totalBytes = sized.reduce((a, r) => a + r.bytes, 0);
|
|
2180
|
+
const formatCounts = {};
|
|
2181
|
+
for (const r of rows) formatCounts[r.format] = (formatCounts[r.format] || 0) + 1;
|
|
2182
|
+
return {
|
|
2183
|
+
rows: rows.sort((a, b) => (b.bytes ?? 0) - (a.bytes ?? 0)),
|
|
2184
|
+
summary: {
|
|
2185
|
+
unique: rows.length,
|
|
2186
|
+
sized: sized.length,
|
|
2187
|
+
totalBytes,
|
|
2188
|
+
totalSize: formatBytes(totalBytes) ?? "0 B",
|
|
2189
|
+
avgSize: formatBytes(Math.round(totalBytes / (sized.length || 1))) ?? "0 B",
|
|
2190
|
+
over100kb: rows.filter((r) => r.over100kb).length,
|
|
2191
|
+
legacyFormat: rows.filter((r) => r.legacyFormat).length,
|
|
2192
|
+
formatCounts
|
|
2193
|
+
}
|
|
2194
|
+
};
|
|
2195
|
+
}
|
|
2196
|
+
function renderImageSection(audit) {
|
|
2197
|
+
const s = audit.summary;
|
|
2198
|
+
const fmt = Object.entries(s.formatCounts).sort((a, b) => b[1] - a[1]).map(([k, v]) => `${k}:${v}`).join(" ");
|
|
2199
|
+
const heaviest = audit.rows.filter((r) => r.over100kb).slice(0, 15);
|
|
2200
|
+
const lines = [
|
|
2201
|
+
`## Images`,
|
|
2202
|
+
`**${s.unique} unique images** \xB7 ${s.totalSize} total \xB7 ${s.avgSize} avg \xB7 ${s.over100kb} over 100 KB \xB7 ${s.legacyFormat} legacy format`,
|
|
2203
|
+
`Formats: ${fmt}`
|
|
2204
|
+
];
|
|
2205
|
+
if (heaviest.length) {
|
|
2206
|
+
lines.push("", "| Size | Format | URL |", "|------|--------|-----|");
|
|
2207
|
+
for (const r of heaviest) lines.push(`| ${r.size} | ${r.format} | ${r.url} |`);
|
|
2208
|
+
}
|
|
2209
|
+
return lines.join("\n");
|
|
2210
|
+
}
|
|
2211
|
+
|
|
2078
2212
|
// src/mcp/mcp-response-formatter.ts
|
|
2079
2213
|
var reportSavingEnabled = true;
|
|
2080
2214
|
function sanitizeVendorText(text) {
|
|
@@ -2110,7 +2244,7 @@ var BULK_URL_THRESHOLD = 500;
|
|
|
2110
2244
|
function reportSavingActive() {
|
|
2111
2245
|
return reportSavingEnabled && process.env.MCP_SCRAPER_SAVE_REPORTS !== "false";
|
|
2112
2246
|
}
|
|
2113
|
-
function saveBulkSite(siteUrl, pages, seo) {
|
|
2247
|
+
function saveBulkSite(siteUrl, pages, seo, imageAudit) {
|
|
2114
2248
|
if (!reportSavingActive()) return null;
|
|
2115
2249
|
try {
|
|
2116
2250
|
const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
@@ -2133,15 +2267,32 @@ function saveBulkSite(siteUrl, pages, seo) {
|
|
|
2133
2267
|
(0, import_node_fs3.writeFileSync)((0, import_node_path4.join)(pagesDir, fname), content, "utf8");
|
|
2134
2268
|
return `| ${i + 1} | ${cell(p.title ?? "Untitled")} | ${p.url} | pages/${fname} |`;
|
|
2135
2269
|
});
|
|
2270
|
+
const dataFilesSection = seo ? [
|
|
2271
|
+
`
|
|
2272
|
+
## Data files (in this folder)`,
|
|
2273
|
+
`- \`report.md\` \u2014 SEO issues summary (counts + example URLs)`,
|
|
2274
|
+
`- \`issues.json\` \u2014 every finding with the full list of offender URLs`,
|
|
2275
|
+
`- \`pages.jsonl\` \u2014 per-page SEO fields, one JSON object per page`,
|
|
2276
|
+
`- \`links.jsonl\` \u2014 internal/external link edges (anchor, rel, target status)`,
|
|
2277
|
+
`- \`link-metrics.jsonl\` \u2014 inlinks, crawl depth, orphan flags per page`,
|
|
2278
|
+
...imageAudit ? [
|
|
2279
|
+
`- \`images.jsonl\` \u2014 every image with byte size, format, over-100KB and legacy-format flags`,
|
|
2280
|
+
`- \`images-summary.json\` \u2014 image totals (count, total weight, over-100KB, legacy)`
|
|
2281
|
+
] : [],
|
|
2282
|
+
...seo.branding ? [`- \`branding.json\` \u2014 site logo, colors, fonts`] : []
|
|
2283
|
+
].join("\n") : "";
|
|
2136
2284
|
const index = [
|
|
2137
2285
|
`# Site Extract: ${siteUrl}`,
|
|
2138
|
-
`**${pages.length} pages**
|
|
2286
|
+
`**${pages.length} pages** crawled. Everything is in this folder.`,
|
|
2287
|
+
`- Page content: one Markdown file per page under \`pages/\` (listed in the table below).`,
|
|
2288
|
+
seo ? `- SEO crawl data: the data files listed below.` : "",
|
|
2289
|
+
dataFilesSection,
|
|
2139
2290
|
`
|
|
2140
2291
|
## Pages
|
|
2141
2292
|
| # | Title | URL | File |
|
|
2142
2293
|
|---|-------|-----|------|
|
|
2143
2294
|
${indexRows.join("\n")}`
|
|
2144
|
-
].join("\n");
|
|
2295
|
+
].filter(Boolean).join("\n");
|
|
2145
2296
|
const indexFile = (0, import_node_path4.join)(dir, "index.md");
|
|
2146
2297
|
(0, import_node_fs3.writeFileSync)(indexFile, index, "utf8");
|
|
2147
2298
|
let seoFiles;
|
|
@@ -2156,8 +2307,17 @@ ${indexRows.join("\n")}`
|
|
|
2156
2307
|
(0, import_node_fs3.writeFileSync)(linksJsonl, toJsonl(seo.edges), "utf8");
|
|
2157
2308
|
(0, import_node_fs3.writeFileSync)(metricsJsonl, toJsonl(seo.metrics), "utf8");
|
|
2158
2309
|
(0, import_node_fs3.writeFileSync)(issuesFile, JSON.stringify(seo.issues, null, 2), "utf8");
|
|
2159
|
-
(0, import_node_fs3.writeFileSync)(reportFile, seo.reportMd
|
|
2310
|
+
(0, import_node_fs3.writeFileSync)(reportFile, seo.reportMd + (imageAudit ? `
|
|
2311
|
+
|
|
2312
|
+
${renderImageSection(imageAudit)}` : ""), "utf8");
|
|
2160
2313
|
seoFiles = [pagesJsonl, linksJsonl, metricsJsonl, issuesFile, reportFile];
|
|
2314
|
+
if (imageAudit) {
|
|
2315
|
+
const imagesJsonl = (0, import_node_path4.join)(dir, "images.jsonl");
|
|
2316
|
+
const imagesSummary = (0, import_node_path4.join)(dir, "images-summary.json");
|
|
2317
|
+
(0, import_node_fs3.writeFileSync)(imagesJsonl, imageAudit.rows.map((r) => JSON.stringify(r)).join("\n"), "utf8");
|
|
2318
|
+
(0, import_node_fs3.writeFileSync)(imagesSummary, JSON.stringify(imageAudit.summary, null, 2), "utf8");
|
|
2319
|
+
seoFiles.push(imagesJsonl, imagesSummary);
|
|
2320
|
+
}
|
|
2161
2321
|
if (seo.branding) {
|
|
2162
2322
|
const brandingFile = (0, import_node_path4.join)(dir, "branding.json");
|
|
2163
2323
|
(0, import_node_fs3.writeFileSync)(brandingFile, JSON.stringify(seo.branding, null, 2), "utf8");
|
|
@@ -2632,24 +2792,23 @@ function formatExtractSite(raw, input) {
|
|
|
2632
2792
|
durationMs: d.durationMs ?? 0
|
|
2633
2793
|
};
|
|
2634
2794
|
if (pages.length > BULK_PAGE_THRESHOLD) {
|
|
2635
|
-
const seo = buildSeoExport(input.url, pages, d.branding);
|
|
2636
2795
|
const bulk = saveBulkSite(input.url, pages.map((p) => ({
|
|
2637
2796
|
url: String(p.url ?? ""),
|
|
2638
2797
|
title: p.title ?? null,
|
|
2639
2798
|
bodyMarkdown: p.bodyMarkdown ?? null,
|
|
2640
2799
|
metaDescription: p.metaDescription ?? null,
|
|
2641
2800
|
schemaTypes: schemaTypesOf(p)
|
|
2642
|
-
}))
|
|
2801
|
+
})));
|
|
2643
2802
|
const preview = pages.slice(0, BULK_PAGE_THRESHOLD).map(pageRow).join("\n");
|
|
2644
|
-
const seoLine = bulk?.seoFiles?.length ? `
|
|
2645
|
-
- **SEO data:** \`report.md\` (issues summary), \`issues.json\` (findings + offender URLs), \`pages.jsonl\` (per-page fields), \`links.jsonl\` (link edges), \`link-metrics.jsonl\` (inlinks / crawl depth / orphans)` : "";
|
|
2646
2803
|
const location = bulk ? `
|
|
2647
2804
|
## \u{1F4C1} Bulk scrape saved
|
|
2648
|
-
- **Folder:** \`${bulk.dir}\`
|
|
2649
|
-
- **
|
|
2650
|
-
- **
|
|
2805
|
+
- **Folder:** \`${bulk.dir}\` \u2190 all scraped page content is here
|
|
2806
|
+
- **Start here:** \`${bulk.indexFile}\` \u2014 lists every page and its file
|
|
2807
|
+
- **Page content:** ${bulk.fileCount} Markdown files under \`pages/\` (one per page)
|
|
2651
2808
|
|
|
2652
|
-
|
|
2809
|
+
The page content is NOT inlined here to keep the context window clear \u2014 it is saved to disk. Open \`index.md\`, then open the page file you need from \`pages/\`.
|
|
2810
|
+
|
|
2811
|
+
\u{1F4A1} Want the full technical SEO audit (headings, link graph, indexability, image sizes/formats, issues)? Run \`audit_site\` on this URL instead.` : `
|
|
2653
2812
|
## \u26A0\uFE0F Bulk scrape not saved
|
|
2654
2813
|
Report saving is disabled in this environment, so the ${pages.length} pages of content could not be written to disk and are omitted to protect the context window. Enable \`MCP_SCRAPER_SAVE_REPORTS\` to capture bulk crawls.`;
|
|
2655
2814
|
const full2 = [
|
|
@@ -2693,6 +2852,55 @@ ${body}` : "_(no content extracted)_"
|
|
|
2693
2852
|
${pageDetails}${tips}`;
|
|
2694
2853
|
return { ...oneBlock(full, diskReport), structuredContent };
|
|
2695
2854
|
}
|
|
2855
|
+
async function formatAuditSite(raw, input) {
|
|
2856
|
+
const parsed = parseData(raw);
|
|
2857
|
+
if ("error" in parsed) return { content: [{ type: "text", text: parsed.error }], isError: true };
|
|
2858
|
+
const d = parsed.data;
|
|
2859
|
+
const pages = d.pages ?? [];
|
|
2860
|
+
const schemaTypesOf = (p) => p.kpo?.type ?? (Array.isArray(p.schema) && p.schema.length ? [`${p.schema.length} block(s)`] : []);
|
|
2861
|
+
const seo = buildSeoExport(input.url, pages, d.branding);
|
|
2862
|
+
const imageAudit = await auditImages(pages, { concurrency: 12 });
|
|
2863
|
+
const bulk = saveBulkSite(input.url, pages.map((p) => ({
|
|
2864
|
+
url: String(p.url ?? ""),
|
|
2865
|
+
title: p.title ?? null,
|
|
2866
|
+
bodyMarkdown: p.bodyMarkdown ?? null,
|
|
2867
|
+
metaDescription: p.metaDescription ?? null,
|
|
2868
|
+
schemaTypes: schemaTypesOf(p)
|
|
2869
|
+
})), seo, imageAudit);
|
|
2870
|
+
const topIssues = Object.entries(seo.issues).sort((a, b) => b[1].count - a[1].count).slice(0, 8).map(([k, v]) => `- \`${k}\` \u2014 ${v.count}`).join("\n");
|
|
2871
|
+
const img = imageAudit.summary;
|
|
2872
|
+
const imgLine = `${img.unique} images \xB7 ${img.totalSize} total \xB7 ${img.over100kb} over 100 KB \xB7 ${img.legacyFormat} legacy format`;
|
|
2873
|
+
const durationLine = `**${pages.length} pages** \xB7 ${((d.durationMs ?? 0) / 1e3).toFixed(1)}s`;
|
|
2874
|
+
const structuredContent = {
|
|
2875
|
+
url: input.url,
|
|
2876
|
+
pageCount: pages.length,
|
|
2877
|
+
durationMs: d.durationMs ?? 0,
|
|
2878
|
+
bulkFolder: bulk?.dir ?? null,
|
|
2879
|
+
issues: Object.fromEntries(Object.entries(seo.issues).map(([k, v]) => [k, v.count])),
|
|
2880
|
+
images: { unique: img.unique, totalBytes: img.totalBytes, over100kb: img.over100kb, legacyFormat: img.legacyFormat }
|
|
2881
|
+
};
|
|
2882
|
+
const location = bulk ? `
|
|
2883
|
+
## \u{1F4C1} Technical audit saved
|
|
2884
|
+
- **Folder:** \`${bulk.dir}\` \u2190 full audit + page content here
|
|
2885
|
+
- **Start here:** \`${bulk.indexFile}\` \u2014 maps every file in the folder
|
|
2886
|
+
- **Data:** \`report.md\` (issues + image audit), \`issues.json\`, \`pages.jsonl\` (per-page fields), \`links.jsonl\`, \`link-metrics.jsonl\`, \`images.jsonl\`
|
|
2887
|
+
|
|
2888
|
+
Detail is saved to disk, not inlined. Open \`report.md\` for the audit, \`pages.jsonl\` for per-page fields (headings, canonical, indexability), \`images.jsonl\` for image sizes/formats.` : `
|
|
2889
|
+
## \u26A0\uFE0F Audit not saved
|
|
2890
|
+
Report saving is disabled in this environment. Enable \`MCP_SCRAPER_SAVE_REPORTS\` to capture the technical audit.`;
|
|
2891
|
+
const full = [
|
|
2892
|
+
`# Technical SEO Audit: ${input.url}`,
|
|
2893
|
+
durationLine,
|
|
2894
|
+
location,
|
|
2895
|
+
`
|
|
2896
|
+
## Top issues
|
|
2897
|
+
${topIssues || "_none found_"}`,
|
|
2898
|
+
`
|
|
2899
|
+
## Images
|
|
2900
|
+
${imgLine}`
|
|
2901
|
+
].join("\n");
|
|
2902
|
+
return { content: [{ type: "text", text: full }], structuredContent };
|
|
2903
|
+
}
|
|
2696
2904
|
function formatYoutubeHarvest(raw, input) {
|
|
2697
2905
|
const parsed = parseData(raw);
|
|
2698
2906
|
if ("error" in parsed) return { content: [{ type: "text", text: parsed.error }], isError: true };
|
|
@@ -3932,12 +4140,18 @@ var MapSiteUrlsInputSchema = {
|
|
|
3932
4140
|
maxUrls: import_zod3.z.number().int().min(1).max(1e4).optional().describe("Maximum URLs to discover. Use 100 for normal maps, up to 10000 for a full inventory. Large maps (over 500 URLs) write the complete inventory to a local file and return only a summary plus the file path instead of the full list inline.")
|
|
3933
4141
|
};
|
|
3934
4142
|
var ExtractSiteInputSchema = {
|
|
3935
|
-
url: import_zod3.z.string().url().describe("Public website URL or domain to
|
|
4143
|
+
url: import_zod3.z.string().url().describe("Public website URL or domain to crawl for page CONTENT across multiple pages (map + scrape). Use when the user wants the content/text/markdown of a site's pages. For a technical SEO audit (issues, link graph, indexability, headings, image weights) use audit_site instead \u2014 extract_site returns content only, not analysis."),
|
|
3936
4144
|
maxPages: import_zod3.z.number().int().min(1).max(1e4).optional().describe("Maximum pages to extract. Use 50 for a normal crawl, up to 10000 for a full-site bulk scrape. Bulk crawls (over 25 pages) switch to folder mode: every page is saved as its own Markdown file in a local folder and the response returns only a summary plus the folder path, so the full content never floods the context window."),
|
|
3937
4145
|
rotateProxies: import_zod3.z.boolean().optional().describe("Route page fetches through rotating residential proxies in headful browsers to defeat rate-limiting and bot blocks (403/429). Discovers URLs from the sitemap, fetches in batches with a fresh proxy per batch, retries failures on a new proxy, and automatically parallelizes across the account's concurrency slots. Slower and pricier than the default fetch path, so use only when a site blocks normal crawling."),
|
|
3938
4146
|
rotateProxyEvery: import_zod3.z.number().int().min(1).max(100).optional().describe("When rotateProxies is on, how many pages to fetch per browser/proxy before discarding it and minting a fresh one. Default 30. Lower values rotate IPs more aggressively against strict rate limits."),
|
|
3939
4147
|
formats: import_zod3.z.array(import_zod3.z.enum(["markdown", "links", "json", "images", "branding"])).optional().describe("Which data formats to include in the per-page output. markdown=page content as Markdown, links=internal/external link graph, json=structured data/schema, images=per-page image URLs (links only, no downloads), branding=site-level logo/colors/fonts captured once from the homepage (requires a browser, adds time). markdown, links, json, and images are always captured cheaply from the HTML; branding is the only opt-in capture. Defaults to markdown+links when omitted.")
|
|
3940
4148
|
};
|
|
4149
|
+
var AuditSiteInputSchema = {
|
|
4150
|
+
url: import_zod3.z.string().url().describe("Public website URL or domain to run a full technical SEO audit on. Use when the user asks for a technical audit, SEO audit, site health check, or a Screaming-Frog-style crawl \u2014 i.e. they want ANALYSIS (issues, internal link graph, indexability, heading breakdown, image sizes/formats), not just page content. For plain content scraping use extract_site instead."),
|
|
4151
|
+
maxPages: import_zod3.z.number().int().min(1).max(1e4).optional().describe("Maximum pages to crawl and audit. Use 50 for a normal audit, up to 10000 for a full-site audit. The audit always writes a folder of analysis files (report.md, issues.json, pages.jsonl, links.jsonl, link-metrics.jsonl, images.jsonl) plus per-page content, and returns a headline summary plus the folder path."),
|
|
4152
|
+
rotateProxies: import_zod3.z.boolean().optional().describe("Route page fetches through rotating residential proxies to defeat rate-limiting and bot blocks (403/429). Slower and pricier than the default fetch path, so use only when a site blocks normal crawling."),
|
|
4153
|
+
rotateProxyEvery: import_zod3.z.number().int().min(1).max(100).optional().describe("When rotateProxies is on, how many pages to fetch per browser/proxy before discarding it and minting a fresh one. Default 30.")
|
|
4154
|
+
};
|
|
3941
4155
|
var YoutubeHarvestInputSchema = {
|
|
3942
4156
|
mode: import_zod3.z.enum(["search", "channel"]).describe("Use search for topic/keyword requests. Use channel when the user provides @handle, channel ID, or channel URL."),
|
|
3943
4157
|
query: import_zod3.z.string().optional().describe("Required when mode is search. The YouTube search topic in the user\u2019s words."),
|
|
@@ -4238,6 +4452,19 @@ var ExtractSiteOutputSchema = {
|
|
|
4238
4452
|
})),
|
|
4239
4453
|
durationMs: import_zod3.z.number().min(0)
|
|
4240
4454
|
};
|
|
4455
|
+
var AuditSiteOutputSchema = {
|
|
4456
|
+
url: import_zod3.z.string(),
|
|
4457
|
+
pageCount: import_zod3.z.number().int().min(0),
|
|
4458
|
+
durationMs: import_zod3.z.number().min(0),
|
|
4459
|
+
bulkFolder: import_zod3.z.string().nullable(),
|
|
4460
|
+
issues: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.number()),
|
|
4461
|
+
images: import_zod3.z.object({
|
|
4462
|
+
unique: import_zod3.z.number().int().min(0),
|
|
4463
|
+
totalBytes: import_zod3.z.number().min(0),
|
|
4464
|
+
over100kb: import_zod3.z.number().int().min(0),
|
|
4465
|
+
legacyFormat: import_zod3.z.number().int().min(0)
|
|
4466
|
+
})
|
|
4467
|
+
};
|
|
4241
4468
|
var MapsPlaceIntelOutputSchema = {
|
|
4242
4469
|
name: import_zod3.z.string(),
|
|
4243
4470
|
rating: NullableString2,
|
|
@@ -5074,12 +5301,19 @@ function registerPaaExtractorMcpTools(server2, executor, options = {}) {
|
|
|
5074
5301
|
annotations: liveWebToolAnnotations("Site URL Map")
|
|
5075
5302
|
}, async (input) => formatMapSiteUrls(await executor.mapSiteUrls(input), input));
|
|
5076
5303
|
server2.registerTool("extract_site", {
|
|
5077
|
-
title: "Multi-Page Site
|
|
5078
|
-
description: withReportNote("
|
|
5304
|
+
title: "Multi-Page Site Content Crawl",
|
|
5305
|
+
description: withReportNote("Crawl a public website and return the page CONTENT across multiple pages (map + scrape). Returns per-page titles and Markdown content. Supports up to maxPages=10000; bulk crawls over 25 pages switch to folder mode: each page is saved as its own Markdown file in a local folder and the response returns a summary plus the folder path instead of inlining all content. This tool returns content only \u2014 for a technical SEO audit (issues, internal link graph, indexability, heading breakdown, image sizes/formats) use audit_site. Use map_site_urls first when URL selection matters; use extract_url for one page."),
|
|
5079
5306
|
inputSchema: ExtractSiteInputSchema,
|
|
5080
5307
|
outputSchema: ExtractSiteOutputSchema,
|
|
5081
|
-
annotations: liveWebToolAnnotations("Multi-Page Site
|
|
5308
|
+
annotations: liveWebToolAnnotations("Multi-Page Site Content Crawl")
|
|
5082
5309
|
}, async (input) => formatExtractSite(await executor.extractSite(input), input));
|
|
5310
|
+
server2.registerTool("audit_site", {
|
|
5311
|
+
title: "Technical SEO Audit",
|
|
5312
|
+
description: withReportNote("Run a full technical SEO audit (Screaming-Frog-style) on a public website. Crawls up to maxPages and produces a complete on-page + crawl analysis: per-page title/meta lengths, heading breakdown, indexability and canonical status, schema, an internal link graph with inlinks/orphans/crawl-depth, an issues report, and an image audit (byte size, format, over-100KB and legacy-format flags). Writes everything to a local folder (report.md, issues.json, pages.jsonl, links.jsonl, link-metrics.jsonl, images.jsonl) plus per-page content, and returns a headline summary plus the folder path. Use this when the user wants an audit or analysis; use extract_site when they just want page content."),
|
|
5313
|
+
inputSchema: AuditSiteInputSchema,
|
|
5314
|
+
outputSchema: AuditSiteOutputSchema,
|
|
5315
|
+
annotations: liveWebToolAnnotations("Technical SEO Audit")
|
|
5316
|
+
}, async (input) => formatAuditSite(await executor.auditSite(input), input));
|
|
5083
5317
|
server2.registerTool("youtube_harvest", {
|
|
5084
5318
|
title: "YouTube Video Harvest",
|
|
5085
5319
|
description: withReportNote('Harvest YouTube video metadata when the user wants to find videos by topic, inspect a channel library, compare video angles, or get videoIds for later transcription. Use mode "search" for keyword/topic requests and mode "channel" for @handles, channel IDs, or channel URLs. Returns titles, views, durations, URLs, and videoIds for follow-up transcription. Use youtube_transcribe after selecting one video.'),
|
|
@@ -5273,9 +5507,9 @@ function renderInstallTerminal(options) {
|
|
|
5273
5507
|
"1/1 install surfaces ready",
|
|
5274
5508
|
colorize("Newest: saved hosted browser profiles for AI visibility. Share the watch_url, user signs in, then verify with browser_profile_status. Browser sessions are direct/no-proxy by default.", "lime", color),
|
|
5275
5509
|
"",
|
|
5276
|
-
`${colorize("Tools", "cyan", color)} ${colorize("(
|
|
5510
|
+
`${colorize("Tools", "cyan", color)} ${colorize("(45 MCP tools)", "muted", color)}`,
|
|
5277
5511
|
toolRow("search", ["harvest_paa", "search_serp", "maps_search", "maps_place_intel"], color),
|
|
5278
|
-
toolRow("extract", ["extract_url", "map_site_urls", "extract_site", "directory_workflow"], color),
|
|
5512
|
+
toolRow("extract", ["extract_url", "map_site_urls", "extract_site", "audit_site", "directory_workflow"], color),
|
|
5279
5513
|
toolRow("build", ["rank_tracker_workflow", "cron plan", "database prompt"], color),
|
|
5280
5514
|
toolRow("media", ["youtube_harvest", "youtube_transcribe", "facebook_ad_search", "facebook_page_intel", "facebook_ad_transcribe", "facebook_video_transcribe", "instagram_profile_content", "instagram_media_download"], color),
|
|
5281
5515
|
toolRow("browser", ["browser_open", "browser_profile_onboard", "browser_profile_status", "browser_close", "browser_screenshot", "browser_read", "browser_locate", "browser_replay_mark", "browser_replay_annotate"], color),
|