mcp-scraper 0.1.8 → 0.1.9

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.
@@ -2,9 +2,9 @@
2
2
  "use strict";
3
3
 
4
4
  // bin/mcp-stdio-server.ts
5
- var import_node_fs2 = require("fs");
5
+ var import_node_fs3 = require("fs");
6
6
  var import_node_os2 = require("os");
7
- var import_node_path2 = require("path");
7
+ var import_node_path3 = require("path");
8
8
  var import_stdio = require("@modelcontextprotocol/sdk/server/stdio.js");
9
9
 
10
10
  // src/harvest-timeout.ts
@@ -126,317 +126,11 @@ var HttpMcpToolExecutor = class {
126
126
 
127
127
  // src/mcp/paa-mcp-server.ts
128
128
  var import_mcp = require("@modelcontextprotocol/sdk/server/mcp.js");
129
+ var import_node_fs2 = require("fs");
130
+ var import_node_path2 = require("path");
129
131
 
130
132
  // src/version.ts
131
- var PACKAGE_VERSION = "0.1.8";
132
-
133
- // src/mcp/mcp-tool-schemas.ts
134
- var import_zod = require("zod");
135
- var HarvestPaaInputSchema = {
136
- query: import_zod.z.string().min(1).describe('Core search topic only. If the user says "best hvac company in Denver CO", use query="best hvac company" and location="Denver, CO". Do not include the location in query when it can be separated.'),
137
- location: import_zod.z.string().optional().describe('City, region, or country for geo-targeted results, inferred from the user request when present, e.g. "Denver, CO", "Tokyo, Japan", "London, UK".'),
138
- maxQuestions: import_zod.z.number().int().min(1).max(200).default(30).describe("Number of PAA questions to extract. Default 30. Maximum 200. Use 10 for quick probes, 30 for normal research, 100-200 when the user asks for everything/full/deep research. Larger harvests get a longer server time budget (151-200 questions \u2192 up to 280s). Credits are charged by extracted question; unused request hold is refunded."),
139
- gl: import_zod.z.string().length(2).default("us").describe("Google country code inferred from location or user language. Examples: United States us, United Kingdom gb, Japan jp, Canada ca, Australia au."),
140
- hl: import_zod.z.string().default("en").describe("Google interface/content language inferred from the user request. Use en unless the user asks for another language or locale."),
141
- device: import_zod.z.enum(["desktop", "mobile"]).default("desktop").describe("SERP device context. Use desktop by default; use mobile only when the user asks for mobile rankings."),
142
- proxyMode: import_zod.z.enum(["location", "configured", "none"]).default("location").describe("Proxy targeting mode. Use location by default so city/state searches create or reuse a matching residential proxy. Use configured for the static configured proxy. Use none only for direct-network debugging."),
143
- proxyZip: import_zod.z.string().regex(/^\d{5}$/).optional().describe("Optional US ZIP override for residential location proxy targeting. Use only when the user gives a specific ZIP or city-center proxy targeting needs to be forced."),
144
- debug: import_zod.z.boolean().default(false).describe("Include sanitized browser/session/location diagnostics in the response. Use true when debugging localization, CAPTCHA, or proxy behavior.")
145
- };
146
- var ExtractUrlInputSchema = {
147
- url: import_zod.z.string().url().describe("Public http/https URL to extract. Use this when the user provides one specific page URL."),
148
- screenshot: import_zod.z.boolean().default(false).describe("Also capture a full-page screenshot of the URL. Saved to ~/Downloads/mcp-scraper/screenshots/ and returned inline. Use when the user asks to see or capture the page visually."),
149
- screenshotDevice: import_zod.z.enum(["desktop", "mobile"]).default("desktop").describe("Viewport for screenshot. desktop = 1440\xD7900. mobile = 390\xD7844. Default desktop."),
150
- extractBranding: import_zod.z.boolean().default(false).describe("Extract brand colors, fonts, logo, and favicon using a rendered browser session. Returns colorScheme (light/dark), colors (primary/accent/background/text/heading as hex), fonts (heading/body family names), and assets (logo URL, favicon URL). Use when the user asks about brand colors, site theme, or brand assets."),
151
- downloadMedia: import_zod.z.boolean().default(false).describe("Extract and download all page media (images, video, audio) to ~/Downloads/mcp-scraper/media/. Ad networks, tracking pixels, and noise URLs are filtered automatically. Use when the user asks to download or harvest assets from a page."),
152
- mediaTypes: import_zod.z.array(import_zod.z.enum(["image", "video", "audio"])).default(["image", "video", "audio"]).describe("Which media types to download. Default all three."),
153
- allowLocal: import_zod.z.boolean().default(false).describe("Allow localhost and private-network URLs. For local development only.")
154
- };
155
- var MapSiteUrlsInputSchema = {
156
- url: import_zod.z.string().url().describe("Public website URL or domain to crawl for internal URLs. Use before extract_site when the user asks to audit/map/crawl a site."),
157
- maxUrls: import_zod.z.number().int().min(1).max(500).optional().describe("Maximum URLs to discover. Use 100 for normal maps, higher when the user asks for a full inventory.")
158
- };
159
- var ExtractSiteInputSchema = {
160
- url: import_zod.z.string().url().describe("Public website URL or domain to extract across multiple pages. Use when the user asks for a site audit, website crawl, or full-site content/schema extraction."),
161
- maxPages: import_zod.z.number().int().min(1).max(50).optional().describe("Maximum pages to extract. Use 50 when the user asks for full results or a complete crawl within MCP limits.")
162
- };
163
- var YoutubeHarvestInputSchema = {
164
- mode: import_zod.z.enum(["search", "channel"]).describe("Use search for topic/keyword requests. Use channel when the user provides @handle, channel ID, or channel URL."),
165
- query: import_zod.z.string().optional().describe("Required when mode is search. The YouTube search topic in the user\u2019s words."),
166
- channelHandle: import_zod.z.string().optional().describe("YouTube channel handle, channel ID, or URL. Examples: @mkbhd, UC..., https://youtube.com/@mkbhd."),
167
- maxVideos: import_zod.z.number().int().min(1).max(500).default(50).describe("Number of videos to return. Default 50. Increase when user asks for full channel/history.")
168
- };
169
- var YoutubeTranscribeInputSchema = {
170
- videoId: import_zod.z.string().min(1).describe("YouTube video ID, e.g. dQw4w9WgXcQ")
171
- };
172
- var FacebookPageIntelInputSchema = {
173
- pageId: import_zod.z.string().optional(),
174
- libraryId: import_zod.z.string().optional(),
175
- query: import_zod.z.string().optional().describe("Advertiser or brand name when pageId/libraryId is not known. One of pageId, libraryId, or query is required."),
176
- maxAds: import_zod.z.number().int().min(1).max(200).default(50),
177
- country: import_zod.z.string().length(2).default("US")
178
- };
179
- var FacebookAdSearchInputSchema = {
180
- query: import_zod.z.string().min(1).describe("Advertiser, brand, competitor, niche, or keyword to search in Facebook Ad Library."),
181
- country: import_zod.z.string().length(2).default("US"),
182
- maxResults: import_zod.z.number().int().min(1).max(20).default(10)
183
- };
184
- var FacebookAdTranscribeInputSchema = {
185
- videoUrl: import_zod.z.string().url().describe("Facebook CDN video URL from a facebook_page_intel result")
186
- };
187
- var MapsPlaceIntelInputSchema = {
188
- businessName: import_zod.z.string().min(1).describe('Business name only. If user says "Elite Roofing Denver CO", use businessName="Elite Roofing" and location="Denver, CO".'),
189
- location: import_zod.z.string().min(1).describe('City/region/country where the business should be searched, e.g. "Denver, CO". Infer from the user request when possible.'),
190
- gl: import_zod.z.string().length(2).default("us").describe("Google country code inferred from location."),
191
- hl: import_zod.z.string().length(2).default("en").describe("Language inferred from user request."),
192
- includeReviews: import_zod.z.boolean().default(false).describe("Whether to fetch individual review cards"),
193
- maxReviews: import_zod.z.number().int().min(1).max(500).default(50).describe("Max review cards to return (requires includeReviews: true)")
194
- };
195
- var MapsSearchInputSchema = {
196
- query: import_zod.z.string().min(1).describe('Business category, niche, keyword, or search term. If the user says "roofers in Denver CO", use query="roofers" and location="Denver, CO". Do not put the location here when it can be separated.'),
197
- location: import_zod.z.string().optional().describe('City, region, country, or service area for the Maps search, e.g. "Denver, CO". Infer from the user request when present.'),
198
- gl: import_zod.z.string().length(2).default("us").describe("Google country code inferred from location."),
199
- hl: import_zod.z.string().length(2).default("en").describe("Language inferred from user request."),
200
- maxResults: import_zod.z.number().int().min(1).max(50).default(10).describe("Number of Google Maps business/profile candidates to return. Default 10. Maximum 50. Use 10 unless the user asks for more.")
201
- };
202
- var NullableString = import_zod.z.string().nullable();
203
- var MapsSearchOutputSchema = {
204
- query: import_zod.z.string(),
205
- location: import_zod.z.string().nullable(),
206
- searchQuery: import_zod.z.string(),
207
- searchUrl: import_zod.z.string().url(),
208
- extractedAt: import_zod.z.string(),
209
- requestedMaxResults: import_zod.z.number().int().min(1).max(50),
210
- resultCount: import_zod.z.number().int().min(0).max(50),
211
- results: import_zod.z.array(import_zod.z.object({
212
- position: import_zod.z.number().int().min(1),
213
- name: import_zod.z.string(),
214
- placeUrl: import_zod.z.string().url(),
215
- cid: NullableString,
216
- cidDecimal: NullableString,
217
- rating: NullableString,
218
- reviewCount: NullableString,
219
- category: NullableString,
220
- address: NullableString,
221
- websiteUrl: NullableString,
222
- directionsUrl: NullableString,
223
- metadata: import_zod.z.array(import_zod.z.string())
224
- })),
225
- durationMs: import_zod.z.number().int().min(0)
226
- };
227
- var OrganicResultOutput = import_zod.z.object({
228
- position: import_zod.z.number().int(),
229
- title: import_zod.z.string(),
230
- url: import_zod.z.string(),
231
- domain: import_zod.z.string(),
232
- snippet: NullableString
233
- });
234
- var AiOverviewOutput = import_zod.z.object({
235
- detected: import_zod.z.boolean(),
236
- text: NullableString
237
- }).nullable();
238
- var EntityIdsOutput = import_zod.z.object({
239
- kgIds: import_zod.z.array(import_zod.z.string()),
240
- cids: import_zod.z.array(import_zod.z.string()),
241
- gcids: import_zod.z.array(import_zod.z.string())
242
- }).nullable();
243
- var HarvestPaaOutputSchema = {
244
- query: import_zod.z.string(),
245
- location: NullableString,
246
- questionCount: import_zod.z.number().int().min(0),
247
- completionStatus: NullableString,
248
- questions: import_zod.z.array(import_zod.z.object({
249
- question: import_zod.z.string(),
250
- answer: NullableString,
251
- sourceTitle: NullableString,
252
- sourceSite: NullableString
253
- })),
254
- organicResults: import_zod.z.array(OrganicResultOutput),
255
- aiOverview: AiOverviewOutput,
256
- entityIds: EntityIdsOutput,
257
- durationMs: import_zod.z.number().min(0).nullable()
258
- };
259
- var SearchSerpOutputSchema = {
260
- query: import_zod.z.string(),
261
- location: NullableString,
262
- organicResults: import_zod.z.array(OrganicResultOutput),
263
- localPack: import_zod.z.array(import_zod.z.object({
264
- position: import_zod.z.number().int(),
265
- name: import_zod.z.string(),
266
- rating: NullableString,
267
- reviewCount: NullableString,
268
- websiteUrl: NullableString
269
- })),
270
- aiOverview: AiOverviewOutput,
271
- entityIds: EntityIdsOutput
272
- };
273
- var ExtractUrlOutputSchema = {
274
- url: import_zod.z.string(),
275
- title: NullableString,
276
- headings: import_zod.z.array(import_zod.z.object({
277
- level: import_zod.z.number().int(),
278
- text: import_zod.z.string()
279
- })),
280
- schemaBlockCount: import_zod.z.number().int().min(0),
281
- entityName: NullableString,
282
- entityTypes: import_zod.z.array(import_zod.z.string()),
283
- napScore: import_zod.z.number().nullable(),
284
- missingSchemaFields: import_zod.z.array(import_zod.z.string()),
285
- screenshotSaved: NullableString
286
- };
287
- var ExtractSiteOutputSchema = {
288
- url: import_zod.z.string(),
289
- pageCount: import_zod.z.number().int().min(0),
290
- pages: import_zod.z.array(import_zod.z.object({
291
- url: import_zod.z.string(),
292
- title: NullableString,
293
- schemaTypes: import_zod.z.array(import_zod.z.string())
294
- })),
295
- durationMs: import_zod.z.number().min(0)
296
- };
297
- var MapsPlaceIntelOutputSchema = {
298
- name: import_zod.z.string(),
299
- rating: NullableString,
300
- reviewCount: NullableString,
301
- category: NullableString,
302
- address: NullableString,
303
- phone: NullableString,
304
- website: NullableString,
305
- hoursSummary: NullableString,
306
- bookingUrl: NullableString,
307
- kgmid: NullableString,
308
- cidDecimal: NullableString,
309
- cidUrl: NullableString,
310
- lat: import_zod.z.number().nullable(),
311
- lng: import_zod.z.number().nullable(),
312
- reviewsStatus: import_zod.z.string(),
313
- reviewsCollected: import_zod.z.number().int().min(0),
314
- reviewTopics: import_zod.z.array(import_zod.z.object({
315
- label: import_zod.z.string(),
316
- count: import_zod.z.string()
317
- }))
318
- };
319
- var CreditsInfoOutputSchema = {
320
- balanceCredits: import_zod.z.number().nullable(),
321
- matchedCost: import_zod.z.object({
322
- label: import_zod.z.string(),
323
- credits: import_zod.z.number(),
324
- unit: import_zod.z.string(),
325
- notes: NullableString
326
- }).nullable(),
327
- costs: import_zod.z.array(import_zod.z.object({
328
- key: import_zod.z.string(),
329
- label: import_zod.z.string(),
330
- credits: import_zod.z.number(),
331
- unit: import_zod.z.string(),
332
- notes: NullableString
333
- })),
334
- ledger: import_zod.z.array(import_zod.z.object({
335
- createdAt: import_zod.z.string(),
336
- operation: import_zod.z.string(),
337
- credits: import_zod.z.number(),
338
- description: NullableString
339
- }))
340
- };
341
- var MapSiteUrlsOutputSchema = {
342
- startUrl: import_zod.z.string(),
343
- totalFound: import_zod.z.number().int().min(0),
344
- truncated: import_zod.z.boolean(),
345
- okCount: import_zod.z.number().int().min(0),
346
- redirectCount: import_zod.z.number().int().min(0),
347
- brokenCount: import_zod.z.number().int().min(0),
348
- urls: import_zod.z.array(import_zod.z.object({
349
- url: import_zod.z.string(),
350
- status: import_zod.z.number().int().nullable()
351
- })),
352
- durationMs: import_zod.z.number().min(0)
353
- };
354
- var YoutubeHarvestOutputSchema = {
355
- mode: import_zod.z.string(),
356
- videoCount: import_zod.z.number().int().min(0),
357
- channel: import_zod.z.object({
358
- title: NullableString,
359
- subscriberCount: NullableString
360
- }).nullable(),
361
- videos: import_zod.z.array(import_zod.z.object({
362
- videoId: import_zod.z.string(),
363
- title: import_zod.z.string(),
364
- channelName: NullableString,
365
- views: NullableString,
366
- duration: NullableString,
367
- url: NullableString
368
- }))
369
- };
370
- var FacebookAdSearchOutputSchema = {
371
- query: import_zod.z.string(),
372
- advertiserCount: import_zod.z.number().int().min(0),
373
- advertisers: import_zod.z.array(import_zod.z.object({
374
- name: NullableString,
375
- adCount: import_zod.z.number().int().nullable(),
376
- libraryId: NullableString
377
- }))
378
- };
379
- var FacebookPageIntelOutputSchema = {
380
- advertiserName: NullableString,
381
- totalAds: import_zod.z.number().int().min(0),
382
- activeCount: import_zod.z.number().int().min(0),
383
- videoCount: import_zod.z.number().int().min(0),
384
- imageCount: import_zod.z.number().int().min(0),
385
- ads: import_zod.z.array(import_zod.z.object({
386
- libraryId: NullableString,
387
- status: NullableString,
388
- creativeType: NullableString,
389
- headline: NullableString,
390
- cta: NullableString,
391
- startDate: NullableString,
392
- videoUrl: NullableString,
393
- variations: import_zod.z.number().int().nullable()
394
- }))
395
- };
396
- var CreditsInfoInputSchema = {
397
- item: import_zod.z.string().optional().describe('Optional tool, action, or feature to look up, e.g. "maps reviews", "extract_url", or "YouTube transcription"'),
398
- includeLedger: import_zod.z.boolean().default(false).describe("Whether to include recent credit ledger entries")
399
- };
400
- var SearchSerpInputSchema = {
401
- query: import_zod.z.string().min(1).describe('Core search topic only. Separate location when possible. If user says "best dentist in Brooklyn NY serp", use query="best dentist" and location="Brooklyn, NY".'),
402
- location: import_zod.z.string().optional().describe("City, region, or country for geo-targeted results, inferred from user request when present."),
403
- gl: import_zod.z.string().length(2).default("us").describe("Google country code inferred from location or user language."),
404
- hl: import_zod.z.string().default("en").describe("Google interface/content language inferred from user request."),
405
- device: import_zod.z.enum(["desktop", "mobile"]).default("desktop").describe("SERP device context. Use desktop by default; use mobile only when the user asks for mobile rankings."),
406
- proxyMode: import_zod.z.enum(["location", "configured", "none"]).default("location").describe("Proxy targeting mode. Use location by default so city/state searches create or reuse a matching residential proxy. Use configured for the static configured proxy. Use none only for direct-network debugging."),
407
- proxyZip: import_zod.z.string().regex(/^\d{5}$/).optional().describe("Optional US ZIP override for residential location proxy targeting. Use only when the user gives a specific ZIP or city-center proxy targeting needs to be forced."),
408
- debug: import_zod.z.boolean().default(false).describe("Include sanitized browser/session/location diagnostics in the response. Use true when debugging localization, CAPTCHA, or proxy behavior."),
409
- pages: import_zod.z.number().int().min(1).max(2).default(1).describe("Number of result pages to fetch (1\u20132)")
410
- };
411
- var CaptureSerpSnapshotInputSchema = {
412
- query: import_zod.z.string().min(1).describe("Core search query to capture as a structured SERP Intelligence snapshot. Separate the place into location when the user gives a city, region, country, or ZIP."),
413
- location: import_zod.z.string().optional().describe("City, region, country, or service area used for localized Google results. MCP Scraper records location evidence; UULE alone is not proof of localization."),
414
- gl: import_zod.z.string().length(2).default("us").describe("Google country code inferred from the requested market, e.g. us, gb, ca, au."),
415
- hl: import_zod.z.string().default("en").describe("Google interface/content language inferred from the user request."),
416
- device: import_zod.z.enum(["desktop", "mobile"]).default("desktop").describe("SERP device context. Use mobile only when the user asks for mobile rankings or mobile SERP evidence."),
417
- proxyMode: import_zod.z.enum(["location", "configured", "none"]).default("location").describe("Proxy behavior for capture. Use location for localized residential proxy targeting, configured for the static residential proxy, and none only for direct-network debugging."),
418
- proxyZip: import_zod.z.string().regex(/^\d{5}$/).optional().describe("Optional US ZIP override for residential location proxy targeting when a precise city-center or ZIP proxy is needed."),
419
- pages: import_zod.z.number().int().min(1).max(2).default(1).describe("Number of Google result pages to capture. Use 1 normally and 2 only when the user needs deeper ranking evidence."),
420
- debug: import_zod.z.boolean().default(false).describe("Include sanitized browser, proxy, and location diagnostics. Use true when debugging localization, CAPTCHA, proxy selection, or capture reliability."),
421
- includePageSnapshots: import_zod.z.boolean().default(false).describe("Also capture ranking-page snapshots for selected SERP URLs through the same product capture path."),
422
- pageSnapshotLimit: import_zod.z.number().int().min(0).max(10).default(0).describe("Maximum ranking-page snapshots to capture when includePageSnapshots is true. Use 0 when only SERP evidence is needed.")
423
- };
424
- var ScreenshotInputSchema = {
425
- url: import_zod.z.string().url().describe("URL to capture as a full-page screenshot. Use http or https. Pass allowLocal: true to capture localhost or private-network URLs during development."),
426
- device: import_zod.z.enum(["desktop", "mobile"]).default("desktop").describe("Viewport profile. desktop = 1440\xD7900. mobile = 390\xD7844. Use desktop by default; use mobile when the user asks for a mobile view."),
427
- allowLocal: import_zod.z.boolean().default(false).describe("Allow localhost and private-network URLs (127.x, 192.168.x, 10.x, etc.). For local development only \u2014 not for production use.")
428
- };
429
- var CaptureSerpPageSnapshotsInputSchema = {
430
- urls: import_zod.z.array(import_zod.z.string().url()).min(1).max(25).describe("Public HTTP/HTTPS URLs to capture as SERP Intelligence page snapshots. Do not pass localhost, private IPs, file URLs, or internal admin URLs."),
431
- targets: import_zod.z.array(import_zod.z.object({
432
- url: import_zod.z.string().url().describe("Public HTTP/HTTPS URL to capture."),
433
- sourceKind: import_zod.z.enum(["organic", "ai_citation", "local_pack_website", "configured_target", "site_subject"]).default("configured_target").describe("Why this page is being captured for SERP Intelligence evidence."),
434
- sourcePosition: import_zod.z.number().int().min(1).optional().describe("Ranking or citation position when the page came from SERP evidence.")
435
- }).strict()).min(1).max(25).optional().describe("Structured page snapshot targets. Use this instead of urls when source kind or position should be preserved."),
436
- maxConcurrency: import_zod.z.number().int().min(1).max(5).default(2).describe("Parallel page captures. Use 2 normally; higher values can increase proxy/browser pressure."),
437
- timeoutMs: import_zod.z.number().int().min(1e3).max(6e4).default(15e3).describe("Per-page capture timeout in milliseconds. Increase for slow pages; timeout artifacts are returned as structured capture failures."),
438
- debug: import_zod.z.boolean().default(false).describe("Include sanitized browser/proxy diagnostics for page snapshot debugging. Use true for capture, network, or proxy troubleshooting.")
439
- };
133
+ var PACKAGE_VERSION = "0.1.9";
440
134
 
441
135
  // src/mcp/mcp-response-formatter.ts
442
136
  var import_node_fs = require("fs");
@@ -1302,6 +996,314 @@ ${chunkRows}` : "",
1302
996
  return oneBlock(full);
1303
997
  }
1304
998
 
999
+ // src/mcp/mcp-tool-schemas.ts
1000
+ var import_zod = require("zod");
1001
+ var HarvestPaaInputSchema = {
1002
+ query: import_zod.z.string().min(1).describe('Core search topic only. If the user says "best hvac company in Denver CO", use query="best hvac company" and location="Denver, CO". Do not include the location in query when it can be separated.'),
1003
+ location: import_zod.z.string().optional().describe('City, region, or country for geo-targeted results, inferred from the user request when present, e.g. "Denver, CO", "Tokyo, Japan", "London, UK".'),
1004
+ maxQuestions: import_zod.z.number().int().min(1).max(200).default(30).describe("Number of PAA questions to extract. Default 30. Maximum 200. Use 10 for quick probes, 30 for normal research, 100-200 when the user asks for everything/full/deep research. Larger harvests get a longer server time budget (151-200 questions \u2192 up to 280s). Credits are charged by extracted question; unused request hold is refunded."),
1005
+ gl: import_zod.z.string().length(2).default("us").describe("Google country code inferred from location or user language. Examples: United States us, United Kingdom gb, Japan jp, Canada ca, Australia au."),
1006
+ hl: import_zod.z.string().default("en").describe("Google interface/content language inferred from the user request. Use en unless the user asks for another language or locale."),
1007
+ device: import_zod.z.enum(["desktop", "mobile"]).default("desktop").describe("SERP device context. Use desktop by default; use mobile only when the user asks for mobile rankings."),
1008
+ proxyMode: import_zod.z.enum(["location", "configured", "none"]).default("location").describe("Proxy targeting mode. Use location by default so city/state searches create or reuse a matching residential proxy. Use configured for the static configured proxy. Use none only for direct-network debugging."),
1009
+ proxyZip: import_zod.z.string().regex(/^\d{5}$/).optional().describe("Optional US ZIP override for residential location proxy targeting. Use only when the user gives a specific ZIP or city-center proxy targeting needs to be forced."),
1010
+ debug: import_zod.z.boolean().default(false).describe("Include sanitized browser/session/location diagnostics in the response. Use true when debugging localization, CAPTCHA, or proxy behavior.")
1011
+ };
1012
+ var ExtractUrlInputSchema = {
1013
+ url: import_zod.z.string().url().describe("Public http/https URL to extract. Use this when the user provides one specific page URL."),
1014
+ screenshot: import_zod.z.boolean().default(false).describe("Also capture a full-page screenshot of the URL. Saved to ~/Downloads/mcp-scraper/screenshots/ and returned inline. Use when the user asks to see or capture the page visually."),
1015
+ screenshotDevice: import_zod.z.enum(["desktop", "mobile"]).default("desktop").describe("Viewport for screenshot. desktop = 1440\xD7900. mobile = 390\xD7844. Default desktop."),
1016
+ extractBranding: import_zod.z.boolean().default(false).describe("Extract brand colors, fonts, logo, and favicon using a rendered browser session. Returns colorScheme (light/dark), colors (primary/accent/background/text/heading as hex), fonts (heading/body family names), and assets (logo URL, favicon URL). Use when the user asks about brand colors, site theme, or brand assets."),
1017
+ downloadMedia: import_zod.z.boolean().default(false).describe("Extract and download all page media (images, video, audio) to ~/Downloads/mcp-scraper/media/. Ad networks, tracking pixels, and noise URLs are filtered automatically. Use when the user asks to download or harvest assets from a page."),
1018
+ mediaTypes: import_zod.z.array(import_zod.z.enum(["image", "video", "audio"])).default(["image", "video", "audio"]).describe("Which media types to download. Default all three."),
1019
+ allowLocal: import_zod.z.boolean().default(false).describe("Allow localhost and private-network URLs. For local development only.")
1020
+ };
1021
+ var MapSiteUrlsInputSchema = {
1022
+ url: import_zod.z.string().url().describe("Public website URL or domain to crawl for internal URLs. Use before extract_site when the user asks to audit/map/crawl a site."),
1023
+ maxUrls: import_zod.z.number().int().min(1).max(500).optional().describe("Maximum URLs to discover. Use 100 for normal maps, higher when the user asks for a full inventory.")
1024
+ };
1025
+ var ExtractSiteInputSchema = {
1026
+ url: import_zod.z.string().url().describe("Public website URL or domain to extract across multiple pages. Use when the user asks for a site audit, website crawl, or full-site content/schema extraction."),
1027
+ maxPages: import_zod.z.number().int().min(1).max(50).optional().describe("Maximum pages to extract. Use 50 when the user asks for full results or a complete crawl within MCP limits.")
1028
+ };
1029
+ var YoutubeHarvestInputSchema = {
1030
+ mode: import_zod.z.enum(["search", "channel"]).describe("Use search for topic/keyword requests. Use channel when the user provides @handle, channel ID, or channel URL."),
1031
+ query: import_zod.z.string().optional().describe("Required when mode is search. The YouTube search topic in the user\u2019s words."),
1032
+ channelHandle: import_zod.z.string().optional().describe("YouTube channel handle, channel ID, or URL. Examples: @mkbhd, UC..., https://youtube.com/@mkbhd."),
1033
+ maxVideos: import_zod.z.number().int().min(1).max(500).default(50).describe("Number of videos to return. Default 50. Increase when user asks for full channel/history.")
1034
+ };
1035
+ var YoutubeTranscribeInputSchema = {
1036
+ videoId: import_zod.z.string().min(1).describe("YouTube video ID, e.g. dQw4w9WgXcQ")
1037
+ };
1038
+ var FacebookPageIntelInputSchema = {
1039
+ pageId: import_zod.z.string().optional(),
1040
+ libraryId: import_zod.z.string().optional(),
1041
+ query: import_zod.z.string().optional().describe("Advertiser or brand name when pageId/libraryId is not known. One of pageId, libraryId, or query is required."),
1042
+ maxAds: import_zod.z.number().int().min(1).max(200).default(50),
1043
+ country: import_zod.z.string().length(2).default("US")
1044
+ };
1045
+ var FacebookAdSearchInputSchema = {
1046
+ query: import_zod.z.string().min(1).describe("Advertiser, brand, competitor, niche, or keyword to search in Facebook Ad Library."),
1047
+ country: import_zod.z.string().length(2).default("US"),
1048
+ maxResults: import_zod.z.number().int().min(1).max(20).default(10)
1049
+ };
1050
+ var FacebookAdTranscribeInputSchema = {
1051
+ videoUrl: import_zod.z.string().url().describe("Facebook CDN video URL from a facebook_page_intel result")
1052
+ };
1053
+ var MapsPlaceIntelInputSchema = {
1054
+ businessName: import_zod.z.string().min(1).describe('Business name only. If user says "Elite Roofing Denver CO", use businessName="Elite Roofing" and location="Denver, CO".'),
1055
+ location: import_zod.z.string().min(1).describe('City/region/country where the business should be searched, e.g. "Denver, CO". Infer from the user request when possible.'),
1056
+ gl: import_zod.z.string().length(2).default("us").describe("Google country code inferred from location."),
1057
+ hl: import_zod.z.string().length(2).default("en").describe("Language inferred from user request."),
1058
+ includeReviews: import_zod.z.boolean().default(false).describe("Whether to fetch individual review cards"),
1059
+ maxReviews: import_zod.z.number().int().min(1).max(500).default(50).describe("Max review cards to return (requires includeReviews: true)")
1060
+ };
1061
+ var MapsSearchInputSchema = {
1062
+ query: import_zod.z.string().min(1).describe('Business category, niche, keyword, or search term. If the user says "roofers in Denver CO", use query="roofers" and location="Denver, CO". Do not put the location here when it can be separated.'),
1063
+ location: import_zod.z.string().optional().describe('City, region, country, or service area for the Maps search, e.g. "Denver, CO". Infer from the user request when present.'),
1064
+ gl: import_zod.z.string().length(2).default("us").describe("Google country code inferred from location."),
1065
+ hl: import_zod.z.string().length(2).default("en").describe("Language inferred from user request."),
1066
+ maxResults: import_zod.z.number().int().min(1).max(50).default(10).describe("Number of Google Maps business/profile candidates to return. Default 10. Maximum 50. Use 10 unless the user asks for more.")
1067
+ };
1068
+ var NullableString = import_zod.z.string().nullable();
1069
+ var MapsSearchOutputSchema = {
1070
+ query: import_zod.z.string(),
1071
+ location: import_zod.z.string().nullable(),
1072
+ searchQuery: import_zod.z.string(),
1073
+ searchUrl: import_zod.z.string().url(),
1074
+ extractedAt: import_zod.z.string(),
1075
+ requestedMaxResults: import_zod.z.number().int().min(1).max(50),
1076
+ resultCount: import_zod.z.number().int().min(0).max(50),
1077
+ results: import_zod.z.array(import_zod.z.object({
1078
+ position: import_zod.z.number().int().min(1),
1079
+ name: import_zod.z.string(),
1080
+ placeUrl: import_zod.z.string().url(),
1081
+ cid: NullableString,
1082
+ cidDecimal: NullableString,
1083
+ rating: NullableString,
1084
+ reviewCount: NullableString,
1085
+ category: NullableString,
1086
+ address: NullableString,
1087
+ websiteUrl: NullableString,
1088
+ directionsUrl: NullableString,
1089
+ metadata: import_zod.z.array(import_zod.z.string())
1090
+ })),
1091
+ durationMs: import_zod.z.number().int().min(0)
1092
+ };
1093
+ var OrganicResultOutput = import_zod.z.object({
1094
+ position: import_zod.z.number().int(),
1095
+ title: import_zod.z.string(),
1096
+ url: import_zod.z.string(),
1097
+ domain: import_zod.z.string(),
1098
+ snippet: NullableString
1099
+ });
1100
+ var AiOverviewOutput = import_zod.z.object({
1101
+ detected: import_zod.z.boolean(),
1102
+ text: NullableString
1103
+ }).nullable();
1104
+ var EntityIdsOutput = import_zod.z.object({
1105
+ kgIds: import_zod.z.array(import_zod.z.string()),
1106
+ cids: import_zod.z.array(import_zod.z.string()),
1107
+ gcids: import_zod.z.array(import_zod.z.string())
1108
+ }).nullable();
1109
+ var HarvestPaaOutputSchema = {
1110
+ query: import_zod.z.string(),
1111
+ location: NullableString,
1112
+ questionCount: import_zod.z.number().int().min(0),
1113
+ completionStatus: NullableString,
1114
+ questions: import_zod.z.array(import_zod.z.object({
1115
+ question: import_zod.z.string(),
1116
+ answer: NullableString,
1117
+ sourceTitle: NullableString,
1118
+ sourceSite: NullableString
1119
+ })),
1120
+ organicResults: import_zod.z.array(OrganicResultOutput),
1121
+ aiOverview: AiOverviewOutput,
1122
+ entityIds: EntityIdsOutput,
1123
+ durationMs: import_zod.z.number().min(0).nullable()
1124
+ };
1125
+ var SearchSerpOutputSchema = {
1126
+ query: import_zod.z.string(),
1127
+ location: NullableString,
1128
+ organicResults: import_zod.z.array(OrganicResultOutput),
1129
+ localPack: import_zod.z.array(import_zod.z.object({
1130
+ position: import_zod.z.number().int(),
1131
+ name: import_zod.z.string(),
1132
+ rating: NullableString,
1133
+ reviewCount: NullableString,
1134
+ websiteUrl: NullableString
1135
+ })),
1136
+ aiOverview: AiOverviewOutput,
1137
+ entityIds: EntityIdsOutput
1138
+ };
1139
+ var ExtractUrlOutputSchema = {
1140
+ url: import_zod.z.string(),
1141
+ title: NullableString,
1142
+ headings: import_zod.z.array(import_zod.z.object({
1143
+ level: import_zod.z.number().int(),
1144
+ text: import_zod.z.string()
1145
+ })),
1146
+ schemaBlockCount: import_zod.z.number().int().min(0),
1147
+ entityName: NullableString,
1148
+ entityTypes: import_zod.z.array(import_zod.z.string()),
1149
+ napScore: import_zod.z.number().nullable(),
1150
+ missingSchemaFields: import_zod.z.array(import_zod.z.string()),
1151
+ screenshotSaved: NullableString
1152
+ };
1153
+ var ExtractSiteOutputSchema = {
1154
+ url: import_zod.z.string(),
1155
+ pageCount: import_zod.z.number().int().min(0),
1156
+ pages: import_zod.z.array(import_zod.z.object({
1157
+ url: import_zod.z.string(),
1158
+ title: NullableString,
1159
+ schemaTypes: import_zod.z.array(import_zod.z.string())
1160
+ })),
1161
+ durationMs: import_zod.z.number().min(0)
1162
+ };
1163
+ var MapsPlaceIntelOutputSchema = {
1164
+ name: import_zod.z.string(),
1165
+ rating: NullableString,
1166
+ reviewCount: NullableString,
1167
+ category: NullableString,
1168
+ address: NullableString,
1169
+ phone: NullableString,
1170
+ website: NullableString,
1171
+ hoursSummary: NullableString,
1172
+ bookingUrl: NullableString,
1173
+ kgmid: NullableString,
1174
+ cidDecimal: NullableString,
1175
+ cidUrl: NullableString,
1176
+ lat: import_zod.z.number().nullable(),
1177
+ lng: import_zod.z.number().nullable(),
1178
+ reviewsStatus: import_zod.z.string(),
1179
+ reviewsCollected: import_zod.z.number().int().min(0),
1180
+ reviewTopics: import_zod.z.array(import_zod.z.object({
1181
+ label: import_zod.z.string(),
1182
+ count: import_zod.z.string()
1183
+ }))
1184
+ };
1185
+ var CreditsInfoOutputSchema = {
1186
+ balanceCredits: import_zod.z.number().nullable(),
1187
+ matchedCost: import_zod.z.object({
1188
+ label: import_zod.z.string(),
1189
+ credits: import_zod.z.number(),
1190
+ unit: import_zod.z.string(),
1191
+ notes: NullableString
1192
+ }).nullable(),
1193
+ costs: import_zod.z.array(import_zod.z.object({
1194
+ key: import_zod.z.string(),
1195
+ label: import_zod.z.string(),
1196
+ credits: import_zod.z.number(),
1197
+ unit: import_zod.z.string(),
1198
+ notes: NullableString
1199
+ })),
1200
+ ledger: import_zod.z.array(import_zod.z.object({
1201
+ createdAt: import_zod.z.string(),
1202
+ operation: import_zod.z.string(),
1203
+ credits: import_zod.z.number(),
1204
+ description: NullableString
1205
+ }))
1206
+ };
1207
+ var MapSiteUrlsOutputSchema = {
1208
+ startUrl: import_zod.z.string(),
1209
+ totalFound: import_zod.z.number().int().min(0),
1210
+ truncated: import_zod.z.boolean(),
1211
+ okCount: import_zod.z.number().int().min(0),
1212
+ redirectCount: import_zod.z.number().int().min(0),
1213
+ brokenCount: import_zod.z.number().int().min(0),
1214
+ urls: import_zod.z.array(import_zod.z.object({
1215
+ url: import_zod.z.string(),
1216
+ status: import_zod.z.number().int().nullable()
1217
+ })),
1218
+ durationMs: import_zod.z.number().min(0)
1219
+ };
1220
+ var YoutubeHarvestOutputSchema = {
1221
+ mode: import_zod.z.string(),
1222
+ videoCount: import_zod.z.number().int().min(0),
1223
+ channel: import_zod.z.object({
1224
+ title: NullableString,
1225
+ subscriberCount: NullableString
1226
+ }).nullable(),
1227
+ videos: import_zod.z.array(import_zod.z.object({
1228
+ videoId: import_zod.z.string(),
1229
+ title: import_zod.z.string(),
1230
+ channelName: NullableString,
1231
+ views: NullableString,
1232
+ duration: NullableString,
1233
+ url: NullableString
1234
+ }))
1235
+ };
1236
+ var FacebookAdSearchOutputSchema = {
1237
+ query: import_zod.z.string(),
1238
+ advertiserCount: import_zod.z.number().int().min(0),
1239
+ advertisers: import_zod.z.array(import_zod.z.object({
1240
+ name: NullableString,
1241
+ adCount: import_zod.z.number().int().nullable(),
1242
+ libraryId: NullableString
1243
+ }))
1244
+ };
1245
+ var FacebookPageIntelOutputSchema = {
1246
+ advertiserName: NullableString,
1247
+ totalAds: import_zod.z.number().int().min(0),
1248
+ activeCount: import_zod.z.number().int().min(0),
1249
+ videoCount: import_zod.z.number().int().min(0),
1250
+ imageCount: import_zod.z.number().int().min(0),
1251
+ ads: import_zod.z.array(import_zod.z.object({
1252
+ libraryId: NullableString,
1253
+ status: NullableString,
1254
+ creativeType: NullableString,
1255
+ headline: NullableString,
1256
+ cta: NullableString,
1257
+ startDate: NullableString,
1258
+ videoUrl: NullableString,
1259
+ variations: import_zod.z.number().int().nullable()
1260
+ }))
1261
+ };
1262
+ var CreditsInfoInputSchema = {
1263
+ item: import_zod.z.string().optional().describe('Optional tool, action, or feature to look up, e.g. "maps reviews", "extract_url", or "YouTube transcription"'),
1264
+ includeLedger: import_zod.z.boolean().default(false).describe("Whether to include recent credit ledger entries")
1265
+ };
1266
+ var SearchSerpInputSchema = {
1267
+ query: import_zod.z.string().min(1).describe('Core search topic only. Separate location when possible. If user says "best dentist in Brooklyn NY serp", use query="best dentist" and location="Brooklyn, NY".'),
1268
+ location: import_zod.z.string().optional().describe("City, region, or country for geo-targeted results, inferred from user request when present."),
1269
+ gl: import_zod.z.string().length(2).default("us").describe("Google country code inferred from location or user language."),
1270
+ hl: import_zod.z.string().default("en").describe("Google interface/content language inferred from user request."),
1271
+ device: import_zod.z.enum(["desktop", "mobile"]).default("desktop").describe("SERP device context. Use desktop by default; use mobile only when the user asks for mobile rankings."),
1272
+ proxyMode: import_zod.z.enum(["location", "configured", "none"]).default("location").describe("Proxy targeting mode. Use location by default so city/state searches create or reuse a matching residential proxy. Use configured for the static configured proxy. Use none only for direct-network debugging."),
1273
+ proxyZip: import_zod.z.string().regex(/^\d{5}$/).optional().describe("Optional US ZIP override for residential location proxy targeting. Use only when the user gives a specific ZIP or city-center proxy targeting needs to be forced."),
1274
+ debug: import_zod.z.boolean().default(false).describe("Include sanitized browser/session/location diagnostics in the response. Use true when debugging localization, CAPTCHA, or proxy behavior."),
1275
+ pages: import_zod.z.number().int().min(1).max(2).default(1).describe("Number of result pages to fetch (1\u20132)")
1276
+ };
1277
+ var CaptureSerpSnapshotInputSchema = {
1278
+ query: import_zod.z.string().min(1).describe("Core search query to capture as a structured SERP Intelligence snapshot. Separate the place into location when the user gives a city, region, country, or ZIP."),
1279
+ location: import_zod.z.string().optional().describe("City, region, country, or service area used for localized Google results. MCP Scraper records location evidence; UULE alone is not proof of localization."),
1280
+ gl: import_zod.z.string().length(2).default("us").describe("Google country code inferred from the requested market, e.g. us, gb, ca, au."),
1281
+ hl: import_zod.z.string().default("en").describe("Google interface/content language inferred from the user request."),
1282
+ device: import_zod.z.enum(["desktop", "mobile"]).default("desktop").describe("SERP device context. Use mobile only when the user asks for mobile rankings or mobile SERP evidence."),
1283
+ proxyMode: import_zod.z.enum(["location", "configured", "none"]).default("location").describe("Proxy behavior for capture. Use location for localized residential proxy targeting, configured for the static residential proxy, and none only for direct-network debugging."),
1284
+ proxyZip: import_zod.z.string().regex(/^\d{5}$/).optional().describe("Optional US ZIP override for residential location proxy targeting when a precise city-center or ZIP proxy is needed."),
1285
+ pages: import_zod.z.number().int().min(1).max(2).default(1).describe("Number of Google result pages to capture. Use 1 normally and 2 only when the user needs deeper ranking evidence."),
1286
+ debug: import_zod.z.boolean().default(false).describe("Include sanitized browser, proxy, and location diagnostics. Use true when debugging localization, CAPTCHA, proxy selection, or capture reliability."),
1287
+ includePageSnapshots: import_zod.z.boolean().default(false).describe("Also capture ranking-page snapshots for selected SERP URLs through the same product capture path."),
1288
+ pageSnapshotLimit: import_zod.z.number().int().min(0).max(10).default(0).describe("Maximum ranking-page snapshots to capture when includePageSnapshots is true. Use 0 when only SERP evidence is needed.")
1289
+ };
1290
+ var ScreenshotInputSchema = {
1291
+ url: import_zod.z.string().url().describe("URL to capture as a full-page screenshot. Use http or https. Pass allowLocal: true to capture localhost or private-network URLs during development."),
1292
+ device: import_zod.z.enum(["desktop", "mobile"]).default("desktop").describe("Viewport profile. desktop = 1440\xD7900. mobile = 390\xD7844. Use desktop by default; use mobile when the user asks for a mobile view."),
1293
+ allowLocal: import_zod.z.boolean().default(false).describe("Allow localhost and private-network URLs (127.x, 192.168.x, 10.x, etc.). For local development only \u2014 not for production use.")
1294
+ };
1295
+ var CaptureSerpPageSnapshotsInputSchema = {
1296
+ urls: import_zod.z.array(import_zod.z.string().url()).min(1).max(25).describe("Public HTTP/HTTPS URLs to capture as SERP Intelligence page snapshots. Do not pass localhost, private IPs, file URLs, or internal admin URLs."),
1297
+ targets: import_zod.z.array(import_zod.z.object({
1298
+ url: import_zod.z.string().url().describe("Public HTTP/HTTPS URL to capture."),
1299
+ sourceKind: import_zod.z.enum(["organic", "ai_citation", "local_pack_website", "configured_target", "site_subject"]).default("configured_target").describe("Why this page is being captured for SERP Intelligence evidence."),
1300
+ sourcePosition: import_zod.z.number().int().min(1).optional().describe("Ranking or citation position when the page came from SERP evidence.")
1301
+ }).strict()).min(1).max(25).optional().describe("Structured page snapshot targets. Use this instead of urls when source kind or position should be preserved."),
1302
+ maxConcurrency: import_zod.z.number().int().min(1).max(5).default(2).describe("Parallel page captures. Use 2 normally; higher values can increase proxy/browser pressure."),
1303
+ timeoutMs: import_zod.z.number().int().min(1e3).max(6e4).default(15e3).describe("Per-page capture timeout in milliseconds. Increase for slow pages; timeout artifacts are returned as structured capture failures."),
1304
+ debug: import_zod.z.boolean().default(false).describe("Include sanitized browser/proxy diagnostics for page snapshot debugging. Use true for capture, network, or proxy troubleshooting.")
1305
+ };
1306
+
1305
1307
  // src/mcp/paa-mcp-server.ts
1306
1308
  function liveWebToolAnnotations(title) {
1307
1309
  return {
@@ -1312,14 +1314,49 @@ function liveWebToolAnnotations(title) {
1312
1314
  openWorldHint: true
1313
1315
  };
1314
1316
  }
1317
+ function listSavedReports() {
1318
+ try {
1319
+ const dir = outputBaseDir();
1320
+ return (0, import_node_fs2.readdirSync)(dir).filter((f) => f.endsWith(".md")).map((f) => ({ filename: f, mtimeMs: (0, import_node_fs2.statSync)((0, import_node_path2.join)(dir, f)).mtimeMs })).sort((a, b) => b.mtimeMs - a.mtimeMs).slice(0, 100);
1321
+ } catch {
1322
+ return [];
1323
+ }
1324
+ }
1325
+ function registerSavedReportResources(server2) {
1326
+ server2.registerResource(
1327
+ "saved-report",
1328
+ new import_mcp.ResourceTemplate("report://{filename}", {
1329
+ list: () => ({
1330
+ resources: listSavedReports().map((r) => ({
1331
+ uri: `report://${encodeURIComponent(r.filename)}`,
1332
+ name: r.filename,
1333
+ mimeType: "text/markdown"
1334
+ }))
1335
+ })
1336
+ }),
1337
+ {
1338
+ title: "Saved MCP Scraper Reports",
1339
+ description: "Markdown research reports saved by previous MCP Scraper tool calls. Read a report to reuse prior research without re-scraping or spending credits.",
1340
+ mimeType: "text/markdown"
1341
+ },
1342
+ async (uri, variables) => {
1343
+ const requested = Array.isArray(variables.filename) ? variables.filename[0] : variables.filename;
1344
+ const filename = (0, import_node_path2.basename)(decodeURIComponent(String(requested ?? "")));
1345
+ if (!filename.endsWith(".md")) throw new Error("Only saved .md reports can be read");
1346
+ const text = (0, import_node_fs2.readFileSync)((0, import_node_path2.join)(outputBaseDir(), filename), "utf8");
1347
+ return { contents: [{ uri: uri.href, mimeType: "text/markdown", text }] };
1348
+ }
1349
+ );
1350
+ }
1315
1351
  function buildPaaExtractorMcpServer(executor2, options = {}) {
1316
1352
  const savesReports = options.savesReportsLocally !== false;
1317
1353
  const reportNote = savesReports ? " Saves a full Markdown report locally." : " Reports are returned inline; no files are saved on this hosted endpoint.";
1318
1354
  const withReportNote = (description) => `${description}${reportNote}`;
1319
1355
  const server2 = new import_mcp.McpServer({ name: "mcp-scraper", version: PACKAGE_VERSION });
1356
+ if (savesReports) registerSavedReportResources(server2);
1320
1357
  server2.registerTool("harvest_paa", {
1321
1358
  title: "Google PAA + SERP Harvest",
1322
- description: withReportNote('Best default tool for Google search research. Extracts People Also Ask questions plus answers/source URLs, organic SERP, local pack when present, entity IDs (CID/GCID/KG MID), and AI Overview. Infer the user language: split topic from location (e.g. "best hvac company in Denver CO" => query "best hvac company", location "Denver, CO", gl "us", hl "en"). Use maxQuestions 30 normally, 100-150 for "full", "deep", "all", or comprehensive research. Credits are charged by extracted question; unused request hold is refunded.'),
1359
+ description: withReportNote('Best default tool for Google search research. Extracts People Also Ask questions plus answers/source URLs, organic SERP, local pack when present, entity IDs (CID/GCID/KG MID), and AI Overview. Infer the user language: split topic from location (e.g. "best hvac company in Denver CO" => query "best hvac company", location "Denver, CO", gl "us", hl "en"). Use maxQuestions 30 normally, 100-200 for "full", "deep", "all", or comprehensive research. Deep harvests above 100 questions can run for several minutes with no interim progress \u2014 warn the user before starting one and keep maxQuestions at or below 100 unless they explicitly want a deep harvest. Credits are charged by extracted question; unused request hold is refunded.'),
1323
1360
  inputSchema: HarvestPaaInputSchema,
1324
1361
  outputSchema: HarvestPaaOutputSchema,
1325
1362
  annotations: liveWebToolAnnotations("Google PAA + SERP Harvest")
@@ -1418,10 +1455,10 @@ function buildPaaExtractorMcpServer(executor2, options = {}) {
1418
1455
  // bin/mcp-stdio-server.ts
1419
1456
  function readApiKeyFile() {
1420
1457
  const explicitPath = process.env.MCP_SCRAPER_KEY_PATH?.trim();
1421
- const paths = [explicitPath, (0, import_node_path2.join)((0, import_node_os2.homedir)(), ".mcp-scraper-key")].filter(Boolean);
1458
+ const paths = [explicitPath, (0, import_node_path3.join)((0, import_node_os2.homedir)(), ".mcp-scraper-key")].filter(Boolean);
1422
1459
  for (const path of paths) {
1423
1460
  try {
1424
- const value = (0, import_node_fs2.readFileSync)(path, "utf8").trim();
1461
+ const value = (0, import_node_fs3.readFileSync)(path, "utf8").trim();
1425
1462
  if (value) return value;
1426
1463
  } catch {
1427
1464
  }