mcp-scraper 0.65.1 → 0.66.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/CHANGELOG.md +31 -1
  2. package/README.md +11 -6
  3. package/dist/{analytics-repository-IKE53S3E.js → analytics-repository-RUXBFSFX.js} +1 -2
  4. package/dist/bin/api-server.cjs +1844 -71
  5. package/dist/bin/api-server.js +4 -5
  6. package/dist/bin/mcp-scraper-cli.cjs +1 -2
  7. package/dist/bin/mcp-scraper-cli.js +6 -7
  8. package/dist/bin/mcp-scraper-install.cjs +7 -3
  9. package/dist/bin/mcp-scraper-install.js +2 -3
  10. package/dist/bin/mcp-stdio-server.cjs +5150 -3467
  11. package/dist/bin/mcp-stdio-server.js +11 -11
  12. package/dist/bin/paa-harvest.cjs +8 -3
  13. package/dist/bin/paa-harvest.js +4 -5
  14. package/dist/{chunk-5PIO7QBG.js → chunk-3PIXKLGZ.js} +3 -4
  15. package/dist/{chunk-VIWT35S6.js → chunk-4OT7BAIE.js} +1 -2
  16. package/dist/{chunk-ORKXE7VX.js → chunk-4P3PHFPQ.js} +11 -6
  17. package/dist/{chunk-AMLFKPLL.js → chunk-75VW7CWE.js} +4 -7
  18. package/dist/{chunk-FG6LJGJ7.js → chunk-77LQV73B.js} +0 -1
  19. package/dist/{chunk-DKIG2TEE.js → chunk-AQKJOSIB.js} +2 -3
  20. package/dist/{chunk-2XUXVKT4.js → chunk-AYJHI2FK.js} +0 -1
  21. package/dist/{chunk-5BEPOFKG.js → chunk-CNLLTD5B.js} +0 -1
  22. package/dist/{chunk-EKJ65E3Z.js → chunk-DNM65UCK.js} +0 -1
  23. package/dist/{chunk-PDAKCYHZ.js → chunk-E4LMY5OJ.js} +6258 -3747
  24. package/dist/{chunk-MQGBCWZD.js → chunk-GGZEC22A.js} +64 -1
  25. package/dist/{chunk-4VG3NUUY.js → chunk-GTGSD4YS.js} +2 -2
  26. package/dist/{chunk-MQQS7ONH.js → chunk-KBTUPRTF.js} +8 -296
  27. package/dist/{chunk-XPEN6OG5.js → chunk-NS754CRS.js} +15 -3
  28. package/dist/{chunk-UN4LZVCB.js → chunk-OZJMVCDK.js} +1 -2
  29. package/dist/{chunk-342OUCSG.js → chunk-PGJQDMC2.js} +1 -2
  30. package/dist/{chunk-G3P3ZDB4.js → chunk-RJ7JVYKU.js} +0 -1
  31. package/dist/{chunk-N54JS5WP.js → chunk-TNJIPV74.js} +1 -2
  32. package/dist/{chunk-4LINSJNI.js → chunk-TNLGHNLX.js} +1 -2
  33. package/dist/chunk-VRJ7CO6L.js +6 -0
  34. package/dist/chunk-VXLU74YZ.js +293 -0
  35. package/dist/{chunk-DCWXVAQT.js → chunk-WID3MFRS.js} +6 -2
  36. package/dist/{db-BRI465XQ.js → db-PO7N7ZP3.js} +1 -2
  37. package/dist/{extract-bundle-UWKJT4MU.js → extract-bundle-SIBFUA6I.js} +8 -10
  38. package/dist/index.cjs +8 -3
  39. package/dist/index.js +4 -5
  40. package/dist/{lead-list-enrichment-repository-ODWGRVCQ.js → lead-list-enrichment-repository-OTAUQONJ.js} +2 -3
  41. package/dist/{location-data-repository-67MMEVZQ.js → location-data-repository-RM2KJ3H5.js} +3 -4
  42. package/dist/{server-RSHSZBUZ.js → server-ELEJNRRE.js} +875 -1629
  43. package/dist/{site-extract-repository-J3RH3MOS.js → site-extract-repository-ASYEJO7Z.js} +4 -5
  44. package/dist/{worker-YKRIK5LS.js → worker-MAVYYWM7.js} +8 -9
  45. package/package.json +3 -1
  46. package/dist/analytics-repository-IKE53S3E.js.map +0 -1
  47. package/dist/bin/api-server.cjs.map +0 -1
  48. package/dist/bin/api-server.js.map +0 -1
  49. package/dist/bin/mcp-scraper-cli.cjs.map +0 -1
  50. package/dist/bin/mcp-scraper-cli.js.map +0 -1
  51. package/dist/bin/mcp-scraper-install.cjs.map +0 -1
  52. package/dist/bin/mcp-scraper-install.js.map +0 -1
  53. package/dist/bin/mcp-stdio-server.cjs.map +0 -1
  54. package/dist/bin/mcp-stdio-server.js.map +0 -1
  55. package/dist/bin/paa-harvest.cjs.map +0 -1
  56. package/dist/bin/paa-harvest.js.map +0 -1
  57. package/dist/chunk-2XUXVKT4.js.map +0 -1
  58. package/dist/chunk-342OUCSG.js.map +0 -1
  59. package/dist/chunk-4LINSJNI.js.map +0 -1
  60. package/dist/chunk-4VG3NUUY.js.map +0 -1
  61. package/dist/chunk-5BEPOFKG.js.map +0 -1
  62. package/dist/chunk-5PIO7QBG.js.map +0 -1
  63. package/dist/chunk-AMLFKPLL.js.map +0 -1
  64. package/dist/chunk-CGKWNXJR.js +0 -7
  65. package/dist/chunk-CGKWNXJR.js.map +0 -1
  66. package/dist/chunk-DCWXVAQT.js.map +0 -1
  67. package/dist/chunk-DKIG2TEE.js.map +0 -1
  68. package/dist/chunk-EKJ65E3Z.js.map +0 -1
  69. package/dist/chunk-FG6LJGJ7.js.map +0 -1
  70. package/dist/chunk-G3P3ZDB4.js.map +0 -1
  71. package/dist/chunk-MQGBCWZD.js.map +0 -1
  72. package/dist/chunk-MQQS7ONH.js.map +0 -1
  73. package/dist/chunk-N54JS5WP.js.map +0 -1
  74. package/dist/chunk-ORKXE7VX.js.map +0 -1
  75. package/dist/chunk-PDAKCYHZ.js.map +0 -1
  76. package/dist/chunk-UN4LZVCB.js.map +0 -1
  77. package/dist/chunk-UVFB24RZ.js +0 -67
  78. package/dist/chunk-UVFB24RZ.js.map +0 -1
  79. package/dist/chunk-VIWT35S6.js.map +0 -1
  80. package/dist/chunk-XPEN6OG5.js.map +0 -1
  81. package/dist/db-BRI465XQ.js.map +0 -1
  82. package/dist/extract-bundle-UWKJT4MU.js.map +0 -1
  83. package/dist/index.cjs.map +0 -1
  84. package/dist/index.js.map +0 -1
  85. package/dist/lead-list-enrichment-repository-ODWGRVCQ.js.map +0 -1
  86. package/dist/location-data-repository-67MMEVZQ.js.map +0 -1
  87. package/dist/server-RSHSZBUZ.js.map +0 -1
  88. package/dist/site-extract-repository-J3RH3MOS.js.map +0 -1
  89. package/dist/worker-YKRIK5LS.js.map +0 -1
