Skip to content

Commit 7655eee

Browse files
More params
1 parent f21dd6d commit 7655eee

File tree

2 files changed

+22
-11
lines changed

2 files changed

+22
-11
lines changed

README.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ npm start
4040

4141
### Running on Cursor
4242

43-
Configuring Cursor 🖥️
43+
Configuring Cursor
4444
Note: Requires Cursor version 0.45.6+
4545

4646
To configure WebScraping.AI MCP in Cursor:
@@ -86,19 +86,26 @@ Add this to your `claude_desktop_config.json`:
8686
- Required for all operations
8787
- Get your API key from [WebScraping.AI](https://webscraping.ai)
8888

89-
##### Concurrency Configuration
90-
89+
#### Optional Configuration
9190
- `WEBSCRAPING_AI_CONCURRENCY_LIMIT`: Maximum number of concurrent requests (default: `5`)
91+
- `WEBSCRAPING_AI_DEFAULT_PROXY_TYPE`: Type of proxy to use (default: `residential`)
92+
- `WEBSCRAPING_AI_DEFAULT_JS_RENDERING`: Enable/disable JavaScript rendering (default: `true`)
93+
- `WEBSCRAPING_AI_DEFAULT_TIMEOUT`: Maximum web page retrieval time in ms (default: `15000`, max: `30000`)
94+
- `WEBSCRAPING_AI_DEFAULT_JS_TIMEOUT`: Maximum JavaScript rendering time in ms (default: `2000`)
9295

9396
### Configuration Examples
9497

95-
For standard usage with custom concurrency setting:
96-
98+
For standard usage:
9799
```bash
98100
# Required
99101
export WEBSCRAPING_AI_API_KEY=your-api-key
100-
# Optional
101-
export WEBSCRAPING_AI_CONCURRENCY_LIMIT=10 # Increase concurrency limit
102+
103+
# Optional - customize behavior (default values)
104+
export WEBSCRAPING_AI_CONCURRENCY_LIMIT=5
105+
export WEBSCRAPING_AI_DEFAULT_PROXY_TYPE=residential # datacenter or residential
106+
export WEBSCRAPING_AI_DEFAULT_JS_RENDERING=true
107+
export WEBSCRAPING_AI_DEFAULT_TIMEOUT=15000
108+
export WEBSCRAPING_AI_DEFAULT_JS_TIMEOUT=2000
102109
```
103110

104111
## Available Tools

src/index.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ dotenv.config();
1313
const WEBSCRAPING_AI_API_KEY = process.env.WEBSCRAPING_AI_API_KEY || '';
1414
const WEBSCRAPING_AI_API_URL = 'https://api.webscraping.ai';
1515
const CONCURRENCY_LIMIT = Number(process.env.WEBSCRAPING_AI_CONCURRENCY_LIMIT || 5);
16+
const DEFAULT_PROXY_TYPE = process.env.WEBSCRAPING_AI_DEFAULT_PROXY_TYPE || 'residential';
17+
const DEFAULT_JS_RENDERING = process.env.WEBSCRAPING_AI_DEFAULT_JS_RENDERING !== 'false';
18+
const DEFAULT_TIMEOUT = Number(process.env.WEBSCRAPING_AI_DEFAULT_TIMEOUT || 15000);
19+
const DEFAULT_JS_TIMEOUT = Number(process.env.WEBSCRAPING_AI_DEFAULT_JS_TIMEOUT || 2000);
1620

1721
// Validate required environment variables
1822
if (!WEBSCRAPING_AI_API_KEY) {
@@ -129,11 +133,11 @@ const server = new McpServer({
129133

130134
// Common options schema for all tools
131135
const commonOptionsSchema = {
132-
timeout: z.number().optional().default(15000).describe('Maximum web page retrieval time in ms (15000 by default, maximum is 30000).'),
133-
js: z.boolean().optional().default(true).describe('Execute on-page JavaScript using a headless browser (true by default).'),
134-
js_timeout: z.number().optional().default(2000).describe('Maximum JavaScript rendering time in ms (2000 by default).'),
136+
timeout: z.number().optional().default(DEFAULT_TIMEOUT).describe(`Maximum web page retrieval time in ms (${DEFAULT_TIMEOUT} by default, maximum is 30000).`),
137+
js: z.boolean().optional().default(DEFAULT_JS_RENDERING).describe(`Execute on-page JavaScript using a headless browser (${DEFAULT_JS_RENDERING} by default).`),
138+
js_timeout: z.number().optional().default(DEFAULT_JS_TIMEOUT).describe(`Maximum JavaScript rendering time in ms (${DEFAULT_JS_TIMEOUT} by default).`),
135139
wait_for: z.string().optional().describe('CSS selector to wait for before returning the page content.'),
136-
proxy: z.enum(['datacenter', 'residential']).optional().default('residential').describe('Type of proxy, datacenter or residential (residential by default).'),
140+
proxy: z.enum(['datacenter', 'residential']).optional().default(DEFAULT_PROXY_TYPE).describe(`Type of proxy, datacenter or residential (${DEFAULT_PROXY_TYPE} by default).`),
137141
country: z.enum(['us', 'gb', 'de', 'it', 'fr', 'ca', 'es', 'ru', 'jp', 'kr', 'in']).optional().describe('Country of the proxy to use (US by default).'),
138142
custom_proxy: z.string().optional().describe('Your own proxy URL in "http://user:password@host:port" format.'),
139143
device: z.enum(['desktop', 'mobile', 'tablet']).optional().describe('Type of device emulation.'),

0 commit comments

Comments
 (0)