@crawlbrulee/mcp 0.8.0 → 0.10.0

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 (3) hide show
  1. package/README.md +8 -7
  2. package/dist/index.js +67 -50
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -13,7 +13,7 @@ the official [mcp](https://modelcontextprotocol.io) server for the [crawlbrulee]
13
13
  this readme covers the mcp server itself — its tools and how to wire it into a host. for how the api behaves — endpoints, parameters, and error semantics — please see our
14
14
  [api docs](https://crawlbrulee.com/docs).
15
15
 
16
- > **status:** v0.8.0 (beta). tool surface is stabilizing — expect minor changes between 0.x releases.
16
+ > **status:** v0.10.0 (beta). tool surface is stabilizing — expect minor changes between 0.x releases.
17
17
 
18
18
  **get a free api key** → [dashboard.crawlbrulee.com](https://dashboard.crawlbrulee.com)
19
19
 
@@ -90,9 +90,10 @@ html, raw html, links, images, screenshot, page metadata).
90
90
  "metadata": { "title": "Example Domain" },
91
91
  "response_meta": {
92
92
  "usage": {
93
- "credits": 1, // 0 on a fully cached result — only parts still computed fresh are charged
93
+ "credits": 1,
94
+ "engine": "text", // "text" | "browser" | "screenshot" | "cache"
94
95
  "proxy": "basic", // resolved tier actually used: "basic" | "advanced" (never "auto")
95
- "cache_hit": false, // whether the result was served from cache
96
+ "screenshot_slices": 0, // 1 when the screenshot-split add-on was billed, otherwise 0
96
97
  },
97
98
  },
98
99
  }
@@ -135,13 +136,13 @@ takes the same input as `scrape` plus an optional per-job completion `webhook`:
135
136
 
136
137
  **output** — `{ "job_id": "..." }`.
137
138
 
138
- when a `webhook` is attached, we deliver a single signed `scrape.complete` POST to your endpoint once the job reaches a terminal state, with your `metadata` echoed under `data.metadata` and the job's usage under `data.response_meta.usage` — so you can react to completion (and reconcile cost) without polling. verify the `X-Cwbl-Signature` header with the sdk's `verifyWebhookSignature` (configure the signing secret in the dashboard under account → webhooks).
139
+ when a `webhook` is attached, we deliver a single signed `scrape.complete` POST to your endpoint once the job reaches a terminal state, with your `metadata` echoed under `data.metadata` and the job's usage under `data.response_meta.usage` — so you can react to completion (and track cost) without polling. verify the `X-Cwbl-Signature` header with the sdk's `verifyWebhookSignature` (configure the signing secret in the dashboard under account → webhooks).
139
140
 
140
141
  the job lifecycle is documented under [async scrape](https://crawlbrulee.com/docs/scrape/async); the delivery contract and payload shape under [webhooks](https://crawlbrulee.com/docs/scrape/webhooks), with the signature scheme in [webhook verification](https://crawlbrulee.com/docs/webhook-verification).
141
142
 
142
143
  ### `scrape_status`
143
144
 
144
- look up the current lifecycle status of an async job: `pending`, `running`, `done`, or `failed` (with an `error` message when failed). once the job is `done` the response also carries a `response_meta.usage` block (`credits`, resolved `proxy` tier, `cache_hit`). poll until `done`, then call `scrape_result`.
145
+ look up the current lifecycle status of an async job: `pending`, `running`, `done`, or `failed` (with an `error` message when failed). once the job is `done` the response also carries a `response_meta.usage` block (`credits`, billed `engine`, resolved `proxy` tier, `screenshot_slices`). a cache hit is represented by `engine: "cache"`. poll until `done`, then call `scrape_result`.
145
146
 
146
147
  ```jsonc
147
148
  { "job_id": "..." }
@@ -157,7 +158,7 @@ fetch the extracted content of a completed async job — the same result shape a
157
158
 
158
159
  ### `map`
159
160
 
160
- build (or fetch a cached) link-map for a website. combines sitemap discovery with homepage link extraction. use this to enumerate a site before scraping selected pages. the response's `response_meta` carries `pagination`, `truncation`, and a `usage` block (`credits`, resolved `proxy` tier, `cache_hit`).
161
+ build (or fetch a cached) link-map for a website. combines sitemap discovery with homepage link extraction. use this to enumerate a site before scraping selected pages. the response's `response_meta` carries `pagination`, `truncation`, and a `usage` block (`credits`, billed `engine`, resolved `proxy` tier). map responses do not include screenshot-slice accounting.
161
162
 
162
163
  ```jsonc
163
164
  {
@@ -184,7 +185,7 @@ returns the organization name, token name, and truncated token preview for the c
184
185
 
185
186
  ## errors
186
187
 
187
- every tool returns an mcp error envelope (`isError: true`) when the api call fails. the error text follows a stable format:
188
+ every tool returns an mcp error result (`isError: true`) when the api call fails. the error text follows a stable format:
188
189
 
189
190
  ```
190
191
  [<errorName>] <message> (HTTP <status>)
package/dist/index.js CHANGED
@@ -203,6 +203,56 @@ const Schema_ApiMapRequest = z.object({
203
203
  location: Schema_ApiMapLocation.optional()
204
204
  });
205
205
 
206
+ //#endregion
207
+ //#region src/schemas/ApiMapResponse.ts
208
+ const API_RESOLVED_PROXY_TIER_VALUES$1 = ["basic", "advanced"];
209
+ /** Map usage has no screenshot-slice add-on. */
210
+ const Schema_ApiMapUsageMeta = z.object({
211
+ credits: z.number().int().nonnegative().describe("Credits charged for this map request"),
212
+ engine: z.enum(["text", "cache"]).describe("The map billing engine: `text` for fresh discovery or `cache` for a cached result"),
213
+ proxy: z.enum(API_RESOLVED_PROXY_TIER_VALUES$1).describe("The proxy tier the request actually ran on (resolved value — never `auto`)")
214
+ });
215
+ const Schema_ApiMapLinkItem = z.object({ url: z.string().describe("The discovered URL") });
216
+ const Schema_ApiMapPagination = z.object({
217
+ page: z.number().int().positive().describe("Current page number"),
218
+ limit: z.number().int().positive().describe("Number of items per page"),
219
+ total: z.number().int().nonnegative().describe("Total number of URLs in the map"),
220
+ total_pages: z.number().int().nonnegative().describe("Total number of pages available"),
221
+ has_more: z.boolean().describe("Whether more pages are available")
222
+ });
223
+ const Schema_ApiMapTruncation = z.object({
224
+ storage_capped: z.boolean().describe("Whether the stored map was capped by the max_urls limit"),
225
+ response_capped: z.boolean().describe("Whether the response was capped by pagination"),
226
+ total_before_max_urls: z.number().int().nonnegative().describe("Total URLs found before applying the max_urls cap"),
227
+ total_detected_before_storage_cap: z.number().int().nonnegative().describe("Total URLs detected during discovery before the storage cap was applied")
228
+ });
229
+ const Schema_ApiMapResult = z.object({
230
+ links: z.array(Schema_ApiMapLinkItem).describe("List of discovered URLs for the current page"),
231
+ response_meta: z.object({
232
+ pagination: Schema_ApiMapPagination.describe("Pagination details for the result set"),
233
+ truncation: Schema_ApiMapTruncation.describe("Information about whether the results were truncated"),
234
+ usage: Schema_ApiMapUsageMeta.describe("Usage accounting for this map request: credits charged, the billed engine, and the resolved proxy tier.")
235
+ }).describe("Response metadata including pagination, truncation, and usage info")
236
+ });
237
+
238
+ //#endregion
239
+ //#region src/tools/map.ts
240
+ const DESCRIPTION$6 = [
241
+ "Build (or fetch a cached) link-map for a website by combining sitemap discovery with homepage",
242
+ "link extraction. Returns paginated lists of discovered URLs. Filterable by link type",
243
+ "(internal / external / subdomain). Use this to enumerate a site before scraping selected pages.",
244
+ "The response carries `response_meta.usage` = { credits, engine, proxy } — the resolved proxy",
245
+ "tier is never `auto`; map responses do not include screenshot-slice accounting."
246
+ ].join(" ");
247
+ function registerMapTool(server, getClient) {
248
+ server.registerTool("map", {
249
+ title: "Map a website",
250
+ description: DESCRIPTION$6,
251
+ inputSchema: Schema_ApiMapRequest.shape,
252
+ outputSchema: Schema_ApiMapResult.shape
253
+ }, (args) => runTool(async () => await getClient().map(args)));
254
+ }
255
+
206
256
  //#endregion
207
257
  //#region src/schemas/ApiScrapeResponse.ts
208
258
  const Schema_ApiViewport = z.object({
@@ -240,11 +290,17 @@ const Schema_ApiPageLink = z.object({
240
290
  });
241
291
  const API_RESOLVED_PROXY_TIER_VALUES = ["basic", "advanced"];
242
292
  const Schema_ApiUsageMeta = z.object({
243
- credits: z.number().int().nonnegative().describe("Credits charged for this request. `0` on a fully cached result; only parts still computed fresh (e.g. a newly produced screenshot-slice variant) are charged."),
293
+ 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."),
294
+ engine: z.enum([
295
+ "text",
296
+ "browser",
297
+ "screenshot",
298
+ "cache"
299
+ ]).describe("The engine base the request was billed at — \"text\" (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."),
244
300
  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`)."),
245
- cache_hit: z.boolean().describe("Whether the result was served from cache (`true`) or freshly fetched (`false`).")
301
+ 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.")
246
302
  });
