@zenrows/mcp 2.0.5 → 2.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 +1 -1
- package/README.md +82 -179
- package/dist/http.js +52 -14
- package/dist/index.js +1 -1
- package/dist/server.js +8 -8
- package/dist/tools/browser.js +2 -2
- package/package.json +4 -4
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,149 +1,94 @@
|
|
|
1
1
|
<p align="center">
|
|
2
2
|
<picture>
|
|
3
3
|
<source media="(prefers-color-scheme: dark)" srcset="assets/zenrows_light.svg">
|
|
4
|
-
<img src="assets/zenrows_dark.svg" alt="
|
|
4
|
+
<img src="assets/zenrows_dark.svg" alt="Zenrows MCP" width="380">
|
|
5
5
|
</picture>
|
|
6
6
|
</p>
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
Model Context Protocol server for the <a href="https://www.zenrows.com/products/universal-scraper">ZenRows Universal Scraper API</a>.<br>
|
|
10
|
-
Give any MCP-compatible AI assistant the ability to scrape any webpage — including JavaScript-rendered content and anti-bot protected sites.
|
|
11
|
-
</p>
|
|
8
|
+
# Zenrows MCP Server
|
|
12
9
|
|
|
13
|
-
|
|
14
|
-
<a href="https://www.npmjs.com/package/@zenrows/mcp"><img src="https://img.shields.io/npm/v/@zenrows/mcp" alt="npm version"></a>
|
|
15
|
-
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue" alt="MIT License"></a>
|
|
16
|
-
</p>
|
|
10
|
+
The Zenrows MCP (Model Context Protocol) server is the standard way AI systems use Zenrows' web data infrastructure. A single connection gives your AI assistant, agent, or application reliable, real-time access to the live web, including the protected web.
|
|
17
11
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
## Quick Start
|
|
12
|
+
[](https://www.npmjs.com/package/@zenrows/mcp)
|
|
13
|
+
[](https://github.com/ZenRows/zenrows-mcp/blob/main/LICENSE)
|
|
21
14
|
|
|
22
|
-
**
|
|
15
|
+
📚 **Full documentation:** [docs.zenrows.com/mcp/overview](https://docs.zenrows.com/mcp/overview)
|
|
23
16
|
|
|
24
|
-
|
|
25
|
-
claude mcp add zenrows -e ZENROWS_API_KEY=YOUR_API_KEY -- npx -y @zenrows/mcp
|
|
26
|
-
```
|
|
17
|
+
---
|
|
27
18
|
|
|
28
|
-
|
|
19
|
+
## Why Zenrows MCP
|
|
29
20
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
21
|
+
- **Reach sites that normally block bots.** Get reliable access to protected sites at scale, without building anti-bot handling yourself.
|
|
22
|
+
- **Managed web data infrastructure.** Proxy rotation, headless browser orchestration, anti-bot handling, and session management run on Zenrows' infrastructure.
|
|
23
|
+
- **Plug into any AI you already use.** Works with any MCP client, including AI assistants, agent frameworks, AI SDKs, IDE plugins, and custom applications.
|
|
24
|
+
- **Plain English, no scraping code.** Describe the task naturally and the AI picks the right tool. No selectors, no proxy management, no anti-bot tuning.
|
|
33
25
|
|
|
34
26
|
---
|
|
35
27
|
|
|
36
|
-
##
|
|
37
|
-
|
|
38
|
-
### `scrape`
|
|
39
|
-
|
|
40
|
-
Fetches a webpage and returns its content as clean markdown (default), plaintext, raw HTML, PDF, structured JSON, or a screenshot. See the [ZenRows API docs](https://docs.zenrows.com/universal-scraper-api/api-reference#parameter-overview) for full parameter reference.
|
|
41
|
-
|
|
42
|
-
| Parameter | Type | Default | Description |
|
|
43
|
-
| --------------------- | -------------------------------------------- | ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
44
|
-
| `url` | string | **required** | Webpage URL to scrape |
|
|
45
|
-
| `js_render` | boolean | `false` | Enable JS rendering for SPAs and dynamic content |
|
|
46
|
-
| `premium_proxy` | boolean | `false` | Use residential proxies to bypass anti-bot systems |
|
|
47
|
-
| `proxy_country` | string | — | ISO 3166-1 alpha-2 country code (e.g. `US`, `GB`). Requires `premium_proxy` |
|
|
48
|
-
| `response_type` | `markdown` \| `plaintext` \| `pdf` \| `html` | `markdown` | Output format. `html` returns raw source (ZenRows default when no param is sent). Ignored when `autoparse`, `css_extractor`, `outputs`, or screenshot params are set |
|
|
49
|
-
| `autoparse` | boolean | — | Auto-extract structured JSON from the page |
|
|
50
|
-
| `css_extractor` | string | — | JSON map of CSS selectors: `{"title":"h1","price":".price"}` |
|
|
51
|
-
| `outputs` | string | — | Comma-separated data types to extract as JSON: `emails`, `headings`, `links`, `menus`, `images`, `videos`, `audios`. Use `*` for all |
|
|
52
|
-
| `screenshot` | boolean | — | Capture an above-the-fold screenshot. Returns an image |
|
|
53
|
-
| `screenshot_fullpage` | boolean | — | Capture a full-page screenshot. Returns an image |
|
|
54
|
-
| `screenshot_selector` | string | — | Capture a screenshot of a specific element via CSS selector |
|
|
55
|
-
| `wait_for` | string | — | CSS selector to wait for before capturing. Requires `js_render` |
|
|
56
|
-
| `wait` | number | — | Milliseconds to wait after load (max 30000). Requires `js_render` |
|
|
57
|
-
| `js_instructions` | string | — | JSON array of browser actions. Requires `js_render` |
|
|
28
|
+
## Quick start
|
|
58
29
|
|
|
59
|
-
|
|
30
|
+
Zenrows MCP supports two transport options. Both expose the same set of tools and capabilities. Pick the one that fits your client.
|
|
60
31
|
|
|
61
|
-
|
|
32
|
+
### Remote MCP server
|
|
62
33
|
|
|
63
|
-
|
|
64
|
-
→ Enable `js_render: true`. The page likely uses React, Vue, or Angular.
|
|
34
|
+
Use the hosted Zenrows MCP server when your AI application calls an LLM API directly. The server runs on Zenrows' infrastructure, so there is nothing to install, configure, or update.
|
|
65
35
|
|
|
66
|
-
**
|
|
67
|
-
→ Add `premium_proxy: true`. For geo-restricted content, also set `proxy_country`.
|
|
36
|
+
**Server URL:**
|
|
68
37
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
38
|
+
```
|
|
39
|
+
https://mcp.zenrows.com/mcp
|
|
40
|
+
```
|
|
72
41
|
|
|
73
|
-
**
|
|
74
|
-
→ Use `css_extractor` with a JSON map of selectors for precise extraction.
|
|
75
|
-
→ Use `autoparse` for structured pages like products or articles.
|
|
76
|
-
→ Use `outputs` to pull links, emails, images, or other content types.
|
|
42
|
+
**Transport:** Streamable HTTP
|
|
77
43
|
|
|
78
|
-
**
|
|
79
|
-
→ Use `screenshot` or `screenshot_fullpage` for visual debugging.
|
|
80
|
-
→ Use `screenshot_selector` to capture a specific element.
|
|
44
|
+
**Authentication:** OAuth-based. Pass your Zenrows API key as a Bearer token in the `Authorization` header on every request.
|
|
81
45
|
|
|
82
|
-
|
|
46
|
+
```
|
|
47
|
+
Authorization: Bearer YOUR_ZENROWS_API_KEY
|
|
48
|
+
```
|
|
83
49
|
|
|
84
|
-
|
|
50
|
+
Most MCP clients accept this through an `authorization` shorthand field on the tool config and forward it as the Bearer token automatically. Some clients use a free-form `headers` field instead. Either approach works.
|
|
85
51
|
|
|
86
|
-
|
|
52
|
+
#### Example: OpenAI Responses API
|
|
87
53
|
|
|
88
|
-
|
|
54
|
+
```python
|
|
55
|
+
import os
|
|
56
|
+
from openai import OpenAI
|
|
89
57
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
"mcpServers": {
|
|
93
|
-
"zenrows": {
|
|
94
|
-
"command": "npx",
|
|
95
|
-
"args": ["-y", "@zenrows/mcp"],
|
|
96
|
-
"env": {
|
|
97
|
-
"ZENROWS_API_KEY": "YOUR_API_KEY"
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
```
|
|
58
|
+
ZENROWS_API_KEY = os.environ["ZENROWS_API_KEY"]
|
|
59
|
+
client = OpenAI(api_key=os.environ["OPENAI_API_KEY"])
|
|
103
60
|
|
|
104
|
-
|
|
61
|
+
response = client.responses.create(
|
|
62
|
+
model="gpt-5",
|
|
63
|
+
tools=[
|
|
64
|
+
{
|
|
65
|
+
"type": "mcp",
|
|
66
|
+
"server_label": "zenrows",
|
|
67
|
+
"server_description": "Web scraping MCP server for accessing live web content.",
|
|
68
|
+
"server_url": "https://mcp.zenrows.com/mcp",
|
|
69
|
+
"authorization": ZENROWS_API_KEY,
|
|
70
|
+
"require_approval": "never",
|
|
71
|
+
}
|
|
72
|
+
],
|
|
73
|
+
input="Visit https://news.ycombinator.com/ and summarize the three most recent posts.",
|
|
74
|
+
)
|
|
105
75
|
|
|
106
|
-
|
|
107
|
-
claude mcp add zenrows -e ZENROWS_API_KEY=YOUR_API_KEY -- npx -y @zenrows/mcp
|
|
76
|
+
print(response.output_text)
|
|
108
77
|
```
|
|
109
78
|
|
|
110
|
-
|
|
79
|
+
For the full walkthrough with framework-specific examples, see the [Remote MCP server docs](https://docs.zenrows.com/mcp/overview#remote-mcp-server).
|
|
111
80
|
|
|
112
|
-
|
|
113
|
-
{
|
|
114
|
-
"mcpServers": {
|
|
115
|
-
"zenrows": {
|
|
116
|
-
"command": "npx",
|
|
117
|
-
"args": ["-y", "@zenrows/mcp"],
|
|
118
|
-
"env": {
|
|
119
|
-
"ZENROWS_API_KEY": "YOUR_API_KEY"
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
```
|
|
81
|
+
### Local MCP server
|
|
125
82
|
|
|
126
|
-
|
|
83
|
+
Use the local stdio configuration when your MCP client runs the server as a local subprocess instead of calling a remote URL. This is the standard setup for desktop AI tools and IDE plugins, including Claude Desktop, Claude Code, Cursor, Windsurf, VS Code, Zed, and JetBrains IDEs.
|
|
127
84
|
|
|
128
|
-
|
|
85
|
+
**Package:** [`@zenrows/mcp`](https://www.npmjs.com/package/@zenrows/mcp) on npm
|
|
129
86
|
|
|
130
|
-
|
|
131
|
-
{
|
|
132
|
-
"mcpServers": {
|
|
133
|
-
"zenrows": {
|
|
134
|
-
"command": "npx",
|
|
135
|
-
"args": ["-y", "@zenrows/mcp"],
|
|
136
|
-
"env": {
|
|
137
|
-
"ZENROWS_API_KEY": "YOUR_API_KEY"
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
```
|
|
87
|
+
**Authentication:** API key via the `ZENROWS_API_KEY` environment variable.
|
|
143
88
|
|
|
144
|
-
|
|
89
|
+
**Requirements:** [Node.js](https://nodejs.org/) installed (for `npx` to work).
|
|
145
90
|
|
|
146
|
-
|
|
91
|
+
**Configuration:**
|
|
147
92
|
|
|
148
93
|
```json
|
|
149
94
|
{
|
|
@@ -152,98 +97,56 @@ Edit `~/.codeium/windsurf/mcp_config.json`:
|
|
|
152
97
|
"command": "npx",
|
|
153
98
|
"args": ["-y", "@zenrows/mcp"],
|
|
154
99
|
"env": {
|
|
155
|
-
"ZENROWS_API_KEY": "
|
|
100
|
+
"ZENROWS_API_KEY": "YOUR_ZENROWS_API_KEY"
|
|
156
101
|
}
|
|
157
102
|
}
|
|
158
103
|
}
|
|
159
104
|
}
|
|
160
105
|
```
|
|
161
106
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
Edit `.vscode/mcp.json` in your project:
|
|
165
|
-
|
|
166
|
-
```json
|
|
167
|
-
{
|
|
168
|
-
"servers": {
|
|
169
|
-
"zenrows": {
|
|
170
|
-
"type": "stdio",
|
|
171
|
-
"command": "npx",
|
|
172
|
-
"args": ["-y", "@zenrows/mcp"],
|
|
173
|
-
"env": {
|
|
174
|
-
"ZENROWS_API_KEY": "YOUR_API_KEY"
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
```
|
|
107
|
+
The exact location of this config varies by client. See the [per-client setup guides](https://docs.zenrows.com/mcp/overview#per-client-setup-guides) for the file path for your client.
|
|
180
108
|
|
|
181
|
-
|
|
109
|
+
---
|
|
182
110
|
|
|
183
|
-
|
|
111
|
+
## Tools
|
|
184
112
|
|
|
185
|
-
|
|
186
|
-
{
|
|
187
|
-
"context_servers": {
|
|
188
|
-
"zenrows": {
|
|
189
|
-
"command": {
|
|
190
|
-
"path": "npx",
|
|
191
|
-
"args": ["-y", "@zenrows/mcp"],
|
|
192
|
-
"env": {
|
|
193
|
-
"ZENROWS_API_KEY": "YOUR_API_KEY"
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
```
|
|
113
|
+
The Zenrows MCP exposes two families of tools:
|
|
200
114
|
|
|
201
|
-
|
|
115
|
+
- **`scrape`**: single-request fetch returning Markdown, plain text, HTML, JSON, PDF, or screenshot. Backed by [Fetch](https://docs.zenrows.com/fetch/api-reference).
|
|
116
|
+
- **`browser_*`**: 30+ tools for full browser automation including navigation, clicks, form fills, JavaScript execution, cookies, tabs, and persistent sessions. Backed by [Browser Sessions](https://docs.zenrows.com/browser-sessions/introduction).
|
|
202
117
|
|
|
203
|
-
|
|
118
|
+
The AI selects the right tool from your prompt. You don't call tools directly in code.
|
|
204
119
|
|
|
205
|
-
|
|
206
|
-
{
|
|
207
|
-
"mcpServers": {
|
|
208
|
-
"zenrows": {
|
|
209
|
-
"command": "npx",
|
|
210
|
-
"args": ["-y", "@zenrows/mcp"],
|
|
211
|
-
"env": {
|
|
212
|
-
"ZENROWS_API_KEY": "YOUR_API_KEY"
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
```
|
|
120
|
+
See the [full tool reference](https://docs.zenrows.com/mcp/overview#tools) for every tool, parameter, and return value.
|
|
218
121
|
|
|
219
122
|
---
|
|
220
123
|
|
|
221
|
-
##
|
|
222
|
-
|
|
223
|
-
Once configured, ask your AI assistant naturally:
|
|
124
|
+
## Development
|
|
224
125
|
|
|
126
|
+
```bash
|
|
127
|
+
git clone https://github.com/ZenRows/zenrows-mcp
|
|
128
|
+
cd zenrows-mcp
|
|
129
|
+
npm install
|
|
130
|
+
cp .env.example .env # Add your API key
|
|
131
|
+
npm run dev # Run with .env loaded (requires Node.js 20.6+)
|
|
132
|
+
npm run build # Compile to dist/
|
|
133
|
+
npm run inspect # Open the MCP inspector UI
|
|
225
134
|
```
|
|
226
|
-
Scrape the pricing page at https://zenrows.com/pricing and summarize the plans.
|
|
227
135
|
|
|
228
|
-
|
|
136
|
+
Pull requests and issues are welcome.
|
|
229
137
|
|
|
230
|
-
|
|
138
|
+
---
|
|
231
139
|
|
|
232
|
-
|
|
140
|
+
## Resources
|
|
233
141
|
|
|
234
|
-
|
|
235
|
-
|
|
142
|
+
- [Full Zenrows MCP documentation](https://docs.zenrows.com/mcp/overview)
|
|
143
|
+
- [Zenrows Fetch](https://docs.zenrows.com/fetch/api-reference)
|
|
144
|
+
- [Zenrows Browser Sessions](https://docs.zenrows.com/browser-sessions/introduction)
|
|
145
|
+
- [npm package](https://www.npmjs.com/package/@zenrows/mcp)
|
|
146
|
+
- [Get your API key](https://app.zenrows.com/register)
|
|
236
147
|
|
|
237
148
|
---
|
|
238
149
|
|
|
239
|
-
##
|
|
150
|
+
## License
|
|
240
151
|
|
|
241
|
-
|
|
242
|
-
git clone https://github.com/ZenRows/zenrows-mcp
|
|
243
|
-
cd zenrows-mcp
|
|
244
|
-
npm install
|
|
245
|
-
cp .env.example .env # add your API key
|
|
246
|
-
npm run dev # run with .env loaded (requires Node 20.6+)
|
|
247
|
-
npm run build # compile to dist/
|
|
248
|
-
npm run inspect # open MCP inspector UI
|
|
249
|
-
```
|
|
152
|
+
[MIT](LICENSE)
|
package/dist/http.js
CHANGED
|
@@ -5,9 +5,6 @@ import { WebStandardStreamableHTTPServerTransport } from "@modelcontextprotocol/
|
|
|
5
5
|
import { createServer } from "./server.js";
|
|
6
6
|
// ─── app ──────────────────────────────────────────────────────────────────────
|
|
7
7
|
const app = new Hono();
|
|
8
|
-
// Cache MCP client name per API key across invocations.
|
|
9
|
-
// Populated from the clientInfo field in MCP initialize requests.
|
|
10
|
-
const mcpClientCache = new Map();
|
|
11
8
|
// CORS — required for browser-side MCP clients (Claude.ai, Cursor web, etc.)
|
|
12
9
|
// All origins allowed: the API key is the auth mechanism, not the origin.
|
|
13
10
|
app.use(cors({
|
|
@@ -50,9 +47,58 @@ app.get("/.well-known/oauth-authorization-server", (c) => c.json({
|
|
|
50
47
|
code_challenge_methods_supported: ["S256"],
|
|
51
48
|
token_endpoint_auth_methods_supported: ["none"],
|
|
52
49
|
}));
|
|
50
|
+
// MCP Server Card (SEP-2127 canonical + SEP-1649 legacy paths).
|
|
51
|
+
// Lets agents discover this remote MCP before connecting.
|
|
52
|
+
function mcpServerCard() {
|
|
53
|
+
return {
|
|
54
|
+
$schema: "https://static.modelcontextprotocol.io/schemas/v1/server-card.schema.json",
|
|
55
|
+
name: "io.zenrows/mcp",
|
|
56
|
+
version: "2.0.6",
|
|
57
|
+
description: "ZenRows MCP — scrape and extract from protected sites via the Universal Scraper API (anti-bot bypass, JS rendering, proxies).",
|
|
58
|
+
websiteUrl: "https://www.zenrows.com/mcp",
|
|
59
|
+
remotes: [
|
|
60
|
+
{
|
|
61
|
+
type: "streamable-http",
|
|
62
|
+
url: `${MCP_SERVER}/mcp`,
|
|
63
|
+
headers: {
|
|
64
|
+
Authorization: "Bearer ${ZENROWS_API_KEY}",
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
// Older SEP-1649-shaped fields some scanners still expect.
|
|
69
|
+
protocolVersion: "2025-06-18",
|
|
70
|
+
serverInfo: {
|
|
71
|
+
name: "ZenRows",
|
|
72
|
+
version: "2.0.6",
|
|
73
|
+
description: "ZenRows Universal Scraper API via MCP",
|
|
74
|
+
homepage: "https://www.zenrows.com/mcp",
|
|
75
|
+
},
|
|
76
|
+
transport: {
|
|
77
|
+
type: "streamable-http",
|
|
78
|
+
url: `${MCP_SERVER}/mcp`,
|
|
79
|
+
},
|
|
80
|
+
capabilities: {
|
|
81
|
+
tools: true,
|
|
82
|
+
resources: false,
|
|
83
|
+
prompts: false,
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
app.get("/.well-known/mcp.json", (c) => c.json(mcpServerCard(), 200, {
|
|
88
|
+
"Cache-Control": "public, max-age=300",
|
|
89
|
+
"X-Content-Type-Options": "nosniff",
|
|
90
|
+
}));
|
|
91
|
+
app.get("/.well-known/mcp/server-card.json", (c) => c.json(mcpServerCard(), 200, {
|
|
92
|
+
"Cache-Control": "public, max-age=300",
|
|
93
|
+
"X-Content-Type-Options": "nosniff",
|
|
94
|
+
}));
|
|
95
|
+
app.get("/.well-known/mcp/server-cards.json", (c) => c.json(mcpServerCard(), 200, {
|
|
96
|
+
"Cache-Control": "public, max-age=300",
|
|
97
|
+
"X-Content-Type-Options": "nosniff",
|
|
98
|
+
}));
|
|
53
99
|
// RFC 7591 — Dynamic Client Registration
|
|
54
100
|
// MCP clients (Claude.ai, Cursor, etc.) register themselves before initiating OAuth.
|
|
55
|
-
// Since
|
|
101
|
+
// Since Zenrows API keys are the real auth mechanism, client registration is stateless —
|
|
56
102
|
// we echo back a stable client_id derived from the request (or the one the client provides).
|
|
57
103
|
app.post("/register", async (c) => {
|
|
58
104
|
const body = await c.req.json().catch(() => ({}));
|
|
@@ -96,17 +142,9 @@ app.all("/mcp", async (c) => {
|
|
|
96
142
|
sessionIdGenerator: undefined, // stateless — no session tracking between requests
|
|
97
143
|
enableJsonResponse: true, // return JSON instead of SSE (simpler for Lambda + most MCP clients)
|
|
98
144
|
});
|
|
99
|
-
|
|
100
|
-
// creates a new server per request, so getClientVersion() is only set during
|
|
101
|
-
// the initialize request itself, not during subsequent tool calls).
|
|
102
|
-
const server = createServer(apiKey, mcpClientCache.get(apiKey));
|
|
145
|
+
const server = createServer(apiKey, c.req.raw.headers.get("user-agent") ?? undefined);
|
|
103
146
|
await server.connect(transport);
|
|
104
147
|
const response = await transport.handleRequest(c.req.raw);
|
|
105
|
-
// If this was an initialize request, getClientVersion() is now set — cache it
|
|
106
|
-
// so subsequent tool call requests can include x-mcp-client-name.
|
|
107
|
-
const resolvedName = server.server.getClientVersion()?.name;
|
|
108
|
-
if (resolvedName)
|
|
109
|
-
mcpClientCache.set(apiKey, resolvedName);
|
|
110
148
|
await transport.close();
|
|
111
149
|
return response;
|
|
112
150
|
});
|
|
@@ -136,6 +174,6 @@ export const handler = async (event) => {
|
|
|
136
174
|
if (!process.env.AWS_LAMBDA_FUNCTION_NAME) {
|
|
137
175
|
const port = Number(process.env.PORT) || 3000;
|
|
138
176
|
serve({ fetch: app.fetch, port }, () => {
|
|
139
|
-
process.stderr.write(`
|
|
177
|
+
process.stderr.write(`Zenrows MCP HTTP server listening on http://localhost:${port}/mcp\n`);
|
|
140
178
|
});
|
|
141
179
|
}
|
package/dist/index.js
CHANGED
package/dist/server.js
CHANGED
|
@@ -23,7 +23,7 @@ export function createServer(apiKey, clientName) {
|
|
|
23
23
|
readOnlyHint: true,
|
|
24
24
|
destructiveHint: false,
|
|
25
25
|
},
|
|
26
|
-
description: `Scrape any webpage and return its content using
|
|
26
|
+
description: `Scrape any webpage and return its content using Zenrows.
|
|
27
27
|
|
|
28
28
|
Use this tool to fetch webpage content for analysis. By default it returns clean
|
|
29
29
|
markdown, which is ideal for LLM processing.
|
|
@@ -67,7 +67,7 @@ Examples:
|
|
|
67
67
|
.describe("Output format. 'markdown' (default) preserves structure and is ideal for LLMs. " +
|
|
68
68
|
"'plaintext' strips all formatting for pure text extraction. " +
|
|
69
69
|
"'pdf' returns a PDF of the page. " +
|
|
70
|
-
"'html' returns the raw HTML source (omits the response_type param;
|
|
70
|
+
"'html' returns the raw HTML source (omits the response_type param; Zenrows default). " +
|
|
71
71
|
"Ignored when autoparse, css_extractor, outputs, or screenshot params are set."),
|
|
72
72
|
autoparse: z
|
|
73
73
|
.boolean()
|
|
@@ -154,7 +154,7 @@ Examples:
|
|
|
154
154
|
if (params.screenshot_selector)
|
|
155
155
|
searchParams.set("screenshot_selector", params.screenshot_selector);
|
|
156
156
|
// response_type is mutually exclusive with autoparse, css_extractor, outputs, and screenshot params.
|
|
157
|
-
// 'html' is the
|
|
157
|
+
// 'html' is the Zenrows default (no param); all other values are passed through.
|
|
158
158
|
const isScreenshot = params.screenshot || params.screenshot_fullpage || params.screenshot_selector;
|
|
159
159
|
const effectiveType = params.response_type ?? DEFAULT_RESPONSE_TYPE;
|
|
160
160
|
if (!params.autoparse &&
|
|
@@ -179,7 +179,7 @@ Examples:
|
|
|
179
179
|
content: [
|
|
180
180
|
{
|
|
181
181
|
type: "text",
|
|
182
|
-
text: `Network error contacting
|
|
182
|
+
text: `Network error contacting Zenrows: ${err instanceof Error ? err.message : String(err)}`,
|
|
183
183
|
},
|
|
184
184
|
],
|
|
185
185
|
isError: true,
|
|
@@ -188,7 +188,7 @@ Examples:
|
|
|
188
188
|
if (!response.ok) {
|
|
189
189
|
const body = await response.text();
|
|
190
190
|
return {
|
|
191
|
-
content: [{ type: "text", text: `
|
|
191
|
+
content: [{ type: "text", text: `Zenrows error ${response.status}: ${body}` }],
|
|
192
192
|
isError: true,
|
|
193
193
|
};
|
|
194
194
|
}
|
|
@@ -225,7 +225,7 @@ Examples:
|
|
|
225
225
|
role: "user",
|
|
226
226
|
content: {
|
|
227
227
|
type: "text",
|
|
228
|
-
text: `Scrape ${url} using the
|
|
228
|
+
text: `Scrape ${url} using the Zenrows MCP scrape tool and provide a concise summary of the main content. Include key points, headings, and any important data found on the page.`,
|
|
229
229
|
},
|
|
230
230
|
},
|
|
231
231
|
],
|
|
@@ -245,7 +245,7 @@ Examples:
|
|
|
245
245
|
role: "user",
|
|
246
246
|
content: {
|
|
247
247
|
type: "text",
|
|
248
|
-
text: `Scrape ${url} using the
|
|
248
|
+
text: `Scrape ${url} using the Zenrows MCP scrape tool with css_extractor set to ${fields}. Return the extracted data as a clean JSON object.`,
|
|
249
249
|
},
|
|
250
250
|
},
|
|
251
251
|
],
|
|
@@ -262,7 +262,7 @@ Examples:
|
|
|
262
262
|
role: "user",
|
|
263
263
|
content: {
|
|
264
264
|
type: "text",
|
|
265
|
-
text: `Scrape ${url} using the
|
|
265
|
+
text: `Scrape ${url} using the Zenrows MCP scrape tool with js_render set to true. The page requires JavaScript execution to load its content. Return the full rendered content in markdown format.`,
|
|
266
266
|
},
|
|
267
267
|
},
|
|
268
268
|
],
|
package/dist/tools/browser.js
CHANGED
|
@@ -15,10 +15,10 @@ export function registerBrowserTools(server, apiKey, browserUrl, getClientName)
|
|
|
15
15
|
// ─── Session ─────────────────────────────────────────────────────────────
|
|
16
16
|
server.registerTool("browser_navigate", {
|
|
17
17
|
annotations: { title: "Open Browser & Navigate", readOnlyHint: false, destructiveHint: false },
|
|
18
|
-
description: `Open a
|
|
18
|
+
description: `Open a Zenrows Browser Sessions session and navigate to a URL.
|
|
19
19
|
|
|
20
20
|
This is the entry point for all browser automation. It creates a new session backed by
|
|
21
|
-
|
|
21
|
+
Zenrows' anti-bot infrastructure and navigates to the given URL in one step.
|
|
22
22
|
|
|
23
23
|
Returns a session_id that must be passed to every subsequent browser_* tool call.
|
|
24
24
|
Always call browser_close when done to close the session and free resources.
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zenrows/mcp",
|
|
3
|
-
"version": "2.0
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "2.1.0",
|
|
4
|
+
"description": "Zenrows MCP server — Fetch and Browser Sessions for AI coding assistants",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
|
-
"zenrows-mcp": "
|
|
7
|
+
"zenrows-mcp": "dist/index.js"
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
10
|
"dist"
|
|
@@ -55,6 +55,6 @@
|
|
|
55
55
|
"license": "MIT",
|
|
56
56
|
"repository": {
|
|
57
57
|
"type": "git",
|
|
58
|
-
"url": "https://github.com/ZenRows/zenrows-mcp"
|
|
58
|
+
"url": "git+https://github.com/ZenRows/zenrows-mcp.git"
|
|
59
59
|
}
|
|
60
60
|
}
|