scrapeunblocker-mcp 0.1.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/LICENSE +21 -0
- package/README.md +79 -0
- package/dist/index.js +127 -0
- package/package.json +54 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ScrapeUnblocker
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# ScrapeUnblocker MCP server
|
|
2
|
+
|
|
3
|
+
A [Model Context Protocol](https://modelcontextprotocol.io) server that lets
|
|
4
|
+
Claude (and any other MCP client) fetch **any web page's HTML** through the
|
|
5
|
+
[ScrapeUnblocker](https://scrapeunblocker.com) scraping API, bypassing anti-bot
|
|
6
|
+
protection (Cloudflare, DataDome, PerimeterX, Akamai, Shape).
|
|
7
|
+
|
|
8
|
+
You bring your **own** API key. Nothing is shared or proxied through us.
|
|
9
|
+
|
|
10
|
+
## Tools
|
|
11
|
+
|
|
12
|
+
| Tool | What it does |
|
|
13
|
+
|------|--------------|
|
|
14
|
+
| `fetch_html` | Fetch the fully rendered HTML of a URL. |
|
|
15
|
+
| `fetch_parsed` | Fetch a page and return AI-parsed structured JSON. |
|
|
16
|
+
| `google_search` | Run a Google search and return organic results as JSON. |
|
|
17
|
+
|
|
18
|
+
## Get an API key
|
|
19
|
+
|
|
20
|
+
Sign up and grab your key at **https://app.scrapeunblocker.com**. The server
|
|
21
|
+
reads it from the `SCRAPEUNBLOCKER_KEY` environment variable.
|
|
22
|
+
|
|
23
|
+
## Install
|
|
24
|
+
|
|
25
|
+
### Claude Code
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
claude mcp add scrapeunblocker \
|
|
29
|
+
--env SCRAPEUNBLOCKER_KEY=your_api_key_here \
|
|
30
|
+
-- npx -y scrapeunblocker-mcp
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Claude Desktop
|
|
34
|
+
|
|
35
|
+
Add this to your `claude_desktop_config.json`
|
|
36
|
+
(Settings → Developer → Edit Config):
|
|
37
|
+
|
|
38
|
+
```json
|
|
39
|
+
{
|
|
40
|
+
"mcpServers": {
|
|
41
|
+
"scrapeunblocker": {
|
|
42
|
+
"command": "npx",
|
|
43
|
+
"args": ["-y", "scrapeunblocker-mcp"],
|
|
44
|
+
"env": {
|
|
45
|
+
"SCRAPEUNBLOCKER_KEY": "your_api_key_here"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Restart Claude Desktop and the ScrapeUnblocker tools appear.
|
|
53
|
+
|
|
54
|
+
### Any other MCP client
|
|
55
|
+
|
|
56
|
+
Run the server over stdio:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
SCRAPEUNBLOCKER_KEY=your_api_key_here npx -y scrapeunblocker-mcp
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Example prompts
|
|
63
|
+
|
|
64
|
+
- "Fetch the HTML of https://www.example-shop.com/product/123 and list the price."
|
|
65
|
+
- "This page keeps blocking me: <url>. Use fetch_html to get it."
|
|
66
|
+
- "Search Google for 'best running shoes 2026' and give me the top 5 links."
|
|
67
|
+
|
|
68
|
+
## Development
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
npm install
|
|
72
|
+
npm run build # bundles to dist/ with tsup
|
|
73
|
+
npm run typecheck
|
|
74
|
+
SCRAPEUNBLOCKER_KEY=... node dist/index.js # run the server
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## License
|
|
78
|
+
|
|
79
|
+
MIT
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/index.ts
|
|
4
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
5
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
import { ScrapeUnblockerClient } from "scrapeunblocker";
|
|
8
|
+
var VERSION = "0.1.0";
|
|
9
|
+
function resolveApiKey() {
|
|
10
|
+
return process.env.SCRAPEUNBLOCKER_KEY ?? process.env.SCRAPEUNBLOCKER_API_KEY ?? void 0;
|
|
11
|
+
}
|
|
12
|
+
var MISSING_KEY_MESSAGE = "No ScrapeUnblocker API key found. Set the SCRAPEUNBLOCKER_KEY environment variable to your own key (get one at https://app.scrapeunblocker.com) and restart the MCP server.";
|
|
13
|
+
function client() {
|
|
14
|
+
const apiKey = resolveApiKey();
|
|
15
|
+
if (!apiKey) throw new Error(MISSING_KEY_MESSAGE);
|
|
16
|
+
const baseUrl = process.env.SCRAPEUNBLOCKER_BASE_URL || void 0;
|
|
17
|
+
return new ScrapeUnblockerClient({ apiKey, baseUrl });
|
|
18
|
+
}
|
|
19
|
+
function errorText(err) {
|
|
20
|
+
if (err instanceof Error) return err.message;
|
|
21
|
+
return String(err);
|
|
22
|
+
}
|
|
23
|
+
var server = new McpServer({
|
|
24
|
+
name: "scrapeunblocker",
|
|
25
|
+
version: VERSION
|
|
26
|
+
});
|
|
27
|
+
server.registerTool(
|
|
28
|
+
"fetch_html",
|
|
29
|
+
{
|
|
30
|
+
title: "Fetch page HTML",
|
|
31
|
+
description: "Fetch the fully rendered HTML of any web page through ScrapeUnblocker, bypassing anti-bot protection (Cloudflare, DataDome, PerimeterX, Akamai, Shape). Use this when a normal fetch is blocked (403/429, captcha, 'access denied') or when the page needs a real browser to render. Returns the raw HTML as text.",
|
|
32
|
+
inputSchema: {
|
|
33
|
+
url: z.string().url().describe("The absolute URL to fetch (http/https)."),
|
|
34
|
+
proxy_country: z.string().length(2).optional().describe(
|
|
35
|
+
"Optional ISO 3166-1 alpha-2 country code to route through, e.g. 'US', 'GB', 'DE'."
|
|
36
|
+
),
|
|
37
|
+
wait_method: z.enum(["css", "js"]).optional().describe(
|
|
38
|
+
"Optional render-wait strategy: 'css' waits for a selector, 'js' waits for a JS expression to be truthy."
|
|
39
|
+
),
|
|
40
|
+
wait_value: z.string().optional().describe(
|
|
41
|
+
`The CSS selector or JS expression paired with wait_method (e.g. '#price' or 'document.readyState==="complete"').`
|
|
42
|
+
),
|
|
43
|
+
method_timeout_seconds: z.number().int().positive().optional().describe("Cap in seconds for the render-wait method."),
|
|
44
|
+
sleep_seconds: z.number().positive().optional().describe("Extra seconds to wait after load before capturing the HTML.")
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
async (args) => {
|
|
48
|
+
try {
|
|
49
|
+
const html = await client().getPageSource(args.url, {
|
|
50
|
+
proxyCountry: args.proxy_country,
|
|
51
|
+
method: args.wait_method,
|
|
52
|
+
value: args.wait_value,
|
|
53
|
+
methodTimeout: args.method_timeout_seconds,
|
|
54
|
+
timeSleep: args.sleep_seconds
|
|
55
|
+
});
|
|
56
|
+
return { content: [{ type: "text", text: html }] };
|
|
57
|
+
} catch (err) {
|
|
58
|
+
return { content: [{ type: "text", text: errorText(err) }], isError: true };
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
server.registerTool(
|
|
63
|
+
"fetch_parsed",
|
|
64
|
+
{
|
|
65
|
+
title: "Fetch AI-parsed page data",
|
|
66
|
+
description: "Fetch a web page through ScrapeUnblocker and return AI-parsed structured JSON instead of raw HTML (e.g. product details, article content). Best for extracting fields from product, listing or article pages without writing your own HTML parsing.",
|
|
67
|
+
inputSchema: {
|
|
68
|
+
url: z.string().url().describe("The absolute URL to fetch and parse."),
|
|
69
|
+
proxy_country: z.string().length(2).optional().describe("Optional ISO country code to route through, e.g. 'US'."),
|
|
70
|
+
rules_hint: z.string().optional().describe(
|
|
71
|
+
"Optional natural-language hint about what to extract, to guide parsing."
|
|
72
|
+
)
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
async (args) => {
|
|
76
|
+
try {
|
|
77
|
+
const parsed = await client().getParsed(args.url, {
|
|
78
|
+
proxyCountry: args.proxy_country,
|
|
79
|
+
rulesHint: args.rules_hint
|
|
80
|
+
});
|
|
81
|
+
return {
|
|
82
|
+
content: [{ type: "text", text: JSON.stringify(parsed, null, 2) }]
|
|
83
|
+
};
|
|
84
|
+
} catch (err) {
|
|
85
|
+
return { content: [{ type: "text", text: errorText(err) }], isError: true };
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
server.registerTool(
|
|
90
|
+
"google_search",
|
|
91
|
+
{
|
|
92
|
+
title: "Google search results",
|
|
93
|
+
description: "Run a Google search through ScrapeUnblocker and return the organic results as structured JSON. Use this to discover URLs before fetching them.",
|
|
94
|
+
inputSchema: {
|
|
95
|
+
keyword: z.string().min(1).describe("The search query."),
|
|
96
|
+
proxy_country: z.string().length(2).optional().describe("Optional ISO country code to search from, e.g. 'US'."),
|
|
97
|
+
pages_to_check: z.number().int().positive().max(10).optional().describe("How many result pages to collect (default 1).")
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
async (args) => {
|
|
101
|
+
try {
|
|
102
|
+
const results = await client().serp(args.keyword, {
|
|
103
|
+
proxyCountry: args.proxy_country,
|
|
104
|
+
pagesToCheck: args.pages_to_check
|
|
105
|
+
});
|
|
106
|
+
return {
|
|
107
|
+
content: [{ type: "text", text: JSON.stringify(results, null, 2) }]
|
|
108
|
+
};
|
|
109
|
+
} catch (err) {
|
|
110
|
+
return { content: [{ type: "text", text: errorText(err) }], isError: true };
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
);
|
|
114
|
+
async function main() {
|
|
115
|
+
const transport = new StdioServerTransport();
|
|
116
|
+
await server.connect(transport);
|
|
117
|
+
if (!resolveApiKey()) {
|
|
118
|
+
process.stderr.write(
|
|
119
|
+
"[scrapeunblocker-mcp] Warning: " + MISSING_KEY_MESSAGE + "\n"
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
main().catch((err) => {
|
|
124
|
+
process.stderr.write(`[scrapeunblocker-mcp] Fatal: ${errorText(err)}
|
|
125
|
+
`);
|
|
126
|
+
process.exit(1);
|
|
127
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "scrapeunblocker-mcp",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Model Context Protocol (MCP) server for ScrapeUnblocker - lets Claude fetch any web page's HTML (or AI-parsed JSON) through the ScrapeUnblocker anti-bot API, using your own API key.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"mcp",
|
|
7
|
+
"model-context-protocol",
|
|
8
|
+
"claude",
|
|
9
|
+
"scraping",
|
|
10
|
+
"web-scraping",
|
|
11
|
+
"scrapeunblocker",
|
|
12
|
+
"anti-bot",
|
|
13
|
+
"cloudflare",
|
|
14
|
+
"datadome"
|
|
15
|
+
],
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"author": "ScrapeUnblocker",
|
|
18
|
+
"homepage": "https://scrapeunblocker.com",
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/ScrapeUnblocker/scrapeunblocker-mcp.git"
|
|
22
|
+
},
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/ScrapeUnblocker/scrapeunblocker-mcp/issues"
|
|
25
|
+
},
|
|
26
|
+
"type": "module",
|
|
27
|
+
"bin": {
|
|
28
|
+
"scrapeunblocker-mcp": "dist/index.js"
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"dist"
|
|
32
|
+
],
|
|
33
|
+
"engines": {
|
|
34
|
+
"node": ">=18"
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "tsup",
|
|
38
|
+
"typecheck": "tsc --noEmit",
|
|
39
|
+
"start": "node dist/index.js",
|
|
40
|
+
"dev": "tsx src/index.ts",
|
|
41
|
+
"prepublishOnly": "npm run build"
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"@modelcontextprotocol/sdk": "^1.12.0",
|
|
45
|
+
"scrapeunblocker": "^0.1.1",
|
|
46
|
+
"zod": "^3.23.8"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@types/node": "^20.19.43",
|
|
50
|
+
"tsup": "^8.0.0",
|
|
51
|
+
"tsx": "^4.16.0",
|
|
52
|
+
"typescript": "^5.4.0"
|
|
53
|
+
}
|
|
54
|
+
}
|