mcp-scraper 0.3.15 → 0.3.17
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 +420 -25
- 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 +371 -20
- 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 +369 -18
- package/dist/bin/mcp-stdio-server.cjs.map +1 -1
- package/dist/bin/mcp-stdio-server.js +2 -2
- package/dist/{chunk-7Y6JDBML.js → chunk-ACIUCZ27.js} +3 -3
- package/dist/chunk-ACIUCZ27.js.map +1 -0
- package/dist/{chunk-WQAIOY2D.js → chunk-N33YEY6W.js} +374 -19
- package/dist/chunk-N33YEY6W.js.map +1 -0
- package/dist/chunk-PVWWY5NV.js +7 -0
- package/dist/chunk-PVWWY5NV.js.map +1 -0
- package/dist/{chunk-WJ2LWHPA.js → chunk-UFD7N36R.js} +2 -2
- package/dist/{server-UOQ2JIUQ.js → server-TKWY47JA.js} +43 -10
- package/dist/server-TKWY47JA.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-UFD7N36R.js.map} +0 -0
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import {
|
|
3
3
|
HttpMcpToolExecutor,
|
|
4
4
|
buildPaaExtractorMcpServer
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-N33YEY6W.js";
|
|
6
6
|
import "../chunk-M2S27J6Z.js";
|
|
7
7
|
import "../chunk-WN7PBKMV.js";
|
|
8
8
|
import "../chunk-LFATOGDF.js";
|
|
9
|
-
import "../chunk-
|
|
9
|
+
import "../chunk-PVWWY5NV.js";
|
|
10
10
|
|
|
11
11
|
// bin/mcp-stdio-server.ts
|
|
12
12
|
import { readFileSync } from "fs";
|
|
@@ -50,9 +50,9 @@ function renderInstallTerminal(options) {
|
|
|
50
50
|
"1/1 install surfaces ready",
|
|
51
51
|
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),
|
|
52
52
|
"",
|
|
53
|
-
`${colorize("Tools", "cyan", color)} ${colorize("(
|
|
53
|
+
`${colorize("Tools", "cyan", color)} ${colorize("(45 MCP tools)", "muted", color)}`,
|
|
54
54
|
toolRow("search", ["harvest_paa", "search_serp", "maps_search", "maps_place_intel"], color),
|
|
55
|
-
toolRow("extract", ["extract_url", "map_site_urls", "extract_site", "directory_workflow"], color),
|
|
55
|
+
toolRow("extract", ["extract_url", "map_site_urls", "extract_site", "audit_site", "directory_workflow"], color),
|
|
56
56
|
toolRow("build", ["rank_tracker_workflow", "cron plan", "database prompt"], color),
|
|
57
57
|
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),
|
|
58
58
|
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),
|
|
@@ -100,4 +100,4 @@ function renderInstallTerminal(options) {
|
|
|
100
100
|
export {
|
|
101
101
|
renderInstallTerminal
|
|
102
102
|
};
|
|
103
|
-
//# sourceMappingURL=chunk-
|
|
103
|
+
//# sourceMappingURL=chunk-ACIUCZ27.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/install-terminal.ts"],"sourcesContent":["export interface InstallTerminalOptions {\n color?: boolean\n version: string\n apiKeyConfigured?: boolean\n}\n\ntype Tone = 'cyan' | 'lime' | 'amber' | 'red' | 'muted' | 'bold'\n\nconst CODES: Record<Tone | 'reset', string> = {\n reset: '\\x1b[0m',\n cyan: '\\x1b[36m',\n lime: '\\x1b[32m',\n amber: '\\x1b[33m',\n red: '\\x1b[31m',\n muted: '\\x1b[90m',\n bold: '\\x1b[1m',\n}\n\nfunction colorize(value: string, tone: Tone, enabled: boolean): string {\n if (!enabled) return value\n return `${CODES[tone]}${value}${CODES.reset}`\n}\n\nfunction toolRow(label: string, tools: string[], enabled: boolean): string {\n const padded = label.padEnd(9, ' ')\n return ` ${colorize(padded, 'muted', enabled)} ${tools.join(colorize(' . ', 'muted', enabled))}`\n}\n\nexport function renderInstallTerminal(options: InstallTerminalOptions): string {\n const color = options.color ?? true\n const apiKeyValue = options.apiKeyConfigured ? '$MCP_SCRAPER_API_KEY' : 'sk_live_your_key'\n const ascii = String.raw`\n __ __ ____ ____ \n| \\/ |/ ___| _ \\\n| |\\/| | | | |_) |\n| | | | |___| __/\n|_| |_|\\____|_|\n\n ____ ____ ____ _ ____ _____ ____\n/ ___| / ___| _ \\ / \\ | _ \\| ____| _ \\\n\\___ \\| | | |_) | / _ \\ | |_) | _| | |_) |\n ___) | |___| _ < / ___ \\| __/| |___| _ <\n|____/ \\____|_| \\_\\/_/ \\_\\_| |_____|_| \\_\\\n`\n\n const claudeCommand = [\n `MCP_SCRAPER_API_KEY=${apiKeyValue} npx -y -p mcp-scraper@latest \\\\`,\n ' mcp-scraper-cli agent install claude --apply',\n ].join('\\n')\n\n const codexConfig = [\n '[mcp_servers.mcp-scraper]',\n 'command = \"npx\"',\n 'args = [\"-y\", \"-p\", \"mcp-scraper@latest\", \"mcp-scraper-combined\"]',\n `env = { MCP_SCRAPER_API_KEY = \"${apiKeyValue}\" }`,\n ].join('\\n')\n\n return [\n colorize(`mcp-scraper v${options.version}`, 'bold', color),\n colorize('> mcp-scraper-install', 'muted', color),\n colorize(ascii, 'amber', color),\n `${colorize('MCP Scraper Agent', 'cyan', color)} . v${options.version} . mcpscraper.dev`,\n '1/1 install surfaces ready',\n 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),\n '',\n `${colorize('Tools', 'cyan', color)} ${colorize('(45 MCP tools)', 'muted', color)}`,\n toolRow('search', ['harvest_paa', 'search_serp', 'maps_search', 'maps_place_intel'], color),\n toolRow('extract', ['extract_url', 'map_site_urls', 'extract_site', 'audit_site', 'directory_workflow'], color),\n toolRow('build', ['rank_tracker_workflow', 'cron plan', 'database prompt'], color),\n 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),\n 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),\n toolRow('account', ['credits_info', 'reports', 'MCP resources'], color),\n `${colorize('Workflows', 'cyan', color)} ${colorize('(MCP + CLI + API)', 'muted', color)}`,\n toolRow('route', ['workflow_list', 'workflow_suggest', 'workflow_run', 'workflow_step', 'workflow_status', 'workflow_artifact_read'], color),\n toolRow('seo', ['directory', 'agent-packet', 'competitive audit', 'map/serp comparison', 'PAA/AIO briefs', 'scheduled runs'], color),\n '',\n colorize('Usage tips:', 'amber', color),\n 'Run mcp-scraper-install for this visible card. Run mcp-scraper-cli for setup utilities and subcommands.',\n 'Run mcp-scraper-combined in a human terminal to print this card; MCP clients get the same command as a silent stdio server.',\n 'Explicit card command: npx -y -p mcp-scraper@latest mcp-scraper-install',\n 'Customer auth setup: run browser_profile_onboard, send the watch_url, let the user sign in, then call browser_profile_status until AUTHENTICATED.',\n 'Reconnect setup: if a saved profile shows login controls later, run browser_profile_onboard again with the same profile name.',\n 'Start with workflow_suggest for broad jobs like market analysis, ICP research, CRO audits, brand briefs, content gaps, and AI visibility.',\n 'For MCP clients, use mcp-scraper-combined so one install can mix SERP, Maps, browser, reports, and saved MCP resources.',\n 'If you hit the concurrency limit, add an extra slot for $5/month with mcp-scraper-cli billing concurrency checkout.',\n '',\n `${colorize('Ready.', 'lime', color)} Install the combined MCP server with one command:`,\n '',\n colorize('Setup doctor', 'amber', color),\n 'npx -y -p mcp-scraper@latest mcp-scraper-cli doctor',\n '',\n colorize('Hosted profile setup', 'amber', color),\n 'In your MCP client, call browser_profile_onboard with email=\"seo@example.com\" and domain=\"chatgpt.com\".',\n 'Give the returned watch_url to the user. After they sign in, call browser_profile_status, then browser_open with the returned profile.',\n '',\n colorize('Claude Code one-command setup', 'amber', color),\n claudeCommand,\n 'Then fully exit Claude Code and open a new Claude terminal. Check with: claude mcp list',\n '',\n colorize('Codex config', 'amber', color),\n codexConfig,\n '',\n colorize('Claude Desktop Extension', 'amber', color),\n 'Download: https://mcpscraper.dev/downloads/mcp-scraper.mcpb',\n '',\n colorize('Safety note:', 'muted', color),\n 'mcp-scraper-combined prints this card only when stdin/stdout are an interactive TTY. In MCP clients it writes only JSON-RPC to stdout.',\n 'Use --stdio or MCP_SCRAPER_FORCE_STDIO=1 to force server mode from a terminal.',\n '',\n ].join('\\n')\n}\n"],"mappings":"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","names":[]}
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from "./chunk-LFATOGDF.js";
|
|
12
12
|
import {
|
|
13
13
|
PACKAGE_VERSION
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-PVWWY5NV.js";
|
|
15
15
|
|
|
16
16
|
// src/harvest-timeout.ts
|
|
17
17
|
var VERCEL_FUNCTION_MAX_MS = 3e5;
|
|
@@ -256,6 +256,99 @@ function buildLinkGraph(pages, startUrl) {
|
|
|
256
256
|
return { edges, metrics };
|
|
257
257
|
}
|
|
258
258
|
|
|
259
|
+
// src/api/seo-link-report.ts
|
|
260
|
+
function registrableDomain(host) {
|
|
261
|
+
const h = host.replace(/^www\./, "").toLowerCase();
|
|
262
|
+
const parts = h.split(".");
|
|
263
|
+
return parts.length <= 2 ? h : parts.slice(-2).join(".");
|
|
264
|
+
}
|
|
265
|
+
function buildLinkReport(edges, metrics, siteUrl) {
|
|
266
|
+
let siteReg = "";
|
|
267
|
+
try {
|
|
268
|
+
siteReg = registrableDomain(new URL(siteUrl).hostname);
|
|
269
|
+
} catch {
|
|
270
|
+
siteReg = "";
|
|
271
|
+
}
|
|
272
|
+
const internalEdges = edges.filter((e) => e.internal);
|
|
273
|
+
const pages = metrics.length;
|
|
274
|
+
const orphans = metrics.filter((m) => m.orphan).length;
|
|
275
|
+
const brokenInternal = internalEdges.filter((e) => e.targetStatus != null && e.targetStatus >= 400).length;
|
|
276
|
+
const sumInlinks = metrics.reduce((a, m) => a + m.inlinks, 0);
|
|
277
|
+
const sumOutlinks = metrics.reduce((a, m) => a + m.outlinksInternal + m.outlinksExternal, 0);
|
|
278
|
+
const distribution = { zero: 0, oneToTwo: 0, threeToTen: 0, elevenPlus: 0 };
|
|
279
|
+
for (const m of metrics) {
|
|
280
|
+
if (m.inlinks === 0) distribution.zero++;
|
|
281
|
+
else if (m.inlinks <= 2) distribution.oneToTwo++;
|
|
282
|
+
else if (m.inlinks <= 10) distribution.threeToTen++;
|
|
283
|
+
else distribution.elevenPlus++;
|
|
284
|
+
}
|
|
285
|
+
const topByInlinks = [...metrics].sort((a, b) => b.inlinks - a.inlinks).slice(0, 20).map((m) => ({ url: m.url, inlinks: m.inlinks, outlinksInternal: m.outlinksInternal, outlinksExternal: m.outlinksExternal }));
|
|
286
|
+
const domMap = /* @__PURE__ */ new Map();
|
|
287
|
+
let externalTotal = 0;
|
|
288
|
+
for (const e of edges) {
|
|
289
|
+
let domain;
|
|
290
|
+
try {
|
|
291
|
+
domain = registrableDomain(new URL(e.to).hostname);
|
|
292
|
+
} catch {
|
|
293
|
+
continue;
|
|
294
|
+
}
|
|
295
|
+
if (!domain || domain === siteReg) continue;
|
|
296
|
+
externalTotal++;
|
|
297
|
+
const d = domMap.get(domain) ?? { links: 0, nofollow: 0, pages: /* @__PURE__ */ new Set() };
|
|
298
|
+
d.links++;
|
|
299
|
+
if (e.nofollow) d.nofollow++;
|
|
300
|
+
d.pages.add(e.from);
|
|
301
|
+
domMap.set(domain, d);
|
|
302
|
+
}
|
|
303
|
+
const externalDomains = [...domMap.entries()].map(([domain, d]) => ({ domain, links: d.links, nofollow: d.nofollow, pages: d.pages.size })).sort((a, b) => b.links - a.links);
|
|
304
|
+
const round = (n) => Math.round(n * 10) / 10;
|
|
305
|
+
return {
|
|
306
|
+
summary: {
|
|
307
|
+
internal: {
|
|
308
|
+
totalLinks: internalEdges.length,
|
|
309
|
+
pages,
|
|
310
|
+
orphans,
|
|
311
|
+
brokenInternal,
|
|
312
|
+
avgInlinks: pages ? round(sumInlinks / pages) : 0,
|
|
313
|
+
avgOutlinks: pages ? round(sumOutlinks / pages) : 0,
|
|
314
|
+
distribution,
|
|
315
|
+
topByInlinks
|
|
316
|
+
},
|
|
317
|
+
external: {
|
|
318
|
+
totalLinks: externalTotal,
|
|
319
|
+
uniqueDomains: externalDomains.length,
|
|
320
|
+
topDomains: externalDomains.slice(0, 20)
|
|
321
|
+
}
|
|
322
|
+
},
|
|
323
|
+
externalDomains
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
function renderLinkReport(r) {
|
|
327
|
+
const s = r.summary;
|
|
328
|
+
const lines = [
|
|
329
|
+
`## Link analysis`,
|
|
330
|
+
`**Internal:** ${s.internal.totalLinks} links \xB7 ${s.internal.pages} pages \xB7 avg ${s.internal.avgInlinks} inlinks/page \xB7 ${s.internal.orphans} orphans \xB7 ${s.internal.brokenInternal} broken`,
|
|
331
|
+
`**External:** ${s.external.totalLinks} links to ${s.external.uniqueDomains} domains`,
|
|
332
|
+
``,
|
|
333
|
+
`### Inlink distribution`,
|
|
334
|
+
`- 0 inlinks (orphans): ${s.internal.distribution.zero}`,
|
|
335
|
+
`- 1\u20132: ${s.internal.distribution.oneToTwo}`,
|
|
336
|
+
`- 3\u201310: ${s.internal.distribution.threeToTen}`,
|
|
337
|
+
`- 11+: ${s.internal.distribution.elevenPlus}`,
|
|
338
|
+
``,
|
|
339
|
+
`### Top 20 internal pages by inlinks`,
|
|
340
|
+
`| inlinks | out (int/ext) | URL |`,
|
|
341
|
+
`|---|---|---|`,
|
|
342
|
+
...s.internal.topByInlinks.map((p) => `| ${p.inlinks} | ${p.outlinksInternal}/${p.outlinksExternal} | ${p.url} |`),
|
|
343
|
+
``,
|
|
344
|
+
`### Top 20 external domains by links`,
|
|
345
|
+
`| links | nofollow | from pages | domain |`,
|
|
346
|
+
`|---|---|---|---|`,
|
|
347
|
+
...s.external.topDomains.map((d) => `| ${d.links} | ${d.nofollow} | ${d.pages} | ${d.domain} |`)
|
|
348
|
+
];
|
|
349
|
+
return lines.join("\n");
|
|
350
|
+
}
|
|
351
|
+
|
|
259
352
|
// src/api/seo-issues.ts
|
|
260
353
|
var THIN_WORDS = 200;
|
|
261
354
|
var TITLE_MAX = 60;
|
|
@@ -364,6 +457,137 @@ _Thresholds: title ${TITLE_MAX}ch/${TITLE_PX_MAX}px, meta ${META_MAX}ch, H1 ${H1
|
|
|
364
457
|
].join("\n");
|
|
365
458
|
}
|
|
366
459
|
|
|
460
|
+
// src/api/image-audit.ts
|
|
461
|
+
var OVER_BYTES = 100 * 1024;
|
|
462
|
+
var MODERN = /* @__PURE__ */ new Set(["webp", "avif", "svg", "svg+xml"]);
|
|
463
|
+
function formatBytes(n) {
|
|
464
|
+
if (n == null) return null;
|
|
465
|
+
if (n < 1024) return `${n} B`;
|
|
466
|
+
if (n < 1024 * 1024) return `${(n / 1024).toFixed(1)} KB`;
|
|
467
|
+
return `${(n / (1024 * 1024)).toFixed(2)} MB`;
|
|
468
|
+
}
|
|
469
|
+
var decodeEntities = (u) => u.replace(/&/g, "&").replace(/�?38;/g, "&").replace(/&/gi, "&").trim();
|
|
470
|
+
var dedupKey = (u) => u.replace(/^https?:\/\//i, "//").replace(/\/$/, "");
|
|
471
|
+
var formatOf = (ct, url) => {
|
|
472
|
+
if (ct) {
|
|
473
|
+
const m = ct.split(";")[0].trim().toLowerCase();
|
|
474
|
+
if (m.startsWith("image/")) return m.replace("image/", "");
|
|
475
|
+
}
|
|
476
|
+
return (url.split("?")[0].match(/\.([a-z0-9]+)$/i)?.[1] || "unknown").toLowerCase();
|
|
477
|
+
};
|
|
478
|
+
function collectUrls(pages) {
|
|
479
|
+
const byKey = /* @__PURE__ */ new Map();
|
|
480
|
+
for (const p of pages) for (const raw of p.imageLinks || []) {
|
|
481
|
+
const u = decodeEntities(raw);
|
|
482
|
+
if (!/^https?:\/\//i.test(u)) continue;
|
|
483
|
+
if (/[{}]|%7[bd]/i.test(u)) continue;
|
|
484
|
+
const k = dedupKey(u);
|
|
485
|
+
const prev = byKey.get(k);
|
|
486
|
+
if (!prev || /^https:/i.test(u) && /^http:/i.test(prev)) byKey.set(k, u);
|
|
487
|
+
}
|
|
488
|
+
return [...byKey.values()];
|
|
489
|
+
}
|
|
490
|
+
async function sizeAndType(url, timeoutMs) {
|
|
491
|
+
const ctrl = new AbortController();
|
|
492
|
+
const t = setTimeout(() => ctrl.abort(), timeoutMs);
|
|
493
|
+
const read = (res) => ({
|
|
494
|
+
len: res.headers.get("content-length"),
|
|
495
|
+
cr: res.headers.get("content-range"),
|
|
496
|
+
ct: res.headers.get("content-type"),
|
|
497
|
+
status: res.status
|
|
498
|
+
});
|
|
499
|
+
try {
|
|
500
|
+
let bytes = null;
|
|
501
|
+
let ct = null;
|
|
502
|
+
let status = null;
|
|
503
|
+
try {
|
|
504
|
+
const h = read(await fetch(url, { method: "HEAD", redirect: "follow", signal: ctrl.signal }));
|
|
505
|
+
status = h.status;
|
|
506
|
+
ct = h.ct;
|
|
507
|
+
if (h.len) bytes = Number(h.len);
|
|
508
|
+
} catch {
|
|
509
|
+
}
|
|
510
|
+
if (bytes == null) {
|
|
511
|
+
const g = await fetch(url, { method: "GET", headers: { Range: "bytes=0-0" }, redirect: "follow", signal: ctrl.signal });
|
|
512
|
+
const r = read(g);
|
|
513
|
+
status = status ?? r.status;
|
|
514
|
+
ct = ct ?? r.ct;
|
|
515
|
+
if (r.cr && r.cr.includes("/")) {
|
|
516
|
+
const tail = r.cr.split("/")[1];
|
|
517
|
+
if (tail && tail !== "*") bytes = Number(tail);
|
|
518
|
+
} else if (r.len) bytes = Number(r.len);
|
|
519
|
+
try {
|
|
520
|
+
await g.body?.cancel();
|
|
521
|
+
} catch {
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
return { url, status, bytes: Number.isFinite(bytes) ? bytes : null, contentType: ct };
|
|
525
|
+
} catch (e) {
|
|
526
|
+
return { url, status: null, bytes: null, contentType: null, error: String(e.message || e) };
|
|
527
|
+
} finally {
|
|
528
|
+
clearTimeout(t);
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
async function pool(items, n, fn) {
|
|
532
|
+
const out = new Array(items.length);
|
|
533
|
+
let i = 0;
|
|
534
|
+
await Promise.all(Array.from({ length: Math.min(n, items.length) }, async () => {
|
|
535
|
+
while (i < items.length) {
|
|
536
|
+
const idx = i++;
|
|
537
|
+
out[idx] = await fn(items[idx]);
|
|
538
|
+
}
|
|
539
|
+
}));
|
|
540
|
+
return out;
|
|
541
|
+
}
|
|
542
|
+
async function auditImages(pages, opts = {}) {
|
|
543
|
+
const concurrency = opts.concurrency ?? 12;
|
|
544
|
+
const timeoutMs = opts.timeoutMs ?? 12e3;
|
|
545
|
+
const urls = collectUrls(pages).slice(0, opts.max ?? 5e3);
|
|
546
|
+
const heads = await pool(urls, concurrency, (u) => sizeAndType(u, timeoutMs));
|
|
547
|
+
const rows = heads.map((r) => {
|
|
548
|
+
const format = formatOf(r.contentType, r.url);
|
|
549
|
+
return {
|
|
550
|
+
...r,
|
|
551
|
+
size: formatBytes(r.bytes),
|
|
552
|
+
format,
|
|
553
|
+
over100kb: r.bytes != null && r.bytes > OVER_BYTES,
|
|
554
|
+
legacyFormat: format !== "unknown" && !MODERN.has(format)
|
|
555
|
+
};
|
|
556
|
+
});
|
|
557
|
+
const sized = rows.filter((r) => r.bytes != null);
|
|
558
|
+
const totalBytes = sized.reduce((a, r) => a + r.bytes, 0);
|
|
559
|
+
const formatCounts = {};
|
|
560
|
+
for (const r of rows) formatCounts[r.format] = (formatCounts[r.format] || 0) + 1;
|
|
561
|
+
return {
|
|
562
|
+
rows: rows.sort((a, b) => (b.bytes ?? 0) - (a.bytes ?? 0)),
|
|
563
|
+
summary: {
|
|
564
|
+
unique: rows.length,
|
|
565
|
+
sized: sized.length,
|
|
566
|
+
totalBytes,
|
|
567
|
+
totalSize: formatBytes(totalBytes) ?? "0 B",
|
|
568
|
+
avgSize: formatBytes(Math.round(totalBytes / (sized.length || 1))) ?? "0 B",
|
|
569
|
+
over100kb: rows.filter((r) => r.over100kb).length,
|
|
570
|
+
legacyFormat: rows.filter((r) => r.legacyFormat).length,
|
|
571
|
+
formatCounts
|
|
572
|
+
}
|
|
573
|
+
};
|
|
574
|
+
}
|
|
575
|
+
function renderImageSection(audit) {
|
|
576
|
+
const s = audit.summary;
|
|
577
|
+
const fmt = Object.entries(s.formatCounts).sort((a, b) => b[1] - a[1]).map(([k, v]) => `${k}:${v}`).join(" ");
|
|
578
|
+
const heaviest = audit.rows.filter((r) => r.over100kb).slice(0, 15);
|
|
579
|
+
const lines = [
|
|
580
|
+
`## Images`,
|
|
581
|
+
`**${s.unique} unique images** \xB7 ${s.totalSize} total \xB7 ${s.avgSize} avg \xB7 ${s.over100kb} over 100 KB \xB7 ${s.legacyFormat} legacy format`,
|
|
582
|
+
`Formats: ${fmt}`
|
|
583
|
+
];
|
|
584
|
+
if (heaviest.length) {
|
|
585
|
+
lines.push("", "| Size | Format | URL |", "|------|--------|-----|");
|
|
586
|
+
for (const r of heaviest) lines.push(`| ${r.size} | ${r.format} | ${r.url} |`);
|
|
587
|
+
}
|
|
588
|
+
return lines.join("\n");
|
|
589
|
+
}
|
|
590
|
+
|
|
367
591
|
// src/mcp/mcp-response-formatter.ts
|
|
368
592
|
var reportSavingEnabled = true;
|
|
369
593
|
function configureReportSaving(enabled) {
|
|
@@ -402,7 +626,7 @@ var BULK_URL_THRESHOLD = 500;
|
|
|
402
626
|
function reportSavingActive() {
|
|
403
627
|
return reportSavingEnabled && process.env.MCP_SCRAPER_SAVE_REPORTS !== "false";
|
|
404
628
|
}
|
|
405
|
-
function saveBulkSite(siteUrl, pages, seo) {
|
|
629
|
+
function saveBulkSite(siteUrl, pages, seo, imageAudit) {
|
|
406
630
|
if (!reportSavingActive()) return null;
|
|
407
631
|
try {
|
|
408
632
|
const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
@@ -425,15 +649,35 @@ function saveBulkSite(siteUrl, pages, seo) {
|
|
|
425
649
|
writeFileSync(join(pagesDir, fname), content, "utf8");
|
|
426
650
|
return `| ${i + 1} | ${cell(p.title ?? "Untitled")} | ${p.url} | pages/${fname} |`;
|
|
427
651
|
});
|
|
652
|
+
const dataFilesSection = seo ? [
|
|
653
|
+
`
|
|
654
|
+
## Data files (in this folder)`,
|
|
655
|
+
`- \`report.md\` \u2014 SEO issues summary (counts + example URLs)`,
|
|
656
|
+
`- \`issues.json\` \u2014 every finding with the full list of offender URLs`,
|
|
657
|
+
`- \`pages.jsonl\` \u2014 per-page SEO fields, one JSON object per page`,
|
|
658
|
+
`- \`links.jsonl\` \u2014 internal/external link edges (anchor, rel, target status)`,
|
|
659
|
+
`- \`link-metrics.jsonl\` \u2014 inlinks, crawl depth, orphan flags per page`,
|
|
660
|
+
`- \`link-report.md\` \u2014 link analysis: top internal pages by inlinks, top external domains, distribution`,
|
|
661
|
+
`- \`links-summary.json\` \u2014 link totals + top-20 internal pages + top-20 external domains`,
|
|
662
|
+
`- \`external-domains.json\` \u2014 every external domain linked to, ordered by link count`,
|
|
663
|
+
...imageAudit ? [
|
|
664
|
+
`- \`images.jsonl\` \u2014 every image with byte size, format, over-100KB and legacy-format flags`,
|
|
665
|
+
`- \`images-summary.json\` \u2014 image totals (count, total weight, over-100KB, legacy)`
|
|
666
|
+
] : [],
|
|
667
|
+
...seo.branding ? [`- \`branding.json\` \u2014 site logo, colors, fonts`] : []
|
|
668
|
+
].join("\n") : "";
|
|
428
669
|
const index = [
|
|
429
670
|
`# Site Extract: ${siteUrl}`,
|
|
430
|
-
`**${pages.length} pages**
|
|
671
|
+
`**${pages.length} pages** crawled. Everything is in this folder.`,
|
|
672
|
+
`- Page content: one Markdown file per page under \`pages/\` (listed in the table below).`,
|
|
673
|
+
seo ? `- SEO crawl data: the data files listed below.` : "",
|
|
674
|
+
dataFilesSection,
|
|
431
675
|
`
|
|
432
676
|
## Pages
|
|
433
677
|
| # | Title | URL | File |
|
|
434
678
|
|---|-------|-----|------|
|
|
435
679
|
${indexRows.join("\n")}`
|
|
436
|
-
].join("\n");
|
|
680
|
+
].filter(Boolean).join("\n");
|
|
437
681
|
const indexFile = join(dir, "index.md");
|
|
438
682
|
writeFileSync(indexFile, index, "utf8");
|
|
439
683
|
let seoFiles;
|
|
@@ -448,8 +692,23 @@ ${indexRows.join("\n")}`
|
|
|
448
692
|
writeFileSync(linksJsonl, toJsonl(seo.edges), "utf8");
|
|
449
693
|
writeFileSync(metricsJsonl, toJsonl(seo.metrics), "utf8");
|
|
450
694
|
writeFileSync(issuesFile, JSON.stringify(seo.issues, null, 2), "utf8");
|
|
451
|
-
writeFileSync(reportFile, seo.reportMd
|
|
452
|
-
|
|
695
|
+
writeFileSync(reportFile, seo.reportMd + (imageAudit ? `
|
|
696
|
+
|
|
697
|
+
${renderImageSection(imageAudit)}` : ""), "utf8");
|
|
698
|
+
const linkReportFile = join(dir, "link-report.md");
|
|
699
|
+
const linksSummaryFile = join(dir, "links-summary.json");
|
|
700
|
+
const externalDomainsFile = join(dir, "external-domains.json");
|
|
701
|
+
writeFileSync(linkReportFile, renderLinkReport(seo.linkReport), "utf8");
|
|
702
|
+
writeFileSync(linksSummaryFile, JSON.stringify(seo.linkReport.summary, null, 2), "utf8");
|
|
703
|
+
writeFileSync(externalDomainsFile, JSON.stringify(seo.linkReport.externalDomains, null, 2), "utf8");
|
|
704
|
+
seoFiles = [pagesJsonl, linksJsonl, metricsJsonl, issuesFile, reportFile, linkReportFile, linksSummaryFile, externalDomainsFile];
|
|
705
|
+
if (imageAudit) {
|
|
706
|
+
const imagesJsonl = join(dir, "images.jsonl");
|
|
707
|
+
const imagesSummary = join(dir, "images-summary.json");
|
|
708
|
+
writeFileSync(imagesJsonl, imageAudit.rows.map((r) => JSON.stringify(r)).join("\n"), "utf8");
|
|
709
|
+
writeFileSync(imagesSummary, JSON.stringify(imageAudit.summary, null, 2), "utf8");
|
|
710
|
+
seoFiles.push(imagesJsonl, imagesSummary);
|
|
711
|
+
}
|
|
453
712
|
if (seo.branding) {
|
|
454
713
|
const brandingFile = join(dir, "branding.json");
|
|
455
714
|
writeFileSync(brandingFile, JSON.stringify(seo.branding, null, 2), "utf8");
|
|
@@ -894,6 +1153,7 @@ function buildSeoExport(siteUrl, pages, branding) {
|
|
|
894
1153
|
metrics: [...metrics.values()],
|
|
895
1154
|
issues,
|
|
896
1155
|
reportMd: renderIssueReport(siteUrl, pages, issues, metrics),
|
|
1156
|
+
linkReport: buildLinkReport(edges, [...metrics.values()], siteUrl),
|
|
897
1157
|
branding: branding ?? void 0
|
|
898
1158
|
};
|
|
899
1159
|
}
|
|
@@ -924,24 +1184,23 @@ function formatExtractSite(raw, input) {
|
|
|
924
1184
|
durationMs: d.durationMs ?? 0
|
|
925
1185
|
};
|
|
926
1186
|
if (pages.length > BULK_PAGE_THRESHOLD) {
|
|
927
|
-
const seo = buildSeoExport(input.url, pages, d.branding);
|
|
928
1187
|
const bulk = saveBulkSite(input.url, pages.map((p) => ({
|
|
929
1188
|
url: String(p.url ?? ""),
|
|
930
1189
|
title: p.title ?? null,
|
|
931
1190
|
bodyMarkdown: p.bodyMarkdown ?? null,
|
|
932
1191
|
metaDescription: p.metaDescription ?? null,
|
|
933
1192
|
schemaTypes: schemaTypesOf(p)
|
|
934
|
-
}))
|
|
1193
|
+
})));
|
|
935
1194
|
const preview = pages.slice(0, BULK_PAGE_THRESHOLD).map(pageRow).join("\n");
|
|
936
|
-
const seoLine = bulk?.seoFiles?.length ? `
|
|
937
|
-
- **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)` : "";
|
|
938
1195
|
const location = bulk ? `
|
|
939
1196
|
## \u{1F4C1} Bulk scrape saved
|
|
940
|
-
- **Folder:** \`${bulk.dir}\`
|
|
941
|
-
- **
|
|
942
|
-
- **
|
|
1197
|
+
- **Folder:** \`${bulk.dir}\` \u2190 all scraped page content is here
|
|
1198
|
+
- **Start here:** \`${bulk.indexFile}\` \u2014 lists every page and its file
|
|
1199
|
+
- **Page content:** ${bulk.fileCount} Markdown files under \`pages/\` (one per page)
|
|
943
1200
|
|
|
944
|
-
|
|
1201
|
+
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/\`.
|
|
1202
|
+
|
|
1203
|
+
\u{1F4A1} Want the full technical SEO audit (headings, link graph, indexability, image sizes/formats, issues)? Run \`audit_site\` on this URL instead.` : `
|
|
945
1204
|
## \u26A0\uFE0F Bulk scrape not saved
|
|
946
1205
|
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.`;
|
|
947
1206
|
const full2 = [
|
|
@@ -985,6 +1244,62 @@ ${body}` : "_(no content extracted)_"
|
|
|
985
1244
|
${pageDetails}${tips}`;
|
|
986
1245
|
return { ...oneBlock(full, diskReport), structuredContent };
|
|
987
1246
|
}
|
|
1247
|
+
async function formatAuditSite(raw, input) {
|
|
1248
|
+
const parsed = parseData(raw);
|
|
1249
|
+
if ("error" in parsed) return { content: [{ type: "text", text: parsed.error }], isError: true };
|
|
1250
|
+
const d = parsed.data;
|
|
1251
|
+
const pages = d.pages ?? [];
|
|
1252
|
+
const schemaTypesOf = (p) => p.kpo?.type ?? (Array.isArray(p.schema) && p.schema.length ? [`${p.schema.length} block(s)`] : []);
|
|
1253
|
+
const seo = buildSeoExport(input.url, pages, d.branding);
|
|
1254
|
+
const imageAudit = await auditImages(pages, { concurrency: 12 });
|
|
1255
|
+
const bulk = saveBulkSite(input.url, pages.map((p) => ({
|
|
1256
|
+
url: String(p.url ?? ""),
|
|
1257
|
+
title: p.title ?? null,
|
|
1258
|
+
bodyMarkdown: p.bodyMarkdown ?? null,
|
|
1259
|
+
metaDescription: p.metaDescription ?? null,
|
|
1260
|
+
schemaTypes: schemaTypesOf(p)
|
|
1261
|
+
})), seo, imageAudit);
|
|
1262
|
+
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");
|
|
1263
|
+
const img = imageAudit.summary;
|
|
1264
|
+
const imgLine = `${img.unique} images \xB7 ${img.totalSize} total \xB7 ${img.over100kb} over 100 KB \xB7 ${img.legacyFormat} legacy format`;
|
|
1265
|
+
const lr = seo.linkReport.summary;
|
|
1266
|
+
const topExt = lr.external.topDomains.slice(0, 3).map((dm) => `${dm.domain} (${dm.links})`).join(", ") || "\u2014";
|
|
1267
|
+
const linkLine = `${lr.internal.totalLinks} internal / ${lr.external.totalLinks} external links \xB7 ${lr.internal.orphans} orphans \xB7 ${lr.internal.brokenInternal} broken \xB7 avg ${lr.internal.avgInlinks} inlinks/page \xB7 top external: ${topExt}`;
|
|
1268
|
+
const durationLine = `**${pages.length} pages** \xB7 ${((d.durationMs ?? 0) / 1e3).toFixed(1)}s`;
|
|
1269
|
+
const structuredContent = {
|
|
1270
|
+
url: input.url,
|
|
1271
|
+
pageCount: pages.length,
|
|
1272
|
+
durationMs: d.durationMs ?? 0,
|
|
1273
|
+
bulkFolder: bulk?.dir ?? null,
|
|
1274
|
+
issues: Object.fromEntries(Object.entries(seo.issues).map(([k, v]) => [k, v.count])),
|
|
1275
|
+
images: { unique: img.unique, totalBytes: img.totalBytes, over100kb: img.over100kb, legacyFormat: img.legacyFormat },
|
|
1276
|
+
links: { internal: lr.internal.totalLinks, external: lr.external.totalLinks, orphans: lr.internal.orphans, brokenInternal: lr.internal.brokenInternal, externalDomains: lr.external.uniqueDomains }
|
|
1277
|
+
};
|
|
1278
|
+
const location = bulk ? `
|
|
1279
|
+
## \u{1F4C1} Technical audit saved
|
|
1280
|
+
- **Folder:** \`${bulk.dir}\` \u2190 full audit + page content here
|
|
1281
|
+
- **Start here:** \`${bulk.indexFile}\` \u2014 maps every file in the folder
|
|
1282
|
+
- **Data:** \`report.md\` (issues + image audit), \`issues.json\`, \`pages.jsonl\` (per-page fields), \`links.jsonl\`, \`link-metrics.jsonl\`, \`images.jsonl\`
|
|
1283
|
+
|
|
1284
|
+
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.` : `
|
|
1285
|
+
## \u26A0\uFE0F Audit not saved
|
|
1286
|
+
Report saving is disabled in this environment. Enable \`MCP_SCRAPER_SAVE_REPORTS\` to capture the technical audit.`;
|
|
1287
|
+
const full = [
|
|
1288
|
+
`# Technical SEO Audit: ${input.url}`,
|
|
1289
|
+
durationLine,
|
|
1290
|
+
location,
|
|
1291
|
+
`
|
|
1292
|
+
## Top issues
|
|
1293
|
+
${topIssues || "_none found_"}`,
|
|
1294
|
+
`
|
|
1295
|
+
## Links
|
|
1296
|
+
${linkLine}`,
|
|
1297
|
+
`
|
|
1298
|
+
## Images
|
|
1299
|
+
${imgLine}`
|
|
1300
|
+
].join("\n");
|
|
1301
|
+
return { content: [{ type: "text", text: full }], structuredContent };
|
|
1302
|
+
}
|
|
988
1303
|
function formatYoutubeHarvest(raw, input) {
|
|
989
1304
|
const parsed = parseData(raw);
|
|
990
1305
|
if ("error" in parsed) return { content: [{ type: "text", text: parsed.error }], isError: true };
|
|
@@ -2187,12 +2502,18 @@ var MapSiteUrlsInputSchema = {
|
|
|
2187
2502
|
maxUrls: 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.")
|
|
2188
2503
|
};
|
|
2189
2504
|
var ExtractSiteInputSchema = {
|
|
2190
|
-
url: z.string().url().describe("Public website URL or domain to
|
|
2505
|
+
url: 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."),
|
|
2191
2506
|
maxPages: 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."),
|
|
2192
2507
|
rotateProxies: 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."),
|
|
2193
2508
|
rotateProxyEvery: 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."),
|
|
2194
2509
|
formats: z.array(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.")
|
|
2195
2510
|
};
|
|
2511
|
+
var AuditSiteInputSchema = {
|
|
2512
|
+
url: 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."),
|
|
2513
|
+
maxPages: 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."),
|
|
2514
|
+
rotateProxies: 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."),
|
|
2515
|
+
rotateProxyEvery: 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.")
|
|
2516
|
+
};
|
|
2196
2517
|
var YoutubeHarvestInputSchema = {
|
|
2197
2518
|
mode: z.enum(["search", "channel"]).describe("Use search for topic/keyword requests. Use channel when the user provides @handle, channel ID, or channel URL."),
|
|
2198
2519
|
query: z.string().optional().describe("Required when mode is search. The YouTube search topic in the user\u2019s words."),
|
|
@@ -2493,6 +2814,26 @@ var ExtractSiteOutputSchema = {
|
|
|
2493
2814
|
})),
|
|
2494
2815
|
durationMs: z.number().min(0)
|
|
2495
2816
|
};
|
|
2817
|
+
var AuditSiteOutputSchema = {
|
|
2818
|
+
url: z.string(),
|
|
2819
|
+
pageCount: z.number().int().min(0),
|
|
2820
|
+
durationMs: z.number().min(0),
|
|
2821
|
+
bulkFolder: z.string().nullable(),
|
|
2822
|
+
issues: z.record(z.string(), z.number()),
|
|
2823
|
+
images: z.object({
|
|
2824
|
+
unique: z.number().int().min(0),
|
|
2825
|
+
totalBytes: z.number().min(0),
|
|
2826
|
+
over100kb: z.number().int().min(0),
|
|
2827
|
+
legacyFormat: z.number().int().min(0)
|
|
2828
|
+
}),
|
|
2829
|
+
links: z.object({
|
|
2830
|
+
internal: z.number().int().min(0),
|
|
2831
|
+
external: z.number().int().min(0),
|
|
2832
|
+
orphans: z.number().int().min(0),
|
|
2833
|
+
brokenInternal: z.number().int().min(0),
|
|
2834
|
+
externalDomains: z.number().int().min(0)
|
|
2835
|
+
})
|
|
2836
|
+
};
|
|
2496
2837
|
var MapsPlaceIntelOutputSchema = {
|
|
2497
2838
|
name: z.string(),
|
|
2498
2839
|
rating: NullableString,
|
|
@@ -3334,12 +3675,19 @@ function registerPaaExtractorMcpTools(server, executor, options = {}) {
|
|
|
3334
3675
|
annotations: liveWebToolAnnotations("Site URL Map")
|
|
3335
3676
|
}, async (input) => formatMapSiteUrls(await executor.mapSiteUrls(input), input));
|
|
3336
3677
|
server.registerTool("extract_site", {
|
|
3337
|
-
title: "Multi-Page Site
|
|
3338
|
-
description: withReportNote("
|
|
3678
|
+
title: "Multi-Page Site Content Crawl",
|
|
3679
|
+
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."),
|
|
3339
3680
|
inputSchema: ExtractSiteInputSchema,
|
|
3340
3681
|
outputSchema: ExtractSiteOutputSchema,
|
|
3341
|
-
annotations: liveWebToolAnnotations("Multi-Page Site
|
|
3682
|
+
annotations: liveWebToolAnnotations("Multi-Page Site Content Crawl")
|
|
3342
3683
|
}, async (input) => formatExtractSite(await executor.extractSite(input), input));
|
|
3684
|
+
server.registerTool("audit_site", {
|
|
3685
|
+
title: "Technical SEO Audit",
|
|
3686
|
+
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 (inlinks/orphans/crawl-depth), a link analysis (top internal pages by inlinks, top external domains by link count, broken/orphan counts), 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, link-report.md, links-summary.json, external-domains.json, 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."),
|
|
3687
|
+
inputSchema: AuditSiteInputSchema,
|
|
3688
|
+
outputSchema: AuditSiteOutputSchema,
|
|
3689
|
+
annotations: liveWebToolAnnotations("Technical SEO Audit")
|
|
3690
|
+
}, async (input) => formatAuditSite(await executor.auditSite(input), input));
|
|
3343
3691
|
server.registerTool("youtube_harvest", {
|
|
3344
3692
|
title: "YouTube Video Harvest",
|
|
3345
3693
|
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.'),
|
|
@@ -3656,6 +4004,9 @@ var HttpMcpToolExecutor = class {
|
|
|
3656
4004
|
extractSite(input) {
|
|
3657
4005
|
return this.call("/extract-site", input);
|
|
3658
4006
|
}
|
|
4007
|
+
auditSite(input) {
|
|
4008
|
+
return this.call("/extract-site", input);
|
|
4009
|
+
}
|
|
3659
4010
|
youtubeHarvest(input) {
|
|
3660
4011
|
return this.call("/youtube/harvest", input);
|
|
3661
4012
|
}
|
|
@@ -3744,8 +4095,12 @@ var HttpMcpToolExecutor = class {
|
|
|
3744
4095
|
export {
|
|
3745
4096
|
harvestTimeoutBudget,
|
|
3746
4097
|
buildLinkGraph,
|
|
4098
|
+
buildLinkReport,
|
|
4099
|
+
renderLinkReport,
|
|
3747
4100
|
computeIssues,
|
|
3748
4101
|
renderIssueReport,
|
|
4102
|
+
auditImages,
|
|
4103
|
+
renderImageSection,
|
|
3749
4104
|
configureReportSaving,
|
|
3750
4105
|
outputBaseDir,
|
|
3751
4106
|
formatCaptureSerpSnapshot,
|
|
@@ -3760,4 +4115,4 @@ export {
|
|
|
3760
4115
|
registerPaaExtractorMcpTools,
|
|
3761
4116
|
HttpMcpToolExecutor
|
|
3762
4117
|
};
|
|
3763
|
-
//# sourceMappingURL=chunk-
|
|
4118
|
+
//# sourceMappingURL=chunk-N33YEY6W.js.map
|