@crawlbrulee/mcp 1.3.2 → 1.4.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 +56 -37
  2. package/dist/index.js +41 -20
  3. package/package.json +5 -5
package/README.md CHANGED
@@ -28,33 +28,37 @@ this readme covers the mcp server itself — its tools and how to wire it into a
28
28
 
29
29
  ## install
30
30
 
31
+ **1. get a key.** if you don't have a crawlbrulee account,
32
+ [sign up](https://dashboard.crawlbrulee.com/auth/register). the free plan needs no credit
33
+ card. then, in the dashboard menu, open **tokens** and click **create token**.
34
+
35
+ **2. put it in your environment.** add it to your shell profile (for example `~/.zshrc`),
36
+ then open a new terminal and start your agent from it. don't paste the key into your
37
+ agent's chat: anything in the chat stays in its history.
38
+
31
39
  ```bash
32
- # Claude Code
33
- claude mcp add crawlbrulee \
34
- --env CRAWLBRULEE_API_KEY=cwbl_... \
35
- -- npx -y @crawlbrulee/mcp
40
+ export CRAWLBRULEE_API_KEY="cwbl_..."
41
+ ```
36
42
 
37
- # Cursor — add to ~/.cursor/mcp.json:
38
- {
39
- "mcpServers": {
40
- "crawlbrulee": {
41
- "command": "npx",
42
- "args": ["-y", "@crawlbrulee/mcp"],
43
- "env": { "CRAWLBRULEE_API_KEY": "cwbl_..." }
44
- }
45
- }
46
- }
43
+ **3. add the server, with no key in its config.** in Claude Code:
44
+
45
+ ```bash
46
+ claude mcp add crawlbrulee -- npx -y @crawlbrulee/mcp
47
47
  ```
48
48
 
49
- the same pattern works for Codex, Claude Desktop, and any other host that
50
- accepts a stdio mcp launch command — set `command: npx`, `args: ["-y",
51
- "@crawlbrulee/mcp"]`, and forward `CRAWLBRULEE_API_KEY` via the env block.
49
+ other stdio hosts run the same command: `npx -y @crawlbrulee/mcp`. a few of them (Codex,
50
+ Cursor, Windsurf, Gemini CLI, Claude Desktop) need the key or the variable named in their
51
+ config file, and VS Code and the Claude Code plugin can ask for the key in a masked prompt.
52
+ the file and the entry for each one: [mcp setup in the docs](https://crawlbrulee.com/docs/mcp#install).
53
+
54
+ if a key stops working (`invalid_credentials`), it's expired, revoked or mistyped: create a
55
+ new one the same way, replace the old one, and start your agent again.
52
56
 
53
57
  ## configuration
54
58
 
55
- | env var | required | description |
56
- | --------------------- | -------- | ------------------------------------------------------------------------------ |
57
- | `CRAWLBRULEE_API_KEY` | yes | api key sent as `Authorization: Bearer …`. get one at https://crawlbrulee.com. |
59
+ | env var | required | description |
60
+ | --------------------- | -------- | -------------------------------------------------------------------------------------- |
61
+ | `CRAWLBRULEE_API_KEY` | yes | api key sent as `Authorization: Bearer …`. see [install](#install) for how to get one. |
58
62
 
59
63
  the mcp reads the env var on first tool invocation — not at startup — so a
60
64
  typo in your config surfaces as a clear tool-error message rather than the
@@ -91,32 +95,47 @@ html, raw html, links, images, screenshot, page metadata).
91
95
 
92
96
  `zero_data_retention` (boolean, default `false`) keeps the result out of the shared cache; anything stored to deliver it is kept for 24 hours, then deleted. it adds 1 credit and must be enabled for your organization. `scrape_async` takes it too. see [zero data retention](https://crawlbrulee.com/docs/zero-data-retention).
93
97
 
94
- **named values with `extract.elements`.** to pull a few values from a page — prices, titles, links — give each one a name and a CSS selector, instead of reading the whole markdown. they come back in `elements` under the same names. `all: true` returns every match as a list, and `fields` reads named values inside each match. it costs no extra credits. `scrape_async` takes it too.
98
+ **named values with `extract.elements`.** to pull a few values from a page — prices, titles, links — give each one a name and a CSS selector, instead of reading the whole markdown. they come back in `elements` under the same names. `all: true` returns every match as a list, and `fields` reads named values inside each match (`:scope` reads the match itself). it costs no extra credits. `scrape_async` takes it too.
95
99
 
96
100
  ```jsonc
97
101
  {
98
- "url": "https://books.toscrape.com/",
102
+ "url": "https://shop.example.com/books/",
99
103
  "extract": {
100
104
  "elements": {
101
105
  "heading": "h1",
102
106
  "books": {
103
- "selector": "article.product_pod",
107
+ "selector": "article.book",
104
108
  "all": true,
105
109
  "fields": {
106
110
  "title": { "selector": "h3 a", "output": "attribute", "attribute": "title" },
107
- "price": ".price_color",
111
+ "price": ".price",
108
112
  },
109
113
  },
110
114
  },
111
115
  },
112
116
  }
113
117
  // → "elements": {
114
- // "heading": "All products",
115
- // "books": [{ "title": "A Light in the Attic", "price": "£51.77" }, ...]
118
+ // "heading": "Books",
119
+ // "books": [{ "title": "The Night Garden", "price": "€18.90" }, ...]
116
120
  // }
117
121
  ```
118
122
 
119
- a name with no match is `null` (or `[]` with `all: true`). limits and selector rules: see [elements](https://crawlbrulee.com/docs/scrape/elements).
123
+ a name with no match is `null` (or `[]` with `all: true`). limits and selector rules: see [targeted extraction](https://crawlbrulee.com/docs/scrape/targeted-extraction).
124
+
125
+ **your own headers and cookies with `headers` and `cookies`.** send your own HTTP headers and cookies to the site, for example an `Authorization` header or a fixed `User-Agent` that a site has on its allowlist. headers go only to the origin of `url` (or its https version, for an http url) and cookies only to its host, never to another site on a redirect. up to 10 headers and 20 cookies. a request with headers or cookies never reads from or writes to the cache, and costs the same as a normal fresh scrape. `scrape_async` takes them too.
126
+
127
+ ```jsonc
128
+ {
129
+ "url": "https://app.example.com/orders",
130
+ "headers": { "Authorization": "Bearer ...", "X-Tenant-Id": "acme" },
131
+ "cookies": [{ "name": "session_id", "value": "a1b2c3" }],
132
+ }
133
+ ```
134
+
135
+ > [!WARNING]
136
+ > header and cookie values pass through your chat with the AI, so the AI host may keep them in its history. use short-lived tokens or a test account, and never a password you can't change.
137
+
138
+ your own `User-Agent` can lower the success rate, and the response then carries the `custom_user_agent` warning. never put secrets in the `User-Agent`. the limits and which headers can't be set: see [headers and cookies](https://crawlbrulee.com/docs/scrape/custom-headers-and-cookies).
120
139
 
121
140
  **output** — full scrape result. page metadata (title, OG tags, etc.) is returned under `metadata`. extracted `images` are returned as absolute urls — query strings are preserved, and relative `src`s are resolved against the page url. screenshots are returned as signed download urls the agent can fetch separately. in rare cases a screenshot can't be captured: when you requested other outputs too, the `screenshot` field is simply left out while the rest is still returned — but a screenshot-only call that can't deliver errors instead (`unsupported_screenshot_output`, HTTP 422, when the content type can't be screenshotted) and isn't billed. the result also carries `page_status_code` and a top-level `response_meta.usage` block:
122
141
 
@@ -146,15 +165,15 @@ a name with no match is `null` (or `[]` with `all: true`). limits and selector r
146
165
 
147
166
  alongside `response_meta.usage`, the result surfaces any non-fatal `warnings` — stable string codes an agent can switch on. an outsized page is truncated rather than refused, and the code names which part was cut:
148
167
 
149
- | code | what it means for the payload |
150
- | ------------------------- | ----------------------------------------------------------------------------------------------------- |
151
- | `screenshot_truncated` | the page was taller than the scrolling-capture height cap; the screenshot covers the top of the page. |
152
- | `links_truncated` | the page had more than 30,000 links; the `links` array is cut at the cap and is incomplete. |
153
- | `inline_images_truncated` | the page had more than 10,000 inline images; the `images` array is cut at the cap and is incomplete. |
154
- | `raw_html_truncated` | the page body exceeded 10,000,000 characters; `raw_html` is cut at a tag boundary, never mid-tag. |
155
- | `elements_truncated` | an `elements` value hit a limit; see [elements](https://crawlbrulee.com/docs/scrape/elements). |
168
+ | code | what it means for the payload |
169
+ | ------------------------- | -------------------------------------------------------------------------------------------------------------------- |
170
+ | `screenshot_truncated` | the page was taller than the scrolling-capture height cap; the screenshot covers the top of the page. |
171
+ | `links_truncated` | the page had more than 30,000 links; the `links` array is cut at the cap and is incomplete. |
172
+ | `inline_images_truncated` | the page had more than 10,000 inline images; the `images` array is cut at the cap and is incomplete. |
173
+ | `raw_html_truncated` | the page body exceeded 10,000,000 characters; `raw_html` is cut at a tag boundary, never mid-tag. |
174
+ | `elements_truncated` | an `elements` value hit a limit; see [targeted extraction](https://crawlbrulee.com/docs/scrape/targeted-extraction). |
156
175
 
157
- one more code is not about size: `screenshot_unavailable` means a screenshot was asked for, but the page came back from the http engine without one. the rest of the result is still there.
176
+ two more codes are not about size. `screenshot_unavailable` means a screenshot was asked for, but the page came back from the http engine without one; the rest of the result is still there. `custom_user_agent` means the request set its own `User-Agent` header; this can lower the success rate.
158
177
 
159
178
  and if you requested an extract that doesn't apply to the content type (e.g. `metadata` of a JSON file), the field name comes back in an `unsupported_fields` list — with the rest of the payload still returned.
160
179
 
@@ -271,8 +290,8 @@ agents can branch on the `errorName` code. the set comes from the sdk's `ApiErro
271
290
 
272
291
  | code | meaning |
273
292
  | --------------------------------- | ---------------------------------------------------------------------------------------------- |
274
- | `missing_api_key` | `CRAWLBRULEE_API_KEY` is not set in the mcp host's env. |
275
- | `invalid_credentials` | server rejected the api key (revoked, wrong env, etc.). |
293
+ | `missing_api_key` | `CRAWLBRULEE_API_KEY` is not set in the mcp host's env. the message says how to get a key. |
294
+ | `invalid_credentials` | the api rejected the key: expired, revoked or mistyped. the message says how to get a new one. |
276
295
  | `service_unavailable` | temporary backend failure (HTTP 503). your key is fine — retry with backoff. |
277
296
  | `too_many_requests` | rate limit hit — back off and retry. |
278
297
  | `usage_allocation_error` | plan credit / concurrency cap exceeded. show `usage` to user. |
package/dist/index.js CHANGED
@@ -42,7 +42,9 @@ async function runTool(fn) {
42
42
  return toToolError(err);
43
43
  }
44
44
  }
45
- const MISSING_API_KEY_REMEDIATION = `${ENV_API_KEY} is not set on the MCP host. Add --env ${ENV_API_KEY}=cwbl_... to your "claude mcp add" command (or the equivalent env block in your MCP client config), then restart the host.`;
45
+ const CREATE_KEY_STEPS = "In the crawlbrulee dashboard (https://dashboard.crawlbrulee.com), they open \"tokens\" in the menu and click \"create token\".";
46
+ const USER_ADDS_KEY = `They put the key in place themselves, usually as ${ENV_API_KEY} in their shell profile, then restart the host. Don't ask them to paste the key into the chat.`;
47
+ const MISSING_API_KEY_REMEDIATION = `${ENV_API_KEY} is not set on the MCP host. The user needs an API key. If they have no crawlbrulee account, they sign up at https://dashboard.crawlbrulee.com/auth/register (the free plan needs no credit card). ${CREATE_KEY_STEPS} ${USER_ADDS_KEY}`;
46
48
  /**
47
49
  * Map any thrown value into the MCP tool-error envelope. SDK errors carry
48
50
  * stable `errorName` codes and HTTP `status`; both go into the surfaced
@@ -74,6 +76,7 @@ function isMissingApiKeyError(err) {
74
76
  * for it yet), so it is matched by name.
75
77
  */
76
78
  const ERROR_HINTS = {
79
+ invalid_credentials: `The API key is expired, revoked or mistyped, so the user needs a new one. ${CREATE_KEY_STEPS} They replace the old key themselves (in their shell profile or this server's config), then restart the host. Don't ask them to paste the key into the chat. If the config names an environment variable instead of the key, the variable may not be set where the host started.`,
77
80
  zero_data_retention_not_enabled: "Zero data retention is not enabled for this organization. Send the request again without `zero_data_retention`, or ask us to turn it on (sales@crawlbrulee.com). Not billed.",
78
81
  target_unreachable: "We could not reach the site: it did not answer, took too long, or its certificate was not valid. Retry later or check the URL. Not billed. This is not the same as a page that says \"not found\": a page the site served comes back as a result, with its status in page_status_code."
79
82
  };
@@ -118,9 +121,8 @@ function getScrapeScreenshotBeforeActionTotals(actions) {
118
121
  //#endregion
119
122
  //#region src/schemas/ScrapeCleanupSchemas.ts
120
123
  /**
121
- * Mirrors `packages/core/src/model/common/ScrapeCleanup*` in the server repo.
122
- * Kept in step by hand — this package deliberately does not import from the
123
- * monorepo. If the server's shape changes, change it here too.
124
+ * Mirrors the crawlbrulee api's own schema, kept in step by hand: when the
125
+ * api's shape changes, change it here too.
124
126
  */
125
127
  const DEFAULT_SCRAPE_CLEANUP = { ads_and_popups: true };
126
128
  const MAX_SCRAPE_EXCLUDE_SELECTORS = 100;
@@ -130,12 +132,26 @@ const Schema_ApiScrapeCleanup = z.object({
130
132
  exclude_selectors: z.array(z.string().max(500)).max(100).optional().describe("CSS selectors whose elements are removed before anything is captured. Affects the extracted content and the screenshot, never raw_html. Use it for a banner or widget that ads_and_popups does not recognise. Sending any selector here makes the request skip the cache.")
131
133
  }).strict().describe("What is removed from the page before any output is built. Applies to markdown, cleaned_html, links and images on every engine, and to the screenshot. Never applies to raw_html, which is always the page before we removed anything.");
132
134
 
135
+ //#endregion
136
+ //#region src/schemas/ScrapeCustomHeadersSchemas.ts
137
+ const MAX_SCRAPE_COOKIES = 20;
138
+ const MAX_SCRAPE_COOKIE_BYTES = 4096;
139
+ const MAX_SCRAPE_CUSTOM_HEADERS_AND_COOKIES_BYTES = 16384;
140
+ const HEADERS_AND_COOKIES_DOCS_URL = "https://crawlbrulee.com/docs/scrape/custom-headers-and-cookies";
141
+ const HEADERS_AND_COOKIES_CHAT_NOTE = "Header and cookie values pass through the chat with the AI, so the AI host may keep them in its history. Use short-lived tokens or a test account, and never a password you can't change.";
142
+ const HEADERS_AND_COOKIES_TOOL_TEXT = `To send your own headers or cookies to the site, set \`headers\` (for example \`Authorization\`, or a fixed \`User-Agent\`) or \`cookies\`. They go only to the site in \`url\`, and such a request never uses the cache. ${HEADERS_AND_COOKIES_CHAT_NOTE} Tell the user this before they share one. See ${HEADERS_AND_COOKIES_DOCS_URL}.`;
143
+ const Schema_ScrapeCustomHeaders = z.record(z.string(), z.string());
144
+ const Schema_ScrapeCookie = z.object({
145
+ name: z.string().min(1),
146
+ value: z.string()
147
+ }).strict();
148
+ const Schema_ScrapeCookies = z.array(Schema_ScrapeCookie).max(20);
149
+
133
150
  //#endregion
134
151
  //#region src/schemas/ScrapeElementsSchemas.ts
135
152
  /**
136
- * Mirrors `packages/core/src/model/common/ScrapeElements*` in the server repo.
137
- * Kept in step by hand — this package deliberately does not import from the
138
- * monorepo. If the server's shape changes, change it here too.
153
+ * Mirrors the crawlbrulee api's own schema, kept in step by hand: when the
154
+ * api's shape changes, change it here too.
139
155
  *
140
156
  * `extract.elements`: named values read from the page by CSS selector. `fields`
141
157
  * nests, at most ELEMENT_FIELDS_DEPTH deep. The schemas are built level by level
@@ -145,7 +161,7 @@ const Schema_ApiScrapeCleanup = z.object({
145
161
  * Only the public per-string limits are checked here. The total selector count, the
146
162
  * CSS syntax and the name length are left to the api, which answers a clear 400.
147
163
  */
148
- const ELEMENTS_DOCS_URL = "https://crawlbrulee.com/docs/scrape/elements";
164
+ const ELEMENTS_DOCS_URL = "https://crawlbrulee.com/docs/scrape/targeted-extraction";
149
165
  /** How deep `fields` may nest. The innermost level has no `fields`. */
150
166
  const ELEMENT_FIELDS_DEPTH = 3;
151
167
  const MAX_ELEMENT_SELECTOR_LENGTH = 500;
@@ -191,7 +207,7 @@ function buildElementsMap(fieldsDepth, top = false) {
191
207
  output: describeTop(z.enum(ELEMENT_OUTPUT_VALUES).optional(), top, "What to return for a match: `text` (default), `html` (the outer HTML) or `attribute`"),
192
208
  attribute: describeTop(z.string().min(1).max(100).optional(), top, "The attribute to read when `output` is `attribute`. `href` and `src` come back as full urls"),
193
209
  all: describeTop(z.boolean().default(false), top, "Return every match as a list instead of the first. Defaults to false"),
194
- ...fieldsDepth > 0 ? { fields: describeTop(buildElementsMap(fieldsDepth - 1).optional(), top, "Used instead of `output`: turns each match into an object of named values, each read inside that match only. Same shape as `elements`; nests up to 3 levels") } : {}
210
+ ...fieldsDepth > 0 ? { fields: describeTop(buildElementsMap(fieldsDepth - 1).optional(), top, "Used instead of `output`: turns each match into an object of named values, each read inside that match; the selector `:scope` reads the match itself. Same shape as `elements`; nests up to 3 levels") } : {}
195
211
  }).strict().superRefine(refineSpec);
196
212
  return z.record(z.string(), z.union([Schema_ElementSelector, spec]));
197
213
  }
@@ -238,7 +254,7 @@ function refineScrapeScreenshotActionsBefore(value, ctx) {
238
254
 
239
255
  //#endregion
240
256
  //#region src/schemas/ApiScrapeRequest.ts
241
- const DEFAULT_API_SCRAPE_CACHE_MAX_AGE_SECONDS = 2880 * 60;
257
+ const DEFAULT_API_SCRAPE_CACHE_MAX_AGE_SECONDS = 172800;
242
258
  const API_PROXY_TIER_VALUES = [
243
259
  "basic",
244
260
  "advanced",
@@ -266,10 +282,10 @@ const Schema_ApiScrapeExtract = z.object({
266
282
  links: z.boolean().default(false).describe("Extract links found on the page, up to 30,000 per page. Beyond that the array is truncated and the response carries a `links_truncated` warning."),
267
283
  images: z.boolean().default(false).describe("Extract inline images found on the page, up to 10,000 per page. Beyond that the array is truncated and the response carries an `inline_images_truncated` warning."),
268
284
  screenshot: Schema_ApiScrapeFormatScreenshot.optional().describe("Capture a screenshot of the page"),
269
- elements: Schema_ScrapeElements.optional().describe(`Named values to read from the page by CSS selector, returned in the top-level \`elements\` field under the same names. Each value is either a selector string (the text of the first match) or an object with \`selector\`, \`output\`, \`attribute\` and \`all\`. \`fields\` (instead of \`output\`) turns each match into an object of named values read inside that match only, so a list of product cards can return a title, price and url per card. A name with no match is null, or [] with \`all: true\`. Read after cleanup; \`<script>\` and \`<style>\` tags are not part of it. An invalid selector is a 400. No extra credits, also when the page comes from cache. Limits and selector rules: ${ELEMENTS_DOCS_URL}.`)
285
+ elements: Schema_ScrapeElements.optional().describe(`Named values to read from the page by CSS selector, returned in the top-level \`elements\` field under the same names. Each value is either a selector string (the text of the first match) or an object with \`selector\`, \`output\`, \`attribute\` and \`all\`. \`fields\` (instead of \`output\`) turns each match into an object of named values read inside that match (the selector \`:scope\` reads the match itself, for example the matched element's own href), so a list of products can return a title, price and url per product. A name with no match is null, or [] with \`all: true\`. Read after cleanup; \`<script>\` and \`<style>\` tags are not part of it. An invalid selector is a 400. No extra credits, also when the page comes from cache. Limits and selector rules: ${ELEMENTS_DOCS_URL}.`)
270
286
  }).strict().describe("Which content formats to extract from the scraped page");
271
287
  const Schema_ApiScrapeLocation = z.object({
272
- locale: z.string().min(2).max(35).optional().describe("BCP-47 locale (2-35 chars, e.g. 'en-US', 'de-DE', 'pt-BR') driving Accept-Language and navigator.language"),
288
+ locale: z.string().min(2).max(35).optional().describe("BCP-47 locale (2-35 chars, e.g. 'en-US', 'de-DE', 'pt-BR'): the language to ask the site for"),
273
289
  country: z.string().regex(/^([a-zA-Z]{2}|europe)$/i, "country must be a 2-letter ISO 3166-1 alpha-2 code, 'eu', or 'europe'").optional().describe("ISO 3166-1 alpha-2 (e.g. 'us', 'de', 'br'; case-insensitive) driving the emulated browser timezone and proxy exit country. Also accepts 'eu' (random EU member state) or 'europe' (random European state incl. UK and non-EU).")
274
290
  }).strict().describe("Optional locale + country emulation for the scrape");
275
291
  const Schema_ApiScrapeRequest = z.object({
@@ -280,13 +296,15 @@ const Schema_ApiScrapeRequest = z.object({
280
296
  cleanup: Schema_ApiScrapeCleanup.prefault({ ...DEFAULT_SCRAPE_CLEANUP }),
281
297
  proxy: Schema_ApiProxyType.describe("Proxy tier to use for fetching"),
282
298
  location: Schema_ApiScrapeLocation.optional(),
283
- zero_data_retention: z.boolean().optional().describe("Keeps the result out of the shared cache; anything stored to deliver it is kept for 24 hours, then deleted. Adds 1 credit. Must be enabled for your organization. See https://crawlbrulee.com/docs/zero-data-retention.")
299
+ zero_data_retention: z.boolean().optional().describe("Keeps the result out of the shared cache; anything stored to deliver it is kept for 24 hours, then deleted. Adds 1 credit. Must be enabled for your organization. See https://crawlbrulee.com/docs/zero-data-retention."),
300
+ headers: Schema_ScrapeCustomHeaders.optional().describe(`Your own HTTP headers to send to the site with the request, for example \`Authorization\`, an api key, or a fixed \`User-Agent\` that the site has on an allowlist. Sent only to the origin of \`url\` (same scheme, host and port), or to its https version when \`url\` is http, and not on a redirect to another origin. Up to ${10} headers; headers and cookies together up to ${MAX_SCRAPE_CUSTOM_HEADERS_AND_COOKIES_BYTES} bytes. Values are printable ASCII, with no space or tab at either end. Headers a browser doesn't let a web page set can't be set here either (a 400 names the header). Use \`cookies\` for cookies and \`location.locale\` for the language. Never put secrets in the \`User-Agent\`. Your own \`User-Agent\` can lower the success rate, and the response carries the \`custom_user_agent\` warning. A \`Referer\` must be the full http or https url of a public page, with no username or password; it is sent the way a browser sends it after a click on that page. A request with headers or cookies never reads from or writes to the cache. On a plain http url they travel unencrypted. ${HEADERS_AND_COOKIES_CHAT_NOTE} See ${HEADERS_AND_COOKIES_DOCS_URL}.`),
301
+ cookies: Schema_ScrapeCookies.optional().describe(`Your own cookies to send to the site with the request. Each is a \`name\` and a \`value\`, sent only to the host of \`url\`. Cookies the site sets while redirecting are not kept. Up to ${20} cookies, each up to ${MAX_SCRAPE_COOKIE_BYTES} bytes (name and value), counted toward the limit on \`headers\`. A value may not hold ";" or start or end with a space. A \`__Secure-\`, \`__Host-\` or \`__Http-\` cookie needs an https url. A request with headers or cookies never reads from or writes to the cache. ${HEADERS_AND_COOKIES_CHAT_NOTE} See ${HEADERS_AND_COOKIES_DOCS_URL}.`)
284
302
  }).strict();
285
303
 
286
304
  //#endregion
287
305
  //#region src/schemas/ApiMapRequest.ts
288
306
  const Schema_ApiMapLocation = z.object({ country: z.string().regex(/^([a-zA-Z]{2}|europe)$/i, "country must be a 2-letter ISO 3166-1 alpha-2 code, 'eu', or 'europe'").optional().describe("ISO 3166-1 alpha-2 (e.g. 'us', 'de', 'br'; case-insensitive) hint for proxy egress country. Also accepts 'eu' (random EU member state) or 'europe' (random European state incl. UK and non-EU).") }).strict().describe("Optional country emulation for the map");
289
- const DEFAULT_API_MAP_CACHE_MAX_AGE_SECONDS = 10080 * 60;
307
+ const DEFAULT_API_MAP_CACHE_MAX_AGE_SECONDS = 604800;
290
308
  /**
291
309
  * How many URLs a /map call discovers and stores when the caller names no
292
310
  * limit. Sitemap discovery stops here, so the default is real crawl work, not
@@ -421,7 +439,7 @@ const Schema_ApiScrapeSuccessResponse = z.looseObject({
421
439
  links: z.array(Schema_ApiPageLink).optional().describe("Links found on the page"),
422
440
  screenshot: Schema_ApiScreenshotResponse.optional().describe("Screenshot of the page, if requested"),
423
441
  metadata: Schema_ApiScrapeMeta.optional().describe("Extracted page metadata (title, OG tags, etc.)"),
424
- 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` (rendered HTML exceeded the per-page size budget) — mean the field is present but capped. `elements_truncated` means at least one `elements` value hit a limit: a list was cut at 1,000 matches, the request reached 10,000 matches in total, or a value did not fit the ~1 MB of values allowed per request (that value is then null, never cut short). 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. `screenshot_unavailable` means a screenshot was asked for, but the page came back from the http engine without one. 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. `metadata_truncated` is retired and no longer sent: metadata has no size limit of its own now, though the code can still appear on results stored before that change."),
442
+ 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` (rendered HTML exceeded the per-page size budget) — mean the field is present but capped. `elements_truncated` means at least one `elements` value hit a limit: a list was cut at 1,000 matches, the request reached 10,000 matches in total, or a value did not fit the ~1 MB of values allowed per request (that value is then null, never cut short). 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. `screenshot_unavailable` means a screenshot was asked for, but the page came back from the http engine without one. `custom_user_agent` means the request set its own `User-Agent` header; this can lower the success rate. 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. `metadata_truncated` is retired and no longer sent: metadata has no size limit of its own now, though the code can still appear on results stored before that change."),
425
443
  response_meta: Schema_ApiResponseMeta.describe("Request-level metadata. `response_meta.usage` reports what the request cost (total_credit_cost and its parts), the billed engine and the resolved proxy tier.")
426
444
  });
427
445
 
@@ -515,7 +533,7 @@ const DESCRIPTION$5 = [
515
533
  "Use this for one-shot page extraction. For full-site discovery use the `map` tool first.",
516
534
  "To pull named values such as prices, titles or links, set `extract.elements` (name → CSS selector)",
517
535
  "instead of reading the whole markdown: they come back in `elements`, for no extra credits.",
518
- "Rules: https://crawlbrulee.com/docs/scrape/elements.",
536
+ "Rules: https://crawlbrulee.com/docs/scrape/targeted-extraction.",
519
537
  "Check `page_status_code` before you trust the content: it is the HTTP status the site answered",
520
538
  "with for the final page. A page the site served is a successful result whatever its status, so a",
521
539
  "404 or 503 page comes back with its content, not as an error. A 404 means the markdown is the",
@@ -543,7 +561,9 @@ const DESCRIPTION$5 = [
543
561
  "while the rest of the scrape succeeded, so do NOT conclude the page had no links/images/metadata",
544
562
  "— re-run the scrape instead. An empty field with no such warning does mean the page had none.",
545
563
  "`screenshot_unavailable` means a screenshot was asked for, but the page came back from the http",
546
- "engine without one."
564
+ "engine without one. `custom_user_agent` means the request set its own `User-Agent` header; this",
565
+ "can lower the success rate.",
566
+ HEADERS_AND_COOKIES_TOOL_TEXT
547
567
  ].join(" ");
548
568
  function registerScrapeTool(server, getClient) {
549
569
  server.registerTool("scrape", {
@@ -589,12 +609,13 @@ const DESCRIPTION$4 = [
589
609
  "fetch prefer the synchronous `scrape` tool, which blocks and returns the page directly.",
590
610
  "Poll the job with `scrape_status` and fetch the page with `scrape_result` once done.",
591
611
  "Takes `extract.elements` like `scrape` (named values by CSS selector, no extra credits); the",
592
- "result carries them in `elements`. Rules: https://crawlbrulee.com/docs/scrape/elements.",
612
+ "result carries them in `elements`. Rules: https://crawlbrulee.com/docs/scrape/targeted-extraction.",
593
613
  "Optionally attach a per-job completion `webhook`: we deliver a single",
594
614
  "signed `scrape.complete` POST to your endpoint when the job finishes (HTTPS required",
595
615
  "in production), and echoes your opaque `webhook.metadata` back in the delivery",
596
616
  "(under `data.metadata`, alongside `data.page_status_code` (on success) and `data.response_meta.usage`).",
597
- "Set `zero_data_retention: true` to keep the result out of the shared cache; anything stored to deliver it is kept for 24 hours, then deleted. It adds 1 credit and must be enabled for the organization (else a `zero_data_retention_not_enabled` error, not billed). See https://crawlbrulee.com/docs/zero-data-retention."
617
+ "Set `zero_data_retention: true` to keep the result out of the shared cache; anything stored to deliver it is kept for 24 hours, then deleted. It adds 1 credit and must be enabled for the organization (else a `zero_data_retention_not_enabled` error, not billed). See https://crawlbrulee.com/docs/zero-data-retention.",
618
+ HEADERS_AND_COOKIES_TOOL_TEXT
598
619
  ].join(" ");
599
620
  function registerScrapeAsyncTool(server, getClient) {
600
621
  server.registerTool("scrape_async", {
@@ -709,7 +730,7 @@ function registerWhoamiTool(server, getClient) {
709
730
  //#endregion
710
731
  //#region src/version.ts
711
732
  const SERVER_NAME = "crawlbrulee";
712
- const SERVER_VERSION = "1.3.2";
733
+ const SERVER_VERSION = "1.4.0";
713
734
 
714
735
  //#endregion
715
736
  //#region src/server.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crawlbrulee/mcp",
3
- "version": "1.3.2",
3
+ "version": "1.4.0",
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": [
@@ -33,7 +33,7 @@
33
33
  "url": "https://github.com/crawlbrulee/crawlbrulee-mcp/issues"
34
34
  },
35
35
  "type": "module",
36
- "packageManager": "pnpm@10.10.0",
36
+ "packageManager": "pnpm@10.24.0",
37
37
  "bin": {
38
38
  "crawlbrulee-mcp": "dist/index.js"
39
39
  },
@@ -63,8 +63,8 @@
63
63
  "prepublishOnly": "pnpm verify"
64
64
  },
65
65
  "dependencies": {
66
- "@crawlbrulee/sdk": "^1.3.0",
67
- "@modelcontextprotocol/sdk": "^1.29.0",
66
+ "@crawlbrulee/sdk": "^1.4.0",
67
+ "@modelcontextprotocol/sdk": "^1.32.1",
68
68
  "zod": "^4.0.0"
69
69
  },
70
70
  "devDependencies": {
@@ -75,6 +75,6 @@
75
75
  "tsdown": "^0.22.11",
76
76
  "typescript": "^6.0.3",
77
77
  "typescript-eslint": "^8.64.0",
78
- "vitest": "^3.2.6"
78
+ "vitest": "^4.1.11"
79
79
  }
80
80
  }