@zenrows/mcp 1.1.4 → 1.1.6

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 (2) hide show
  1. package/dist/server.js +61 -2
  2. package/package.json +1 -1
package/dist/server.js CHANGED
@@ -4,6 +4,9 @@ import { z } from "zod";
4
4
  const require = createRequire(import.meta.url);
5
5
  const pkg = require("../package.json");
6
6
  const ZENROWS_API_URL = "https://api.zenrows.com/v1/";
7
+ const DEFAULT_JS_RENDER = process.env.ZENROWS_JS_RENDER === "true";
8
+ const DEFAULT_PREMIUM_PROXY = process.env.ZENROWS_PREMIUM_PROXY === "true";
9
+ const DEFAULT_RESPONSE_TYPE = process.env.ZENROWS_RESPONSE_TYPE ?? "markdown";
7
10
  export function createServer(apiKey) {
8
11
  const server = new McpServer({
9
12
  name: "zenrows",
@@ -119,11 +122,12 @@ Examples:
119
122
  url: params.url,
120
123
  });
121
124
  if (params.js_render ||
125
+ DEFAULT_JS_RENDER ||
122
126
  params.screenshot ||
123
127
  params.screenshot_fullpage ||
124
128
  params.screenshot_selector)
125
129
  searchParams.set("js_render", "true");
126
- if (params.premium_proxy)
130
+ if (params.premium_proxy || DEFAULT_PREMIUM_PROXY)
127
131
  searchParams.set("premium_proxy", "true");
128
132
  if (params.proxy_country)
129
133
  searchParams.set("proxy_country", params.proxy_country.toUpperCase());
@@ -148,7 +152,7 @@ Examples:
148
152
  // response_type is mutually exclusive with autoparse, css_extractor, outputs, and screenshot params.
149
153
  // 'html' is the ZenRows default (no param); all other values are passed through.
150
154
  const isScreenshot = params.screenshot || params.screenshot_fullpage || params.screenshot_selector;
151
- const effectiveType = params.response_type ?? "markdown";
155
+ const effectiveType = params.response_type ?? DEFAULT_RESPONSE_TYPE;
152
156
  if (!params.autoparse &&
153
157
  !params.css_extractor &&
154
158
  !params.outputs &&
@@ -200,5 +204,60 @@ Examples:
200
204
  content: [{ type: "text", text: new TextDecoder().decode(buffer) }],
201
205
  };
202
206
  });
207
+ // ─── prompts ───────────────────────────────────────────────────────────────
208
+ server.registerPrompt("scrape_and_summarize", {
209
+ title: "Scrape and Summarize",
210
+ description: "Scrape a webpage and return a concise summary of its content.",
211
+ argsSchema: {
212
+ url: z.string().url().describe("The webpage URL to scrape and summarize"),
213
+ },
214
+ }, ({ url }) => ({
215
+ messages: [
216
+ {
217
+ role: "user",
218
+ content: {
219
+ type: "text",
220
+ 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.`,
221
+ },
222
+ },
223
+ ],
224
+ }));
225
+ server.registerPrompt("extract_structured_data", {
226
+ title: "Extract Structured Data",
227
+ description: "Scrape a webpage and extract specific structured data using CSS selectors.",
228
+ argsSchema: {
229
+ url: z.string().url().describe("The webpage URL to extract data from"),
230
+ fields: z
231
+ .string()
232
+ .describe('JSON object mapping field names to CSS selectors, e.g. \'{"title":"h1","price":".price"}\''),
233
+ },
234
+ }, ({ url, fields }) => ({
235
+ messages: [
236
+ {
237
+ role: "user",
238
+ content: {
239
+ type: "text",
240
+ text: `Scrape ${url} using the ZenRows MCP scrape tool with css_extractor set to ${fields}. Return the extracted data as a clean JSON object.`,
241
+ },
242
+ },
243
+ ],
244
+ }));
245
+ server.registerPrompt("scrape_js_page", {
246
+ title: "Scrape JavaScript-Rendered Page",
247
+ description: "Scrape a page that requires JavaScript rendering (React, Vue, Angular, or any SPA).",
248
+ argsSchema: {
249
+ url: z.string().url().describe("The JavaScript-rendered page URL to scrape"),
250
+ },
251
+ }, ({ url }) => ({
252
+ messages: [
253
+ {
254
+ role: "user",
255
+ content: {
256
+ type: "text",
257
+ 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.`,
258
+ },
259
+ },
260
+ ],
261
+ }));
203
262
  return server;
204
263
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zenrows/mcp",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
4
4
  "description": "ZenRows MCP server — Universal Scraper API for AI coding assistants",
5
5
  "type": "module",
6
6
  "bin": {