@crawlbrulee/mcp 0.4.0 โ†’ 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +83 -58
  2. package/dist/index.js +442 -492
  3. package/package.json +7 -7
package/README.md CHANGED
@@ -1,17 +1,25 @@
1
- # ๐Ÿฎ crawlbrulee MCP
1
+ # ๐Ÿฎ crawlbrulee mcp
2
2
 
3
- The official [Model Context Protocol](https://modelcontextprotocol.io) server for the [crawlbrulee](https://crawlbrulee.com) web-scraping API. Lets MCP-aware AI agents โ€” Claude Code, Codex, Cursor, Claude Desktop โ€” scrape pages, map sites, and check their crawlbrulee usage as native tool calls.
3
+ [![npm](https://img.shields.io/npm/v/@crawlbrulee/mcp?style=flat-square&label=npm)](https://www.npmjs.com/package/@crawlbrulee/mcp)
4
+ [![license](https://img.shields.io/npm/l/@crawlbrulee/mcp?style=flat-square&label=license)](./LICENSE)
5
+
6
+ the official [mcp](https://modelcontextprotocol.io) server for the [crawlbrulee](https://crawlbrulee.com) web-scraping api. lets mcp-aware ai agents โ€” Claude Code, Codex, Cursor, Claude Desktop โ€” scrape pages, map sites, and check their crawlbrulee usage as native tool calls.
4
7
 
5
8
  - `npx`-runnable โ€” zero install.
6
- - Wraps the [`@crawlbrulee/sdk`](https://www.npmjs.com/package/@crawlbrulee/sdk) under the hood; this MCP is just a thin protocol adapter.
7
- - Stdio transport for terminal-based agents.
8
- - Strict, fully-described tool schemas โ€” agents see what every parameter does without reading docs.
9
+ - wraps the [`@crawlbrulee/sdk`](https://www.npmjs.com/package/@crawlbrulee/sdk) under the hood; this mcp is just a thin protocol adapter.
10
+ - stdio transport for terminal-based agents.
11
+ - strict, fully-described tool schemas โ€” agents see what every parameter does without reading docs.
12
+
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
+ [api docs](https://crawlbrulee.com/docs).
15
+
16
+ > **status:** v0.5.0 (beta). tool surface is stabilizing โ€” expect minor changes between 0.x releases.
9
17
 
10
- > **Status:** v0.4.0 (beta). Tool surface is stabilizing โ€” expect minor changes between 0.x releases.
18
+ **get a free api key** โ†’ [dashboard.crawlbrulee.com](https://dashboard.crawlbrulee.com)
11
19
 
12
20
  ---
13
21
 
14
- ## Install
22
+ ## install
15
23
 
16
24
  ```bash
17
25
  # Claude Code
@@ -31,30 +39,31 @@ claude mcp add crawlbrulee \
31
39
  }
32
40
  ```
33
41
 
34
- The same pattern works for Codex, Claude Desktop, and any other host that
35
- accepts a stdio MCP launch command โ€” set `command: npx`, `args: ["-y",
42
+ the same pattern works for Codex, Claude Desktop, and any other host that
43
+ accepts a stdio mcp launch command โ€” set `command: npx`, `args: ["-y",
36
44
  "@crawlbrulee/mcp"]`, and forward `CRAWLBRULEE_API_KEY` via the env block.
37
45
 
38
- ## Configuration
46
+ ## configuration
39
47
 
40
- | Env var | Required | Description |
48
+ | env var | required | description |
41
49
  | --------------------- | -------- | ------------------------------------------------------------------------------ |
42
- | `CRAWLBRULEE_API_KEY` | yes | API key sent as `Authorization: Bearer โ€ฆ`. Get one at https://crawlbrulee.com. |
50
+ | `CRAWLBRULEE_API_KEY` | yes | api key sent as `Authorization: Bearer โ€ฆ`. get one at https://crawlbrulee.com. |
43
51
 
44
- The MCP reads the env var on first tool invocation โ€” not at startup โ€” so a
52
+ the mcp reads the env var on first tool invocation โ€” not at startup โ€” so a
45
53
  typo in your config surfaces as a clear tool-error message rather than the
46
- server failing to come up.
54
+ server failing to come up. see
55
+ [authentication](https://crawlbrulee.com/docs/authentication) for how the api consumes keys.
47
56
 
48
57
  ---
49
58
 
50
- ## Tools
59
+ ## tools
51
60
 
52
61
  ### `scrape`
53
62
 
54
- Fetch a single URL and return the requested content (markdown, cleaned
55
- HTML, raw HTML, links, images, screenshot, page metadata).
63
+ fetch a single url and return the requested content (markdown, cleaned
64
+ html, raw html, links, images, screenshot, page metadata).
56
65
 
57
- **Input** โ€” only `url` is required; everything else has sane defaults.
66
+ **input** โ€” only `url` is required; everything else has sane defaults.
58
67
 
59
68
  ```jsonc
60
69
  {
@@ -72,7 +81,7 @@ HTML, raw HTML, links, images, screenshot, page metadata).
72
81
  }
73
82
  ```
74
83
 
75
- **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, and when that happens the `screenshot` field is simply left out while the rest of your requested outputs are still returned. The result also carries a top-level `response_meta.usage` block:
84
+ **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, and when that happens the `screenshot` field is simply left out while the rest of your requested outputs are still returned. the result also carries a top-level `response_meta.usage` block:
76
85
 
77
86
  ```jsonc
78
87
  {
@@ -82,18 +91,22 @@ HTML, raw HTML, links, images, screenshot, page metadata).
82
91
  "response_meta": {
83
92
  "usage": {
84
93
  "credits": 1, // credits charged โ€” 0 on a cache hit
85
- "proxy": "basic", // resolved tier actually used: "none" | "basic" | "advanced" (never "auto")
94
+ "proxy": "basic", // resolved tier actually used: "basic" | "advanced" (never "auto")
86
95
  "cache_hit": false, // whether the result was served from cache
87
96
  },
88
97
  },
89
98
  }
90
99
  ```
91
100
 
101
+ alongside `response_meta.usage`, the result surfaces any non-fatal `warnings` (stable codes like `screenshot_truncated`) and, if you requested an extract that doesn't apply to the content type (e.g. `markdown` of a pdf), an `unsupported_fields` list โ€” with the rest of the payload still returned.
102
+
103
+ every input field, its default, and its constraints are documented under the [scrape endpoint](https://crawlbrulee.com/docs/scrape) โ€” with [extraction](https://crawlbrulee.com/docs/scrape/extraction), [screenshots](https://crawlbrulee.com/docs/scrape/screenshots), [proxies & location](https://crawlbrulee.com/docs/proxies), and [caching](https://crawlbrulee.com/docs/scrape/caching) covering the individual blocks.
104
+
92
105
  ### `scrape_async`
93
106
 
94
- Submit a scrape job to run **asynchronously** and get back a `job_id` immediately, instead of holding the connection open. Use this for long-running scrapes (heavy JS rendering, full-page screenshots of long pages); for a quick one-shot fetch prefer the synchronous `scrape` tool. Then poll `scrape_status` until the job is `done` and fetch the page with `scrape_result`.
107
+ submit a scrape job to run **asynchronously** and get back a `job_id` immediately, instead of holding the connection open. use this for long-running scrapes (heavy js rendering, full-page screenshots of long pages); for a quick one-shot fetch prefer the synchronous `scrape` tool. then poll `scrape_status` until the job is `done` and fetch the page with `scrape_result`.
95
108
 
96
- Takes the same input as `scrape` plus an optional per-job completion `webhook`:
109
+ takes the same input as `scrape` plus an optional per-job completion `webhook`:
97
110
 
98
111
  ```jsonc
99
112
  {
@@ -110,13 +123,15 @@ Takes the same input as `scrape` plus an optional per-job completion `webhook`:
110
123
  }
111
124
  ```
112
125
 
113
- **Output** โ€” `{ "job_id": "..." }`.
126
+ **output** โ€” `{ "job_id": "..." }`.
114
127
 
115
- When a `webhook` is attached, crawlbrulee delivers 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).
128
+ 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).
129
+
130
+ 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).
116
131
 
117
132
  ### `scrape_status`
118
133
 
119
- 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`.
134
+ 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`.
120
135
 
121
136
  ```jsonc
122
137
  { "job_id": "..." }
@@ -124,7 +139,7 @@ Look up the current lifecycle status of an async job: `pending`, `running`, `don
124
139
 
125
140
  ### `scrape_result`
126
141
 
127
- Fetch the extracted content of a completed async job โ€” the same result shape as the synchronous `scrape` tool (including `metadata` and `response_meta.usage`). Errors if the job is still `pending`/`running`, so check `scrape_status` first.
142
+ fetch the extracted content of a completed async job โ€” the same result shape as the synchronous `scrape` tool (including `metadata` and `response_meta.usage`). errors if the job is still `pending`/`running`, so check `scrape_status` first.
128
143
 
129
144
  ```jsonc
130
145
  { "job_id": "..." }
@@ -132,7 +147,7 @@ Fetch the extracted content of a completed async job โ€” the same result shape a
132
147
 
133
148
  ### `map`
134
149
 
135
- 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`).
150
+ 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`).
136
151
 
137
152
  ```jsonc
138
153
  {
@@ -145,47 +160,51 @@ Build (or fetch a cached) link-map for a website. Combines sitemap discovery wit
145
160
  }
146
161
  ```
147
162
 
163
+ see the [map endpoint](https://crawlbrulee.com/docs/map) for discovery rules and pagination semantics.
164
+
148
165
  ### `usage`
149
166
 
150
- Returns the current billing-cycle snapshot: total / used / available credits, used quota percent, max concurrency, and cycle reset timestamp. Takes no arguments.
167
+ returns the current billing-cycle snapshot: total / used / available credits, used quota percent, max concurrency, and cycle reset timestamp. takes no arguments. what a call costs, and how credits are counted, is documented under [credits & pricing](https://crawlbrulee.com/docs/credits-and-pricing).
151
168
 
152
169
  ### `whoami`
153
170
 
154
- Returns the organization name, token name, and truncated token preview for the configured API key. Useful for confirming which account is in use before credit-consuming operations.
171
+ returns the organization name, token name, and truncated token preview for the configured api key. useful for confirming which account is in use before credit-consuming operations.
155
172
 
156
173
  ---
157
174
 
158
- ## Errors
175
+ ## errors
159
176
 
160
- Every tool returns an MCP error envelope (`isError: true`) when the API call fails. The error text follows a stable format:
177
+ every tool returns an mcp error envelope (`isError: true`) when the api call fails. the error text follows a stable format:
161
178
 
162
179
  ```
163
180
  [<errorName>] <message> (HTTP <status>)
164
181
  ```
165
182
 
166
- Agents can branch on the `errorName` code. The set comes from the SDK's `ApiErrorName` union plus two synthetic codes added by this MCP (`missing_api_key`, `internal_error`):
183
+ agents can branch on the `errorName` code. the set comes from the sdk's `ApiErrorName` union plus two synthetic codes added by this mcp (`missing_api_key`, `internal_error`):
167
184
 
168
- | Code | Meaning |
185
+ | code | meaning |
169
186
  | ------------------------ | ------------------------------------------------------------------------------ |
170
- | `missing_api_key` | `CRAWLBRULEE_API_KEY` is not set in the MCP host's env. |
171
- | `invalid_credentials` | Server rejected the API key (revoked, wrong env, etc.). |
172
- | `too_many_requests` | Rate limit hit โ€” back off and retry. |
173
- | `usage_allocation_error` | Plan credit / concurrency cap exceeded. Show `usage` to user. |
174
- | `validation_error` | Input failed server validation. |
175
- | `invalid_url` | Target URL was rejected before fetching. |
176
- | `blocked_url` | Target URL is on the blocklist. |
177
- | `antibot_blocked` | Origin's anti-bot defenses blocked the fetch. |
178
- | `scrape_error` | Origin returned an error during scraping. |
179
- | `not_found` | Async job ID unknown (e.g. bad `job_id` to `scrape_status` / `scrape_result`). |
180
- | `request_timeout` | Network / read timeout. Safe to retry. |
181
- | `client_closed_request` | Caller cancelled before completion. |
182
- | `internal_server_error` | Unhandled server-side failure. |
183
- | `crawlbrulee_error` | SDK error without a typed name. |
184
- | `internal_error` | Bug in this MCP โ€” please open an issue. |
187
+ | `missing_api_key` | `CRAWLBRULEE_API_KEY` is not set in the mcp host's env. |
188
+ | `invalid_credentials` | server rejected the api key (revoked, wrong env, etc.). |
189
+ | `too_many_requests` | rate limit hit โ€” back off and retry. |
190
+ | `usage_allocation_error` | plan credit / concurrency cap exceeded. show `usage` to user. |
191
+ | `validation_error` | input failed server validation. |
192
+ | `invalid_url` | target url was rejected before fetching. |
193
+ | `blocked_url` | target url is on the blocklist. |
194
+ | `antibot_blocked` | origin's anti-bot defenses blocked the fetch. |
195
+ | `scrape_error` | origin returned an error during scraping. |
196
+ | `not_found` | async job ID unknown (e.g. bad `job_id` to `scrape_status` / `scrape_result`). |
197
+ | `request_timeout` | network / read timeout. safe to retry. |
198
+ | `client_closed_request` | caller cancelled before completion. |
199
+ | `internal_server_error` | unhandled server-side failure. |
200
+ | `crawlbrulee_error` | sdk error without a typed name. |
201
+ | `internal_error` | bug in this mcp โ€” please open an issue. |
202
+
203
+ the api docs carry the canonical [error reference](https://crawlbrulee.com/docs/errors) โ€” every error name, what causes it, and how to recover.
185
204
 
186
205
  ---
187
206
 
188
- ## Development
207
+ ## development
189
208
 
190
209
  ```bash
191
210
  pnpm install
@@ -196,24 +215,30 @@ pnpm build # tsup โ†’ dist/index.js with shebang
196
215
  pnpm verify # all of the above
197
216
  ```
198
217
 
199
- Run the built MCP locally:
218
+ run the built mcp locally:
200
219
 
201
220
  ```bash
202
221
  CRAWLBRULEE_API_KEY=cwbl_... node ./dist/index.js
203
222
  ```
204
223
 
205
- It will block waiting for an MCP client on stdio. Combine with the [MCP Inspector](https://github.com/modelcontextprotocol/inspector) for interactive debugging.
224
+ it will block waiting for an mcp client on stdio. combine with the [MCP Inspector](https://github.com/modelcontextprotocol/inspector) for interactive debugging.
225
+
226
+ ## docs
227
+
228
+ this readme covers the mcp server itself โ€” installing it, wiring it into a host, and the tools it exposes. for how the api behaves โ€” endpoints, parameters, and error semantics โ€” the [api docs](https://crawlbrulee.com/docs) are canonical. the [mcp guide](https://crawlbrulee.com/docs/mcp) covers host setup in more depth.
206
229
 
207
- ### Schema sync
230
+ ## part of the crawlbrulee toolkit
208
231
 
209
- The `src/schemas/*.ts` files are **vendored copies** of the canonical Zod schemas in `crawlbrulee/packages/shared/core/src/model/common/Api*.ts`. The ecosystem policy is that tool repos do not import the shared subtree. When the canonical schemas change:
232
+ one api, many ways to call it:
210
233
 
211
- 1. Copy the updated `Api*.ts` and supporting `ScrapeScreenshot*.ts` files into `src/schemas/`.
212
- 2. Keep the `// VENDORED from โ€ฆ` banner intact and update the path if the source moved.
213
- 3. Re-run `pnpm verify`.
234
+ - **[js/ts sdk](https://github.com/crawlbrulee/crawlbrulee-js)** โ€” `@crawlbrulee/sdk` (the sdk this mcp wraps)
235
+ - **[python sdk](https://github.com/crawlbrulee/crawlbrulee-py)** โ€” `crawlbrulee` on pypi
236
+ - **[cli](https://github.com/crawlbrulee/crawlbrulee-cli)** โ€” `npx crawlbrulee`
237
+ - **[mcp server](https://github.com/crawlbrulee/crawlbrulee-mcp)** โ€” `@crawlbrulee/mcp` (this one)
238
+ - **[agent skills](https://github.com/crawlbrulee/crawlbrulee-skills)** โ€” for skills-aware coding agents
214
239
 
215
- A future `@crawlbrulee/types` npm package will replace this manual sync.
240
+ docs: [crawlbrulee.com/docs](https://crawlbrulee.com/docs) ยท dashboard: [dashboard.crawlbrulee.com](https://dashboard.crawlbrulee.com)
216
241
 
217
- ## License
242
+ ## license
218
243
 
219
244
  [AGPL-3.0-only](./LICENSE)