@@ -13,20 +13,21 @@ import {
13
13
  registerScheduledResultsMcpTools,
14
14
  registerSerpIntelligenceCaptureTools,
15
15
  resolveDeploymentProfile
16
- } from "../chunk-PDAKCYHZ.js";
17
- import "../chunk-342OUCSG.js";
18
- import "../chunk-VIWT35S6.js";
19
- import "../chunk-4LINSJNI.js";
16
+ } from "../chunk-E4LMY5OJ.js";
17
+ import "../chunk-PGJQDMC2.js";
18
+ import "../chunk-4OT7BAIE.js";
19
+ import "../chunk-TNLGHNLX.js";
20
20
  import {
21
21
  renderInstallTerminal
22
- } from "../chunk-DCWXVAQT.js";
23
- import "../chunk-UVFB24RZ.js";
22
+ } from "../chunk-WID3MFRS.js";
23
+ import "../chunk-VXLU74YZ.js";
24
+ import "../chunk-GGZEC22A.js";
24
25
  import {
25
26
  PACKAGE_VERSION
26
- } from "../chunk-CGKWNXJR.js";
27
- import "../chunk-EKJ65E3Z.js";
28
- import "../chunk-2XUXVKT4.js";
29
- import "../chunk-4VG3NUUY.js";
27
+ } from "../chunk-VRJ7CO6L.js";
28
+ import "../chunk-DNM65UCK.js";
29
+ import "../chunk-AYJHI2FK.js";
30
+ import "../chunk-GTGSD4YS.js";
30
31
 
