@crawlbrulee/mcp 1.0.2 → 1.0.3

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 (2) hide show
  1. package/dist/index.js +48 -35
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -221,6 +221,19 @@ const Schema_ApiMapRequest = z.object({
221
221
  location: Schema_ApiMapLocation.optional()
222
222
  });
223
223
 
224
+ //#endregion
225
+ //#region src/schemas/openEnum.ts
226
+ /**
227
+ * A response enum the api may extend later. The known values still show up in the
228
+ * tool's output schema, so a reader sees them, but any string is accepted: a value
229
+ * added on the server must not make a validating host refuse the whole result.
230
+ *
231
+ * Output only. Request enums stay closed, so a typo in tool input is still caught.
232
+ */
233
+ function openEnum(values) {
234
+ return z.union([z.enum(values), z.string()]);
235
+ }
236
+
224
237
  //#endregion
225
238
  //#region src/schemas/ApiMapResponse.ts
226
239
  const API_RESOLVED_PROXY_TIER_VALUES$1 = ["basic", "advanced"];
@@ -234,31 +247,31 @@ const DISCOVERY_CAP_REASONS = [
234
247
  "unread_files"
235
248
  ];
236
249
  /** Map usage has no screenshot-slice add-on. */
237
- const Schema_ApiMapUsageMeta = z.object({
250
+ const Schema_ApiMapUsageMeta = z.looseObject({
238
251
  credits: z.number().int().nonnegative().describe("Credits charged for this map request"),
239
- engine: z.enum(["http", "cache"]).describe("The map billing engine: `http` for fresh discovery or `cache` for a cached result"),
240
- proxy: z.enum(API_RESOLVED_PROXY_TIER_VALUES$1).describe("The proxy tier the request actually ran on (resolved value — never `auto`)")
252
+ engine: openEnum(["http", "cache"]).describe("The map billing engine: `http` for fresh discovery or `cache` for a cached result"),
253
+ proxy: openEnum(API_RESOLVED_PROXY_TIER_VALUES$1).describe("The proxy tier the request actually ran on (resolved value — never `auto`)")
241
254
  });
242
- const Schema_ApiMapLinkItem = z.object({ url: z.string().describe("The discovered URL") });
243
- const Schema_ApiMapPagination = z.object({
255
+ const Schema_ApiMapLinkItem = z.looseObject({ url: z.string().describe("The discovered URL") });
256
+ const Schema_ApiMapPagination = z.looseObject({
244
257
  page: z.number().int().positive().describe("Current page number"),
245
258
  limit: z.number().int().positive().describe("Number of items per page"),
246
259
  total: z.number().int().nonnegative().describe("Total number of URLs in the map"),
247
260
  total_pages: z.number().int().nonnegative().describe("Total number of pages available"),
248
261
  has_more: z.boolean().describe("Whether more pages are available")
249
262
  });
250
- const Schema_ApiMapTruncation = z.object({
263
+ const Schema_ApiMapTruncation = z.looseObject({
251
264
  storage_capped: z.boolean().describe("Whether the stored map hit the 100000-URL storage cap."),
252
265
  response_capped: z.boolean().describe("Whether more links were eligible than max_urls, so the list was trimmed. Discovery itself stops at max_urls, so this is normally true only when home-page links pushed the total past it. See discovery_cap_reason for a discovery stop."),
253
266
  total_before_max_urls: z.number().int().nonnegative().describe("Total URLs found before applying the max_urls cap"),
254
267
  total_detected_before_storage_cap: z.number().int().nonnegative().describe("Total URLs detected during discovery before the storage cap was applied"),
255
268
  discovery_capped: z.boolean().describe("Whether sitemap discovery stopped before it had read every sitemap file it found. When true, the site has more pages than this map lists."),
256
269
  sitemaps_skipped: z.number().int().nonnegative().describe("How many sitemap files were skipped or only partly read during discovery, because a file was too large, could not be fetched, or the discovery limits were reached."),
257
- discovery_cap_reason: z.enum(DISCOVERY_CAP_REASONS).nullable().describe("Which limit stopped sitemap discovery first, or null when nothing stopped it. \"max_urls\" means your own max_urls was reached — ask again with a higher one to get more. \"time\" means discovery ran out of its time budget, \"file_budget\" that the site has more sitemap files than one request reads, \"depth\" that its sitemap indexes nest too deeply, and \"file_size\" that a sitemap file was too large to read. \"unread_files\" means a sitemap file the site publishes could not be read at all this time — the request for it failed or was rate limited, or the file was not a readable sitemap. Only \"max_urls\" is a limit you can raise from the request; \"unread_files\" is often temporary, so asking again later can return more.")
270
+ discovery_cap_reason: openEnum(DISCOVERY_CAP_REASONS).nullable().describe("Which limit stopped sitemap discovery first, or null when nothing stopped it. \"max_urls\" means your own max_urls was reached — ask again with a higher one to get more. \"time\" means discovery ran out of its time budget, \"file_budget\" that the site has more sitemap files than one request reads, \"depth\" that its sitemap indexes nest too deeply, and \"file_size\" that a sitemap file was too large to read. \"unread_files\" means a sitemap file the site publishes could not be read at all this time — the request for it failed or was rate limited, or the file was not a readable sitemap. Only \"max_urls\" is a limit you can raise from the request; \"unread_files\" is often temporary, so asking again later can return more.")
258
271
  });
259
- const Schema_ApiMapResult = z.object({
272
+ const Schema_ApiMapResult = z.looseObject({
260
273
  links: z.array(Schema_ApiMapLinkItem).describe("List of discovered URLs for the current page"),
261
- response_meta: z.object({
274
+ response_meta: z.looseObject({
262
275
  pagination: Schema_ApiMapPagination.describe("Pagination details for the result set"),
263
276
  truncation: Schema_ApiMapTruncation.describe("Information about whether the results were truncated"),
264
277
  usage: Schema_ApiMapUsageMeta.describe("Usage accounting for this map request: credits charged, the billed engine, and the resolved proxy tier.")
@@ -292,59 +305,59 @@ function registerMapTool(server, getClient) {
292
305
  title: "Map a website",
293
306
  description: DESCRIPTION$6,
294
307
  inputSchema: Schema_ApiMapRequest.shape,
295
- outputSchema: Schema_ApiMapResult.shape
308
+ outputSchema: Schema_ApiMapResult
296
309
  }, (args) => runTool(async () => await getClient().map(args)));
297
310
  }
298
311
 
299
312
  //#endregion
300
313
  //#region src/schemas/ApiScrapeResponse.ts
301
- const Schema_ApiViewport = z.object({
314
+ const Schema_ApiViewport = z.looseObject({
302
315
  width: z.number().describe("Viewport width in pixels"),
303
316
  height: z.number().describe("Viewport height in pixels"),
304
317
  device_scale_factor: z.number().describe("Device pixel ratio used for the capture")
305
318
  });
306
- const Schema_ApiScreenshotProperties = z.object({
319
+ const Schema_ApiScreenshotProperties = z.looseObject({
307
320
  file_name: z.string().describe("File name of the screenshot image"),
308
321
  mime: z.string().describe("MIME type of the screenshot (e.g. image/png)"),
309
322
  width: z.number().describe("Image width in pixels"),
310
323
  height: z.number().describe("Image height in pixels"),
311
324
  viewport: Schema_ApiViewport.describe("Viewport dimensions used during capture")
312
325
  });
313
- const Schema_ApiScreenshotSlice = z.object({
326
+ const Schema_ApiScreenshotSlice = z.looseObject({
314
327
  row_nr: z.number().describe("Row index of this slice (0-based)"),
315
328
  url: z.string().describe("URL to download this slice image"),
316
329
  type: z.literal("slice").describe("Slice type identifier"),
317
330
  properties: Schema_ApiScreenshotProperties.describe("Image properties for this slice")
318
331
  });
319
- const Schema_ApiScreenshotResponse = z.object({
332
+ const Schema_ApiScreenshotResponse = z.looseObject({
320
333
  url: z.string().describe("URL to download the full screenshot image"),
321
- type: Schema_ApiScrapeScreenshotType.describe("Screenshot capture mode that was used"),
334
+ type: openEnum(["viewport", "full_page"]).describe("Screenshot capture mode that was used"),
322
335
  properties: Schema_ApiScreenshotProperties.describe("Image properties for the full screenshot"),
323
336
  slices: z.array(Schema_ApiScreenshotSlice).optional().describe("Individual tile slices (present when slice action_after was requested)")
324
337
  });
325
- const Schema_ApiPageInlineImgItem = z.object({
338
+ const Schema_ApiPageInlineImgItem = z.looseObject({
326
339
  url: z.string().describe("Absolute URL of the image"),
327
340
  alt: z.string().nullable().describe("Alt text of the image, or null if not set")
328
341
  });
329
- const Schema_ApiPageLink = z.object({
342
+ const Schema_ApiPageLink = z.looseObject({
330
343
  text: z.string().describe("Anchor text of the link"),
331
344
  href: z.string().describe("The link URL as written on the page, resolved to an absolute URL; verbatim otherwise (query string, fragment, and duplicates preserved)"),
332
345
  internal: z.boolean().describe("Whether the link points to the same domain (www and the bare domain are equivalent; other subdomains are external)")
333
346
  });
334
347
  const API_RESOLVED_PROXY_TIER_VALUES = ["basic", "advanced"];
335
- const Schema_ApiUsageMeta = z.object({
348
+ const Schema_ApiUsageMeta = z.looseObject({
336
349
  credits: z.number().int().nonnegative().describe("Credits actually charged for this request. Always equals the engine base × the proxy multiplier, plus screenshot_slices. A cache hit has engine \"cache\" (base 0), so it costs only the parts we still had to compute — a newly produced screenshot-slice variant — and is otherwise free."),
337
- engine: z.enum([
350
+ engine: openEnum([
338
351
  "http",
339
352
  "browser",
340
353
  "screenshot",
341
354
  "cache"
342
355
  ]).describe("The engine base the request was billed at — \"http\" (1 credit), \"browser\" (3), \"screenshot\" (5), or \"cache\" (0, the result was served from cache) — before the proxy multiplier. Reflects what was delivered, never what was requested."),
343
- proxy: z.enum(API_RESOLVED_PROXY_TIER_VALUES).describe("The proxy tier the request actually ran on (resolved value — never `auto`; `auto` is resolved server-side to `basic` or `advanced`)."),
356
+ proxy: openEnum(API_RESOLVED_PROXY_TIER_VALUES).describe("The proxy tier the request actually ran on (resolved value — never `auto`; `auto` is resolved server-side to `basic` or `advanced`)."),
344
357
  screenshot_slices: z.number().int().nonnegative().describe("Whether this request was billed the screenshot-split add-on: 1 when the screenshot was split on this request (a flat +1 credit outside the proxy multiplier, regardless of how many slices the split produced), else 0 — including a cache hit that reused an already-existing slice variant.")
345
358
  });
346
- const Schema_ApiResponseMeta = z.object({ usage: Schema_ApiUsageMeta.describe("Usage accounting for this request: credits charged, billed engine, resolved proxy tier, and screenshot-slice add-on.") });
347
- const Schema_ApiScrapeMeta = z.object({
359
+ const Schema_ApiResponseMeta = z.looseObject({ usage: Schema_ApiUsageMeta.describe("Usage accounting for this request: credits charged, billed engine, resolved proxy tier, and screenshot-slice add-on.") });
360
+ const Schema_ApiScrapeMeta = z.looseObject({
348
361
  title: z.string().optional().describe("Page title from the <title> tag"),
349
362
  description: z.string().optional().describe("Meta description"),
350
363
  keywords: z.array(z.string()).optional().describe("Meta keywords"),
@@ -368,7 +381,7 @@ const Schema_ApiScrapeMeta = z.object({
368
381
  robots: z.string().optional().describe("Robots meta directive (e.g. noindex, nofollow)"),
369
382
  favicon_url: z.string().nullish().describe("Resolved favicon URL for the page (best-effort, from <head> icon hints + manifest)")
370
383
  });
371
- const Schema_ApiScrapeSuccessResponse = z.object({
384
+ const Schema_ApiScrapeSuccessResponse = z.looseObject({
372
385
  url: z.string().describe("The URL that was actually scraped, after any redirects, in normalized form — the base that links, images, and internal labels are computed against"),
373
386
  requested_url: z.string().describe("The URL you requested, echoed verbatim — before any redirects"),
374
387
  content_type: z.string().optional().describe("Content-Type header returned by the server"),
@@ -412,7 +425,7 @@ function registerScrapeTool(server, getClient) {
412
425
  title: "Scrape a URL",
413
426
  description: DESCRIPTION$5,
414
427
  inputSchema: Schema_ApiScrapeRequest.shape,
415
- outputSchema: Schema_ApiScrapeSuccessResponse.shape
428
+ outputSchema: Schema_ApiScrapeSuccessResponse
416
429
  }, (args) => runTool(async () => await getClient().scrape(args)));
417
430
  }
418
431
 
@@ -433,10 +446,10 @@ const ASYNC_JOB_STATUS_VALUES = [
433
446
  "failed"
434
447
  ];
435
448
  const Schema_AsyncJobId = z.object({ job_id: z.string().describe("Job identifier returned by the `scrape_async` tool") });
436
- const Schema_ApiScrapeAsyncResponse = z.object({ job_id: z.string().describe("Job identifier — pass it to the `scrape_status` / `scrape_result` tools") });
437
- const Schema_ApiScrapeStatusResponse = z.object({
449
+ const Schema_ApiScrapeAsyncResponse = z.looseObject({ job_id: z.string().describe("Job identifier — pass it to the `scrape_status` / `scrape_result` tools") });
450
+ const Schema_ApiScrapeStatusResponse = z.looseObject({
438
451
  job_id: z.string().describe("The job identifier"),
439
- status: z.enum(ASYNC_JOB_STATUS_VALUES).describe("Current state of the job (pending, running, done, failed)"),
452
+ status: openEnum(ASYNC_JOB_STATUS_VALUES).describe("Current state of the job (pending, running, done, failed)"),
440
453
  created_at: z.string().describe("ISO-8601 UTC timestamp when the job was created"),
441
454
  error: z.string().optional().describe("Error message if the job ended in `failed`"),
442
455
  response_meta: Schema_ApiResponseMeta.optional().describe("Usage accounting for the finished job. Present only once the job is `done`; `response_meta.usage` reports credits charged, the billed engine, the resolved proxy tier, and any screenshot-slice add-on.")
@@ -460,7 +473,7 @@ function registerScrapeAsyncTool(server, getClient) {
460
473
  title: "Scrape a URL asynchronously",
461
474
  description: DESCRIPTION$4,
462
475
  inputSchema: Schema_ApiScrapeAsyncRequest.shape,
463
- outputSchema: Schema_ApiScrapeAsyncResponse.shape
476
+ outputSchema: Schema_ApiScrapeAsyncResponse
464
477
  }, (args) => runTool(async () => await getClient().scrapeAsync(args)));
465
478
  }
466
479
 
@@ -478,7 +491,7 @@ function registerScrapeResultTool(server, getClient) {
478
491
  title: "Get an async scrape job result",
479
492
  description: DESCRIPTION$3,
480
493
  inputSchema: Schema_AsyncJobId.shape,
481
- outputSchema: Schema_ApiScrapeSuccessResponse.shape
494
+ outputSchema: Schema_ApiScrapeSuccessResponse
482
495
  }, (args) => runTool(async () => await getClient().getScrapeResult(args.job_id)));
483
496
  }
484
497
 
@@ -498,13 +511,13 @@ function registerScrapeStatusTool(server, getClient) {
498
511
  title: "Check an async scrape job status",
499
512
  description: DESCRIPTION$2,
500
513
  inputSchema: Schema_AsyncJobId.shape,
501
- outputSchema: Schema_ApiScrapeStatusResponse.shape
514
+ outputSchema: Schema_ApiScrapeStatusResponse
502
515
  }, (args) => runTool(async () => await getClient().getScrapeStatus(args.job_id)));
503
516
  }
504
517
 
505
518
  //#endregion
506
519
  //#region src/schemas/ApiUsageResponse.ts
507
- const Schema_ApiUsageResponse = z.object({
520
+ const Schema_ApiUsageResponse = z.looseObject({
508
521
  total_credits: z.number().int().nonnegative().describe("Total credits available for the current billing cycle (plan base + purchased + gifted)."),
509
522
  used_credits: z.number().int().nonnegative().describe("Credits spent so far in the current billing cycle. May exceed total_credits on plans that allow overages."),
510
523
  available_credits: z.number().int().nonnegative().describe("Remaining credits (max(0, total_credits - used_credits)). Clamped to 0 when in overage."),
@@ -525,13 +538,13 @@ function registerUsageTool(server, getClient) {
525
538
  title: "Get current usage",
526
539
  description: DESCRIPTION$1,
527
540
  inputSchema: {},
528
- outputSchema: Schema_ApiUsageResponse.shape
541
+ outputSchema: Schema_ApiUsageResponse
529
542
  }, () => runTool(async () => await getClient().usage()));
530
543
  }
531
544
 
532
545
  //#endregion
533
546
  //#region src/schemas/ApiWhoamiResponse.ts
534
- const Schema_ApiWhoamiResponse = z.object({
547
+ const Schema_ApiWhoamiResponse = z.looseObject({
535
548
  organization_name: z.string().describe("Display name of the organization that owns the token."),
536
549
  token_name: z.string().describe("User-assigned name of the API token authenticating the request."),
537
550
  token_preview: z.string().describe("Truncated preview of the API token (e.g. `cwbl_…xyz`). Safe to display; does not authenticate.")
@@ -549,14 +562,14 @@ function registerWhoamiTool(server, getClient) {
549
562
  title: "Identify the API token",
550
563
  description: DESCRIPTION,
551
564
  inputSchema: {},
552
- outputSchema: Schema_ApiWhoamiResponse.shape
565
+ outputSchema: Schema_ApiWhoamiResponse
553
566
  }, () => runTool(async () => await getClient().whoami()));
554
567
  }
555
568
 
556
569
  //#endregion
557
570
  //#region src/version.ts
558
571
  const SERVER_NAME = "crawlbrulee";
559
- const SERVER_VERSION = "1.0.2";
572
+ const SERVER_VERSION = "1.0.3";
560
573
 
561
574
  //#endregion
562
575
  //#region src/server.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crawlbrulee/mcp",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "mcpName": "io.github.crawlbrulee/mcp",
5
5
  "description": "official mcp server for crawlbrulee — EU-native web scraping for AI agents & developers. native scrape and map tools for your agent.",
6
6
  "keywords": [