247
- const Schema_ApiResponseMeta = z.object({ usage: Schema_ApiUsageMeta.describe("Usage accounting for this request: credits charged, resolved proxy tier, and cache-hit flag.") });
303
+ 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.") });
248
304
  const Schema_ApiScrapeMeta = z.object({
249
305
  title: z.string().optional().describe("Page title from the <title> tag"),
250
306
  description: z.string().optional().describe("Meta description"),
@@ -282,50 +338,9 @@ const Schema_ApiScrapeSuccessResponse = z.object({
282
338
  screenshot: Schema_ApiScreenshotResponse.optional().describe("Screenshot of the page, if requested"),
283
339
  metadata: Schema_ApiScrapeMeta.optional().describe("Extracted page metadata (title, OG tags, etc.)"),
284
340
  warnings: z.array(z.string()).optional().describe("Non-error notices about the scrape. Truncation codes — `screenshot_truncated` (long page exceeded the scrolling-screenshot height cap), `links_truncated` / `inline_images_truncated` (page had more links/images than the per-page extraction caps), `raw_html_truncated` / `metadata_truncated` (rendered HTML exceeded the per-page size budget) — mean the field is present but capped. Unavailability codes — `links_unavailable` / `inline_images_unavailable` / `metadata_unavailable` — mean that optional field could not be extracted and was omitted (null/empty) while the rest of the scrape succeeded, so an empty field carrying one of these does NOT mean the page had none. Stable string codes — clients can switch on them. Warnings are stored with the result: async result fetches and cache hits carry them too, filtered to the fields the request asked for."),
285
- response_meta: Schema_ApiResponseMeta.describe("Request-level metadata. `response_meta.usage` reports credits charged (0 on a fully cached result; only parts still computed fresh are charged), the resolved proxy tier, and the cache-hit flag.")
341
+ response_meta: Schema_ApiResponseMeta.describe("Request-level metadata. `response_meta.usage` reports credits charged, the billed engine, the resolved proxy tier, and any screenshot-slice add-on.")
286
342
  });
287
343
 
288
- //#endregion
289
- //#region src/schemas/ApiMapResponse.ts
290
- const Schema_ApiMapLinkItem = z.object({ url: z.string().describe("The discovered URL") });
291
- const Schema_ApiMapPagination = z.object({
292
- page: z.number().int().positive().describe("Current page number"),
293
- limit: z.number().int().positive().describe("Number of items per page"),
294
- total: z.number().int().nonnegative().describe("Total number of URLs in the map"),
295
- total_pages: z.number().int().nonnegative().describe("Total number of pages available"),
296
- has_more: z.boolean().describe("Whether more pages are available")
297
- });
298
- const Schema_ApiMapTruncation = z.object({
299
- storage_capped: z.boolean().describe("Whether the stored map was capped by the max_urls limit"),
300
- response_capped: z.boolean().describe("Whether the response was capped by pagination"),
301
- total_before_max_urls: z.number().int().nonnegative().describe("Total URLs found before applying the max_urls cap"),
302
- total_detected_before_storage_cap: z.number().int().nonnegative().describe("Total URLs detected during discovery before the storage cap was applied")
303
- });
304
- const Schema_ApiMapResult = z.object({
305
- links: z.array(Schema_ApiMapLinkItem).describe("List of discovered URLs for the current page"),
306
- response_meta: z.object({
307
- pagination: Schema_ApiMapPagination.describe("Pagination details for the result set"),
308
- truncation: Schema_ApiMapTruncation.describe("Information about whether the results were truncated"),
309
- usage: Schema_ApiUsageMeta.describe("Usage accounting for this map request: credits charged (0 on a fully cached result; only parts still computed fresh are charged), the resolved proxy tier, and the cache-hit flag.")
310
- }).describe("Response metadata including pagination, truncation, and usage info")
311
- });
312
-
313
- //#endregion
314
- //#region src/tools/map.ts
315
- const DESCRIPTION$6 = [
316
- "Build (or fetch a cached) link-map for a website by combining sitemap discovery with homepage",
317
- "link extraction. Returns paginated lists of discovered URLs. Filterable by link type",
318
- "(internal / external / subdomain). Use this to enumerate a site before scraping selected pages."
319
- ].join(" ");
320
- function registerMapTool(server, getClient) {
321
- server.registerTool("map", {
322
- title: "Map a website",
323
- description: DESCRIPTION$6,
324
- inputSchema: Schema_ApiMapRequest.shape,
325
- outputSchema: Schema_ApiMapResult.shape
326
- }, (args) => runTool(async () => await getClient().map(args)));
327
- }
328
-
329
344
  //#endregion
330
345
  //#region src/tools/scrape.ts
331
346
  const DESCRIPTION$5 = [
@@ -333,8 +348,9 @@ const DESCRIPTION$5 = [
333
348
  "(markdown, cleaned HTML, raw HTML, links, images, screenshot, page metadata in `metadata`).",
334
349
  "Use this for one-shot page extraction. For full-site discovery use the `map` tool first.",
335
350
  "Screenshot URLs in the response are signed download links — the agent can fetch them when needed.",
336
- "The response also carries `response_meta.usage` = { credits (0 on a fully cached result; only",
337
- "parts still computed fresh are charged), proxy (the resolved tier — never `auto`), cache_hit }",
351
+ "The response also carries `response_meta.usage` = { credits, engine, proxy (the resolved tier —",
352
+ "never `auto`), screenshot_slices }. `engine` is the billed engine (`text`, `browser`, `screenshot`,",
353
+ "`cache`); a cache hit is represented by `engine: \"cache\"`.",
338
354
  "so you can see what the request cost.",
339
355
  "Extraction is capped per page: 30,000 links, 10,000 inline images, 10,000,000 characters of body",
340
356
  "HTML and 2,000,000 characters of head HTML. A page past a cap is truncated rather than refused,",
@@ -377,7 +393,7 @@ const Schema_ApiScrapeStatusResponse = z.object({
377
393
  status: z.enum(ASYNC_JOB_STATUS_VALUES).describe("Current state of the job (pending, running, done, failed)"),
378
394
  created_at: z.string().describe("ISO-8601 UTC timestamp when the job was created"),
379
395
  error: z.string().optional().describe("Error message if the job ended in `failed`"),
380
- 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 (0 on a fully cached result; only parts still computed fresh are charged), the resolved proxy tier, and the cache-hit flag.")
396
+ 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.")
381
397
  });
382
398
 
383
399
  //#endregion
@@ -425,7 +441,8 @@ function registerScrapeResultTool(server, getClient) {
425
441
  const DESCRIPTION$2 = [
426
442
  "Look up the current lifecycle status of an async scrape job submitted via `scrape_async`.",
427
443
  "Returns the job state (`pending`, `running`, `done`, `failed`), with an `error` message",
428
- "when it failed and a `response_meta.usage` block (credits, resolved proxy tier, cache_hit) once it is",
444
+ "when it failed and a `response_meta.usage` block (credits, billed engine, resolved proxy tier,",
445
+ "screenshot_slices) once it is",
429
446
  "`done`. Poll this until the status is `done`, then call `scrape_result` to fetch",
430
447
  "the page. If you registered a completion webhook on submit you can skip polling and react",
431
448
  "to the delivery instead."
@@ -493,7 +510,7 @@ function registerWhoamiTool(server, getClient) {
493
510
  //#endregion
494
511
  //#region src/version.ts
495
512
  const SERVER_NAME = "crawlbrulee";
496
- const SERVER_VERSION = "0.7.0";
513
+ const SERVER_VERSION = "0.10.0";
497
514
 
498
515
  //#endregion
499
516
  //#region src/server.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crawlbrulee/mcp",
3
- "version": "0.8.0",
3
+ "version": "0.10.0",
4
4
  "description": "Official MCP server for the crawlbrulee API — scrape and map URLs from MCP-aware agents (Claude Code, Codex, Cursor).",
5
5
  "keywords": [
6
6
  "crawlbrulee",
@@ -55,7 +55,7 @@
55
55
  "prepublishOnly": "pnpm verify"
56
56
  },
57
57
  "dependencies": {
58
- "@crawlbrulee/sdk": "^0.11.0",
58
+ "@crawlbrulee/sdk": "^0.12.0",
59
59
  "@modelcontextprotocol/sdk": "^1.29.0",
60
60
  "zod": "^4.0.0"
61
61
  },