@crawlbrulee/mcp 0.4.0 โ 0.5.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.
- package/README.md +83 -58
- package/dist/index.js +9 -11
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,17 +1,25 @@
|
|
|
1
|
-
# ๐ฎ crawlbrulee
|
|
1
|
+
# ๐ฎ crawlbrulee mcp
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@crawlbrulee/mcp)
|
|
4
|
+
[](./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
|
-
-
|
|
7
|
-
-
|
|
8
|
-
-
|
|
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
|
-
|
|
18
|
+
**get a free api key** โ [dashboard.crawlbrulee.com](https://dashboard.crawlbrulee.com)
|
|
11
19
|
|
|
12
20
|
---
|
|
13
21
|
|
|
14
|
-
##
|
|
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
|
-
|
|
35
|
-
accepts a stdio
|
|
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
|
-
##
|
|
46
|
+
## configuration
|
|
39
47
|
|
|
40
|
-
|
|
|
48
|
+
| env var | required | description |
|
|
41
49
|
| --------------------- | -------- | ------------------------------------------------------------------------------ |
|
|
42
|
-
| `CRAWLBRULEE_API_KEY` | yes |
|
|
50
|
+
| `CRAWLBRULEE_API_KEY` | yes | api key sent as `Authorization: Bearer โฆ`. get one at https://crawlbrulee.com. |
|
|
43
51
|
|
|
44
|
-
|
|
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
|
-
##
|
|
59
|
+
## tools
|
|
51
60
|
|
|
52
61
|
### `scrape`
|
|
53
62
|
|
|
54
|
-
|
|
55
|
-
|
|
63
|
+
fetch a single url and return the requested content (markdown, cleaned
|
|
64
|
+
html, raw html, links, images, screenshot, page metadata).
|
|
56
65
|
|
|
57
|
-
**
|
|
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
|
-
**
|
|
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: "
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
**
|
|
126
|
+
**output** โ `{ "job_id": "..." }`.
|
|
114
127
|
|
|
115
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
##
|
|
175
|
+
## errors
|
|
159
176
|
|
|
160
|
-
|
|
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
|
-
|
|
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
|
-
|
|
|
185
|
+
| code | meaning |
|
|
169
186
|
| ------------------------ | ------------------------------------------------------------------------------ |
|
|
170
|
-
| `missing_api_key` | `CRAWLBRULEE_API_KEY` is not set in the
|
|
171
|
-
| `invalid_credentials` |
|
|
172
|
-
| `too_many_requests` |
|
|
173
|
-
| `usage_allocation_error` |
|
|
174
|
-
| `validation_error` |
|
|
175
|
-
| `invalid_url` |
|
|
176
|
-
| `blocked_url` |
|
|
177
|
-
| `antibot_blocked` |
|
|
178
|
-
| `scrape_error` |
|
|
179
|
-
| `not_found` |
|
|
180
|
-
| `request_timeout` |
|
|
181
|
-
| `client_closed_request` |
|
|
182
|
-
| `internal_server_error` |
|
|
183
|
-
| `crawlbrulee_error` |
|
|
184
|
-
| `internal_error` |
|
|
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
|
-
##
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
230
|
+
## part of the crawlbrulee toolkit
|
|
208
231
|
|
|
209
|
-
|
|
232
|
+
one api, many ways to call it:
|
|
210
233
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
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
|
-
|
|
240
|
+
docs: [crawlbrulee.com/docs](https://crawlbrulee.com/docs) ยท dashboard: [dashboard.crawlbrulee.com](https://dashboard.crawlbrulee.com)
|
|
216
241
|
|
|
217
|
-
##
|
|
242
|
+
## license
|
|
218
243
|
|
|
219
244
|
[AGPL-3.0-only](./LICENSE)
|
package/dist/index.js
CHANGED
|
@@ -107,9 +107,9 @@ function refineScrapeScreenshotActionsBefore(value, ctx) {
|
|
|
107
107
|
|
|
108
108
|
// src/schemas/ApiScrapeRequest.ts
|
|
109
109
|
var DEFAULT_API_SCRAPE_CACHE_MAX_AGE_SECONDS = 2 * 24 * 60 * 60;
|
|
110
|
-
var API_PROXY_TIER_VALUES = ["basic", "advanced", "auto"
|
|
110
|
+
var API_PROXY_TIER_VALUES = ["basic", "advanced", "auto"];
|
|
111
111
|
var Schema_ApiProxyType = z.enum(API_PROXY_TIER_VALUES).default("auto").describe(
|
|
112
|
-
"Proxy tier: basic, advanced,
|
|
112
|
+
"Proxy tier: basic, advanced, or auto. Defaults to auto (automatic selection: basic tier first, escalates to advanced on failure)."
|
|
113
113
|
);
|
|
114
114
|
var Schema_ApiScrapeViewport = z.object({
|
|
115
115
|
width: z.number().int().min(16).max(1e4).describe("Viewport width in pixels (16\u201310000)"),
|
|
@@ -234,11 +234,11 @@ var Schema_ApiPageLink = z.object({
|
|
|
234
234
|
href: z.string().describe("The link URL as it appears on the page (absolute or relative)"),
|
|
235
235
|
internal: z.boolean().describe("Whether the link points to the same domain")
|
|
236
236
|
});
|
|
237
|
-
var API_RESOLVED_PROXY_TIER_VALUES = ["
|
|
237
|
+
var API_RESOLVED_PROXY_TIER_VALUES = ["basic", "advanced"];
|
|
238
238
|
var Schema_ApiUsageMeta = z.object({
|
|
239
239
|
credits: z.number().int().nonnegative().describe("Credits charged for this request. `0` on a cache hit (no fresh fetch was billed)."),
|
|
240
240
|
proxy: z.enum(API_RESOLVED_PROXY_TIER_VALUES).describe(
|
|
241
|
-
"The proxy tier the request actually ran on (resolved value \u2014 never `auto`; `auto` is resolved server-side to `
|
|
241
|
+
"The proxy tier the request actually ran on (resolved value \u2014 never `auto`; `auto` is resolved server-side to `basic` or `advanced`)."
|
|
242
242
|
),
|
|
243
243
|
cache_hit: z.boolean().describe("Whether the result was served from cache (`true`) or freshly fetched (`false`).")
|
|
244
244
|
});
|
|
@@ -408,7 +408,7 @@ var DESCRIPTION3 = [
|
|
|
408
408
|
"(heavy JS rendering, full-page screenshots of long pages) \u2014 for a quick one-shot",
|
|
409
409
|
"fetch prefer the synchronous `scrape` tool, which blocks and returns the page directly.",
|
|
410
410
|
"Poll the job with `scrape_status` and fetch the page with `scrape_result` once done.",
|
|
411
|
-
"Optionally attach a per-job completion `webhook`:
|
|
411
|
+
"Optionally attach a per-job completion `webhook`: we deliver a single",
|
|
412
412
|
"signed `scrape.complete` POST to your endpoint when the job finishes (HTTPS required",
|
|
413
413
|
"in production), and echoes your opaque `webhook.metadata` back in the delivery",
|
|
414
414
|
"(under `data.metadata`, alongside `data.response_meta.usage`)."
|
|
@@ -470,11 +470,9 @@ function registerScrapeStatusTool(server, getClient) {
|
|
|
470
470
|
outputSchema: Schema_ApiScrapeStatusResponse.shape
|
|
471
471
|
},
|
|
472
472
|
(args) => (
|
|
473
|
-
// The
|
|
474
|
-
//
|
|
475
|
-
//
|
|
476
|
-
// names, so a plain cast won't type-check โ bridge through `unknown` until
|
|
477
|
-
// the SDK catches up. The runtime payload already matches the vendored shape.
|
|
473
|
+
// The SDK's `AsyncJobStatusResponse` is snake_case (job_id, created_at),
|
|
474
|
+
// matching the vendored status schema 1:1, so a direct cast lines the SDK
|
|
475
|
+
// return type up with the tool's output schema.
|
|
478
476
|
runTool(
|
|
479
477
|
async () => await getClient().getScrapeStatus(args.job_id)
|
|
480
478
|
)
|
|
@@ -549,7 +547,7 @@ function registerWhoamiTool(server, getClient) {
|
|
|
549
547
|
|
|
550
548
|
// src/version.ts
|
|
551
549
|
var SERVER_NAME = "crawlbrulee";
|
|
552
|
-
var SERVER_VERSION = "0.
|
|
550
|
+
var SERVER_VERSION = "0.5.0";
|
|
553
551
|
|
|
554
552
|
// src/server.ts
|
|
555
553
|
function buildServer(clientFactory = createDefaultClientFactory()) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crawlbrulee/mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.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.
|
|
58
|
+
"@crawlbrulee/sdk": "^0.7.0",
|
|
59
59
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
60
60
|
"zod": "^4.0.0"
|
|
61
61
|
},
|