31
32
  // bin/mcp-stdio-server.ts
32
33
  import { readFileSync } from "fs";
@@ -168,4 +169,3 @@ serveStdio(() => buildStdioServer(), {
168
169
  `);
169
170
  }
170
171
  });
171
- //# sourceMappingURL=mcp-stdio-server.js.map
@@ -4018,6 +4018,9 @@ function classifyAttemptError(err) {
4018
4018
  if (err instanceof RequestAbortedError) return "request_aborted";
4019
4019
  if (err instanceof DOMException && (err.name === "TimeoutError" || err.name === "AbortError")) return "timeout";
4020
4020
  const message = err instanceof Error ? err.message : String(err);
4021
+ if (/browser (?:has been )?closed|context (?:has been )?closed|target page, context or browser has been closed|session closed|page has been closed/i.test(message)) {
4022
+ return "browser_session_interrupted";
4023
+ }
4021
4024
  if (looksLikeProxyTunnelFailure(message)) return "proxy_tunnel_failed";
4022
4025
  if (looksLikeProxyUnavailable(message)) return "proxy_unavailable";
4023
4026
  return /timeout|timed out|Timeout \d+ms exceeded|deadline/i.test(message) ? "timeout" : "error";
@@ -4065,6 +4068,9 @@ function looksLikeProxyUnavailable(message) {
4065
4068
  function retryableLocationProxyError(outcome) {
4066
4069
  return outcome === "captcha" || outcome === "proxy_tunnel_failed" || outcome === "proxy_unavailable";
4067
4070
  }
4071
+ function retryableFreshBrowserError(outcome) {
4072
+ return outcome === "browser_session_interrupted";
4073
+ }
4068
4074
  function locationMismatchMessage(result) {
4069
4075
  const evidence = result.diagnostics.debug?.locationEvidence;
4070
4076
  const expected = evidence?.expected?.canonicalLocation ?? result.location ?? "requested location";
@@ -4248,7 +4254,7 @@ async function harvest(rawOptions) {
4248
4254
  proxyFailures++;
4249
4255
  if (proxyFailures >= 2) effectiveProxyMode = "none";
4250
4256
  }
4251
- const willRetry2 = i < maxAttempts - 1 && (outcome2 === "captcha" || proxyMode === "location" && retryableLocationProxyError(outcome2));
4257
+ const willRetry2 = i < maxAttempts - 1 && (outcome2 === "captcha" || retryableFreshBrowserError(outcome2) || proxyMode === "location" && retryableLocationProxyError(outcome2));
4252
4258
  if (outcome2 === "captcha") {
4253
4259
  console.warn(JSON.stringify({
4254
4260
  event: "harvest_attempt_captcha",
@@ -4366,7 +4372,7 @@ async function harvest(rawOptions) {
4366
4372
  proxyFailures++;
4367
4373
  if (proxyFailures >= 2) effectiveProxyMode = "none";
4368
4374
  }
4369
- const willRetry = i < maxAttempts - 1 && (outcome === "captcha" || proxyMode === "location" && retryableLocationProxyError(outcome));
4375
+ const willRetry = i < maxAttempts - 1 && (outcome === "captcha" || retryableFreshBrowserError(outcome) || proxyMode === "location" && retryableLocationProxyError(outcome));
4370
4376
  if (outcome === "captcha") {
4371
4377
  console.warn(JSON.stringify({
4372
4378
  event: "harvest_attempt_captcha",
@@ -4451,4 +4457,3 @@ async function runCli() {
4451
4457
 
4452
4458
  // bin/paa-harvest.ts
4453
4459
  runCli();
4454
- //# sourceMappingURL=paa-harvest.cjs.map
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  harvest
4
- } from "../chunk-ORKXE7VX.js";
4
+ } from "../chunk-4P3PHFPQ.js";
5
5
  import {
6
6
  browserServiceApiKey
7
- } from "../chunk-4LINSJNI.js";
8
- import "../chunk-FG6LJGJ7.js";
9
- import "../chunk-4VG3NUUY.js";
7
+ } from "../chunk-TNLGHNLX.js";
8
+ import "../chunk-77LQV73B.js";
9
+ import "../chunk-GTGSD4YS.js";
10
10
 
11
11
  // src/cli.ts
12
12
  import { Command } from "commander";
@@ -39,4 +39,3 @@ async function runCli() {
39
39
 
40
40
  // bin/paa-harvest.ts
41
41
  runCli();
42
- //# sourceMappingURL=paa-harvest.js.map
@@ -4,10 +4,10 @@ import {
4
4
  privateArtifactOwnerId,
5
5
  readPrivateArtifactBuffer,
6
6
  renewPrivateArtifactDownload
7
- } from "./chunk-EKJ65E3Z.js";
7
+ } from "./chunk-DNM65UCK.js";
8
8
  import {
9
9
  LedgerOperation
10
- } from "./chunk-2XUXVKT4.js";
10
+ } from "./chunk-AYJHI2FK.js";
11
11
  import {
12
12
  CREDIT_LOT_TTL,
13
13
  getDb,
@@ -15,7 +15,7 @@ import {
15
15
  sanitizeVendorName,
16
16
  serializePublicErrorEnvelope,
17
17
  settleDebitMcIdempotent
18
- } from "./chunk-4VG3NUUY.js";
18
+ } from "./chunk-GTGSD4YS.js";
19
19
 
20
20
  // src/api/site-extract-content-store.ts
21
21
  import { createHash } from "crypto";
@@ -797,4 +797,3 @@ export {
797
797
  setExtractJobPublicError,
798
798
  settleExtractJob
799
799
  };
800
- //# sourceMappingURL=chunk-5PIO7QBG.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  publicErrorMessage,
3
3
  sanitizeVendorName
4
- } from "./chunk-4VG3NUUY.js";
4
+ } from "./chunk-GTGSD4YS.js";
5
5
 
6
6
  // src/api/outbound-sanitize.ts
7
7
  var KEY_RENAMES = {
@@ -101,4 +101,3 @@ export {
101
101
  sanitizeAttempts,
102
102
  sanitizeHarvestResult
103
103
  };
104
- //# sourceMappingURL=chunk-VIWT35S6.js.map
@@ -6,14 +6,14 @@ import {
6
6
  currentCostContext,
7
7
  recordKernelSession,
8
8
  runWithCostContext
9
- } from "./chunk-4LINSJNI.js";
9
+ } from "./chunk-TNLGHNLX.js";
10
10
  import {
11
11
  DEFAULT_PROXY_MODE,
12
12
  HarvestOptionsSchema,
13
13
  RawPAAItemSchema,
14
14
  postToMemoryLibrary,
15
15
  recencyToTbs
16
- } from "./chunk-FG6LJGJ7.js";
16
+ } from "./chunk-77LQV73B.js";
17
17
  import {
18
18
  CaptchaError,
19
19
  ExtractionError,
@@ -21,7 +21,7 @@ import {
21
21
  RECAPTCHA_INSTRUCTIONS,
22
22
  RequestAbortedError,
23
23
  sanitizeVendorName
24
- } from "./chunk-4VG3NUUY.js";
24
+ } from "./chunk-GTGSD4YS.js";
25
25
 
26
26
  // src/driver/BrowserDriver.ts
27
27
  import { chromium } from "playwright-extra";
@@ -3578,6 +3578,9 @@ function classifyAttemptError(err) {
3578
3578
  if (err instanceof RequestAbortedError) return "request_aborted";
3579
3579
  if (err instanceof DOMException && (err.name === "TimeoutError" || err.name === "AbortError")) return "timeout";
3580
3580
  const message = err instanceof Error ? err.message : String(err);
3581
+ if (/browser (?:has been )?closed|context (?:has been )?closed|target page, context or browser has been closed|session closed|page has been closed/i.test(message)) {
3582
+ return "browser_session_interrupted";
3583
+ }
3581
3584
  if (looksLikeProxyTunnelFailure(message)) return "proxy_tunnel_failed";
3582
3585
  if (looksLikeProxyUnavailable(message)) return "proxy_unavailable";
3583
3586
  return /timeout|timed out|Timeout \d+ms exceeded|deadline/i.test(message) ? "timeout" : "error";
@@ -3625,6 +3628,9 @@ function looksLikeProxyUnavailable(message) {
3625
3628
  function retryableLocationProxyError(outcome) {
3626
3629
  return outcome === "captcha" || outcome === "proxy_tunnel_failed" || outcome === "proxy_unavailable";
3627
3630
  }
3631
+ function retryableFreshBrowserError(outcome) {
3632
+ return outcome === "browser_session_interrupted";
3633
+ }
3628
3634
  function locationMismatchMessage(result) {
3629
3635
  const evidence = result.diagnostics.debug?.locationEvidence;
3630
3636
  const expected = evidence?.expected?.canonicalLocation ?? result.location ?? "requested location";
@@ -3808,7 +3814,7 @@ async function harvest(rawOptions) {
3808
3814
  proxyFailures++;
3809
3815
  if (proxyFailures >= 2) effectiveProxyMode = "none";
3810
3816
  }
3811
- const willRetry2 = i < maxAttempts - 1 && (outcome2 === "captcha" || proxyMode === "location" && retryableLocationProxyError(outcome2));
3817
+ const willRetry2 = i < maxAttempts - 1 && (outcome2 === "captcha" || retryableFreshBrowserError(outcome2) || proxyMode === "location" && retryableLocationProxyError(outcome2));
3812
3818
  if (outcome2 === "captcha") {
3813
3819
  console.warn(JSON.stringify({
3814
3820
  event: "harvest_attempt_captcha",
@@ -3926,7 +3932,7 @@ async function harvest(rawOptions) {
3926
3932
  proxyFailures++;
3927
3933
  if (proxyFailures >= 2) effectiveProxyMode = "none";
3928
3934
  }
3929
- const willRetry = i < maxAttempts - 1 && (outcome === "captcha" || proxyMode === "location" && retryableLocationProxyError(outcome));
3935
+ const willRetry = i < maxAttempts - 1 && (outcome === "captcha" || retryableFreshBrowserError(outcome) || proxyMode === "location" && retryableLocationProxyError(outcome));
3930
3936
  if (outcome === "captcha") {
3931
3937
  console.warn(JSON.stringify({
3932
3938
  event: "harvest_attempt_captcha",
@@ -4009,4 +4015,3 @@ export {
4009
4015
  resolveKernelProxyId,
4010
4016
  harvest
4011
4017
  };
4012
- //# sourceMappingURL=chunk-ORKXE7VX.js.map
@@ -1,16 +1,14 @@
1
1
  import {
2
2
  isVendorUnavailableError
3
- } from "./chunk-UN4LZVCB.js";
4
- import {
5
- loadHtmlDocument
6
- } from "./chunk-MQGBCWZD.js";
3
+ } from "./chunk-OZJMVCDK.js";
7
4
  import {
5
+ loadHtmlDocument,
8
6
  validatePublicHttpUrl
9
- } from "./chunk-UVFB24RZ.js";
7
+ } from "./chunk-GGZEC22A.js";
10
8
  import {
11
9
  buildPublicErrorEnvelope,
12
10
  getDb
13
- } from "./chunk-4VG3NUUY.js";
11
+ } from "./chunk-GTGSD4YS.js";
14
12
 
15
13
  // src/lib/media-extractor.ts
16
14
  import { createWriteStream, mkdirSync, rmSync } from "fs";
@@ -732,4 +730,3 @@ export {
732
730
  queuedCommonsDocumentCount,
733
731
  semanticCommonsEntityScores
734
732
  };
735
- //# sourceMappingURL=chunk-AMLFKPLL.js.map
@@ -170,4 +170,3 @@ export {
170
170
  RawMapsAboutAttributeSchema,
171
171
  postToMemoryLibrary
172
172
  };
173
- //# sourceMappingURL=chunk-FG6LJGJ7.js.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  csvRecords
3
- } from "./chunk-G3P3ZDB4.js";
3
+ } from "./chunk-RJ7JVYKU.js";
4
4
  import {
5
5
  getDb
6
- } from "./chunk-4VG3NUUY.js";
6
+ } from "./chunk-GTGSD4YS.js";
7
7
 
8
8
  // src/api/location-data-repository.ts
9
9
  import { createHash, randomUUID } from "crypto";
@@ -681,4 +681,3 @@ export {
681
681
  importHostedCensusPlacesCsv,
682
682
  queryHostedLocationMarkets
683
683
  };
684
- //# sourceMappingURL=chunk-DKIG2TEE.js.map
@@ -1011,4 +1011,3 @@ export {
1011
1011
  MEDIA_TRANSCRIBE_HOLD_MC,
1012
1012
  MC_PER_USD
1013
1013
  };
1014
- //# sourceMappingURL=chunk-2XUXVKT4.js.map
@@ -3007,4 +3007,3 @@ export {
3007
3007
  refreshAnalyticsDailyRollupsIfDue,
3008
3008
  createAnalyticsExport
3009
3009
  };
3010
- //# sourceMappingURL=chunk-5BEPOFKG.js.map
@@ -297,4 +297,3 @@ export {
297
297
  readPrivateArtifactWindow,
298
298
  readPrivateArtifactBuffer
299
299
  };
300
- //# sourceMappingURL=chunk-EKJ65E3Z.js.map