scraperapi-mcp-server 1.0.0__tar.gz → 1.1.0__tar.gz

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 (30) hide show
  1. scraperapi_mcp_server-1.1.0/PKG-INFO +721 -0
  2. scraperapi_mcp_server-1.1.0/README.md +700 -0
  3. {scraperapi_mcp_server-1.0.0 → scraperapi_mcp_server-1.1.0}/pyproject.toml +3 -2
  4. {scraperapi_mcp_server-1.0.0 → scraperapi_mcp_server-1.1.0}/src/scraperapi_mcp_server/__init__.py +6 -1
  5. scraperapi_mcp_server-1.1.0/src/scraperapi_mcp_server/aiparser/aiparser.py +251 -0
  6. scraperapi_mcp_server-1.1.0/src/scraperapi_mcp_server/aiparser/models.py +194 -0
  7. {scraperapi_mcp_server-1.0.0 → scraperapi_mcp_server-1.1.0}/src/scraperapi_mcp_server/config.py +5 -2
  8. scraperapi_mcp_server-1.1.0/src/scraperapi_mcp_server/crawler/crawler.py +139 -0
  9. scraperapi_mcp_server-1.1.0/src/scraperapi_mcp_server/crawler/models.py +165 -0
  10. scraperapi_mcp_server-1.1.0/src/scraperapi_mcp_server/execution.py +78 -0
  11. {scraperapi_mcp_server-1.0.0 → scraperapi_mcp_server-1.1.0}/src/scraperapi_mcp_server/scrape/models.py +13 -8
  12. scraperapi_mcp_server-1.1.0/src/scraperapi_mcp_server/scrape/scrape.py +197 -0
  13. scraperapi_mcp_server-1.1.0/src/scraperapi_mcp_server/sdes/amazon.py +230 -0
  14. scraperapi_mcp_server-1.1.0/src/scraperapi_mcp_server/sdes/base.py +106 -0
  15. scraperapi_mcp_server-1.1.0/src/scraperapi_mcp_server/sdes/ebay.py +142 -0
  16. scraperapi_mcp_server-1.1.0/src/scraperapi_mcp_server/sdes/google.py +334 -0
  17. scraperapi_mcp_server-1.1.0/src/scraperapi_mcp_server/sdes/redfin.py +162 -0
  18. scraperapi_mcp_server-1.1.0/src/scraperapi_mcp_server/sdes/walmart.py +196 -0
  19. scraperapi_mcp_server-1.1.0/src/scraperapi_mcp_server/server.py +21 -0
  20. scraperapi_mcp_server-1.1.0/src/scraperapi_mcp_server/utils/exceptions.py +8 -0
  21. scraperapi_mcp_server-1.1.0/src/scraperapi_mcp_server/utils/http.py +113 -0
  22. scraperapi_mcp_server-1.0.0/PKG-INFO +0 -262
  23. scraperapi_mcp_server-1.0.0/README.md +0 -243
  24. scraperapi_mcp_server-1.0.0/src/scraperapi_mcp_server/scrape/scrape.py +0 -113
  25. scraperapi_mcp_server-1.0.0/src/scraperapi_mcp_server/server.py +0 -80
  26. {scraperapi_mcp_server-1.0.0 → scraperapi_mcp_server-1.1.0}/LICENSE +0 -0
  27. {scraperapi_mcp_server-1.0.0 → scraperapi_mcp_server-1.1.0}/src/scraperapi_mcp_server/__main__.py +0 -0
  28. {scraperapi_mcp_server-1.0.0 → scraperapi_mcp_server-1.1.0}/src/scraperapi_mcp_server/utils/country_codes.py +0 -0
  29. {scraperapi_mcp_server-1.0.0 → scraperapi_mcp_server-1.1.0}/src/scraperapi_mcp_server/utils/image_detection.py +0 -0
  30. {scraperapi_mcp_server-1.0.0 → scraperapi_mcp_server-1.1.0}/src/scraperapi_mcp_server/utils/rate_limiter.py +0 -0
@@ -0,0 +1,721 @@
1
+ Metadata-Version: 2.3
2
+ Name: scraperapi-mcp-server
3
+ Version: 1.1.0
4
+ Summary: ScraperAPI MCP server
5
+ License: MIT
6
+ Keywords: http,mcp,llm,automation,scraping
7
+ Author: ScraperAPI
8
+ Requires-Python: >=3.11
9
+ Classifier: Development Status :: 5 - Production/Stable
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Requires-Dist: httpx (>=0.28.1,<0.29.0)
16
+ Requires-Dist: mcp[cli] (>=1.28.0,<2.0.0)
17
+ Requires-Dist: pydantic (>=2.12.5,<3.0.0)
18
+ Requires-Dist: pydantic-settings (>=2.13.1,<3.0.0)
19
+ Requires-Dist: python-dotenv (>=1.2.2,<2.0.0)
20
+ Description-Content-Type: text/markdown
21
+
22
+ # ScraperAPI MCP server
23
+
24
+ The ScraperAPI MCP server enables LLM clients to retrieve and process web scraping requests using the ScraperAPI services.
25
+
26
+ This is the self-hosted (local) server. A [hosted (remote) version](https://docs.scraperapi.com/integrations/llm-integrations/mcp-server/hosted-remote) is also available.
27
+
28
+ <div align="center">
29
+
30
+ [![pypi package](https://img.shields.io/pypi/v/scraperapi-mcp-server?color=%2334D058&label=pypi%20package)](https://pypi.org/project/scraperapi-mcp-server/)
31
+ [![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
32
+
33
+ <br/>
34
+
35
+ [![scraperapi-mcp-server MCP server](https://glama.ai/mcp/servers/scraperapi/scraperapi-mcp/badges/card.svg)](https://glama.ai/mcp/servers/scraperapi/scraperapi-mcp)
36
+
37
+ </div>
38
+
39
+ ## Table of Contents
40
+
41
+ - [Features](#features)
42
+ - [Architecture](#architecture)
43
+ - [Installation](#installation)
44
+ - [API Reference](#api-reference)
45
+ - [Configuration](#configuration)
46
+ - [Settings](#settings)
47
+ - [Client Setup](#client-setup)
48
+ - [Development](#development)
49
+
50
+ ## Features
51
+
52
+ - Full implementation of the Model Context Protocol specification
53
+ - Seamless integration with ScraperAPI for web scraping
54
+ - Simple setup with Python or Docker
55
+
56
+ ## Architecture
57
+
58
+ ```
59
+ ┌───────────────┐ ┌───────────────────────┐ ┌───────────────┐
60
+ │ LLM Client │────▶│ Scraper MCP Server │────▶│ AI Model │
61
+ └───────────────┘ └───────────────────────┘ └───────────────┘
62
+ │
63
+ ▼
64
+ ┌──────────────────┐
65
+ │ ScraperAPI API │
66
+ └──────────────────┘
67
+ ```
68
+
69
+ ## Installation
70
+
71
+ The ScraperAPI MCP Server is designed to run as a local server on your machine, your LLM client will launch it automatically when configured.
72
+
73
+ ### Prerequisites
74
+ - Python 3.11+
75
+ - Docker (optional)
76
+
77
+ ### Using Python
78
+
79
+ Install the package:
80
+ ```bash
81
+ pip install scraperapi-mcp-server
82
+ ```
83
+
84
+ Add this to your client configuration file:
85
+
86
+ ```json
87
+ {
88
+ "mcpServers": {
89
+ "ScraperAPI": {
90
+ "command": "python",
91
+ "args": ["-m", "scraperapi_mcp_server"],
92
+ "env": {
93
+ "API_KEY": "<YOUR_SCRAPERAPI_API_KEY>"
94
+ }
95
+ }
96
+ }
97
+ }
98
+ ```
99
+
100
+ ### Using Docker
101
+
102
+ Add this to your client configuration file:
103
+
104
+ ```json
105
+ {
106
+ "mcpServers": {
107
+ "ScraperAPI": {
108
+ "command": "docker",
109
+ "args": [
110
+ "run",
111
+ "-i",
112
+ "-e",
113
+ "API_KEY=${API_KEY}",
114
+ "--rm",
115
+ "scraperapi-mcp-server"]
116
+ }
117
+ }
118
+ }
119
+ ```
120
+
121
+ </br>
122
+
123
+ > [!TIP]
124
+ >
125
+ > If your command is not working (for example, you see a `package not found` error when trying to start the server), double-check the path you are using. To find the correct path, activate your virtual environment first, then run:
126
+ > ```bash
127
+ > which <YOUR_COMMAND>
128
+ > ```
129
+
130
+ ## Available tools
131
+
132
+ ### API
133
+
134
+ Structured Data Endpoints (SDEs) return pre-parsed JSON (or CSV) instead of raw HTML. Every SDE tool also accepts `output_format` (`json` by default, or `csv`), `tld`, and `country_code`, shown in each tool's table.
135
+
136
+ <details>
137
+ <summary><strong>scrape</strong> — Scrape any web page or image, bypassing anti-bot protection</summary>
138
+
139
+ Retrieve the content of a web page, or download an image, from a URL.
140
+
141
+ | Parameter | Type | Description | Required |
142
+ |-----------|------|-------------|----------|
143
+ | `url` | string | Target URL to scrape | Yes |
144
+ | `render` | boolean | Enable JavaScript rendering for dynamic pages (default: `false`) | No |
145
+ | `country_code` | string | ISO 2-letter country code for geo-targeting | No |
146
+ | `premium` | boolean | Use premium residential/mobile proxies (default: `false`) | No |
147
+ | `ultra_premium` | boolean | Advanced anti-bot bypass; incompatible with `premium` (default: `false`) | No |
148
+ | `device_type` | string | `mobile` or `desktop` user agent | No |
149
+ | `output_format` | string | `markdown` (default), `text`, `csv`, or `json` | No |
150
+ | `autoparse` | boolean | Auto-parse supported sites into structured data (default: `false`) | No |
151
+
152
+ Returns: the scraped content as a string, or image data for image URLs.
153
+
154
+ </details>
155
+
156
+ ### SDEs
157
+
158
+ #### Google
159
+
160
+ <details>
161
+ <summary><strong>google_search</strong> — Parsed Google Search (SERP) results</summary>
162
+
163
+ | Parameter | Type | Description | Required |
164
+ |-----------|------|-------------|----------|
165
+ | `query` | string | Search query, as typed into Google | Yes |
166
+ | `num` | integer | Number of results to return on the page | No |
167
+ | `start` | integer | Zero-based result offset for pagination | No |
168
+ | `hl` | string | Interface/host language code (e.g. `en`, `es`) | No |
169
+ | `gl` | string | Country edition to search (2-letter code) | No |
170
+ | `uule` | string | Google `uule` geolocation string (advanced) | No |
171
+ | `date_range_start` | string | Start of a custom date range, `MM/DD/YYYY` | No |
172
+ | `date_range_end` | string | End of a custom date range, `MM/DD/YYYY` | No |
173
+ | `time_period` | string | Recent window: `1H`, `1D`, `1W`, `1M`, or `1Y` | No |
174
+ | `include_html` | boolean | Include raw HTML alongside parsed data (default: `false`) | No |
175
+ | `tbs` | string | Raw Google `tbs` filter parameter (advanced) | No |
176
+ | `output_format` | string | `json` (default) or `csv` | No |
177
+ | `tld` | string | Top-level domain (e.g. `com`, `co.uk`) | No |
178
+ | `country_code` | string | ISO 2-letter country code for geo-targeting | No |
179
+
180
+ </details>
181
+
182
+ <details>
183
+ <summary><strong>google_news</strong> — Parsed Google News results</summary>
184
+
185
+ | Parameter | Type | Description | Required |
186
+ |-----------|------|-------------|----------|
187
+ | `query` | string | Search query | Yes |
188
+ | `num` | integer | Number of results to return on the page | No |
189
+ | `start` | integer | Zero-based result offset for pagination | No |
190
+ | `hl` | string | Interface/host language code | No |
191
+ | `gl` | string | Country edition to search (2-letter code) | No |
192
+ | `uule` | string | Google `uule` geolocation string (advanced) | No |
193
+ | `date_range_start` | string | Start of a custom date range, `MM/DD/YYYY` | No |
194
+ | `date_range_end` | string | End of a custom date range, `MM/DD/YYYY` | No |
195
+ | `time_period` | string | Recent window: `1H`, `1D`, `1W`, `1M`, or `1Y` | No |
196
+ | `output_format` | string | `json` (default) or `csv` | No |
197
+ | `tld` | string | Top-level domain (e.g. `com`, `co.uk`) | No |
198
+ | `country_code` | string | ISO 2-letter country code for geo-targeting | No |
199
+
200
+ </details>
201
+
202
+ <details>
203
+ <summary><strong>google_jobs</strong> — Parsed Google Jobs listings</summary>
204
+
205
+ | Parameter | Type | Description | Required |
206
+ |-----------|------|-------------|----------|
207
+ | `query` | string | Search query | Yes |
208
+ | `num` | integer | Number of results to return on the page | No |
209
+ | `start` | integer | Zero-based result offset for pagination | No |
210
+ | `hl` | string | Interface/host language code | No |
211
+ | `gl` | string | Country edition to search (2-letter code) | No |
212
+ | `uule` | string | Google `uule` geolocation string (advanced) | No |
213
+ | `output_format` | string | `json` (default) or `csv` | No |
214
+ | `tld` | string | Top-level domain (e.g. `com`, `co.uk`) | No |
215
+ | `country_code` | string | ISO 2-letter country code for geo-targeting | No |
216
+
217
+ </details>
218
+
219
+ <details>
220
+ <summary><strong>google_shopping</strong> — Parsed Google Shopping product results</summary>
221
+
222
+ | Parameter | Type | Description | Required |
223
+ |-----------|------|-------------|----------|
224
+ | `query` | string | Search query | Yes |
225
+ | `num` | integer | Number of results to return on the page | No |
226
+ | `start` | integer | Zero-based result offset for pagination | No |
227
+ | `hl` | string | Interface/host language code | No |
228
+ | `gl` | string | Country edition to search (2-letter code) | No |
229
+ | `uule` | string | Google `uule` geolocation string (advanced) | No |
230
+ | `include_html` | boolean | Include raw HTML alongside parsed data (default: `false`) | No |
231
+ | `output_format` | string | `json` (default) or `csv` | No |
232
+ | `tld` | string | Top-level domain (e.g. `com`, `co.uk`) | No |
233
+ | `country_code` | string | ISO 2-letter country code for geo-targeting | No |
234
+
235
+ </details>
236
+
237
+ <details>
238
+ <summary><strong>google_maps_search</strong> — Parsed Google Maps place/business results</summary>
239
+
240
+ | Parameter | Type | Description | Required |
241
+ |-----------|------|-------------|----------|
242
+ | `query` | string | Search query (e.g. `coffee shops in Austin`) | Yes |
243
+ | `latitude` | number | Latitude of the map center, in decimal degrees | Yes |
244
+ | `longitude` | number | Longitude of the map center, in decimal degrees | Yes |
245
+ | `zoom` | integer | Map zoom level (roughly 3=country, 10=city, 15=street) | No |
246
+ | `include_html` | boolean | Include raw HTML alongside parsed data (default: `false`) | No |
247
+ | `output_format` | string | `json` (default) or `csv` | No |
248
+ | `tld` | string | Top-level domain (e.g. `com`, `co.uk`) | No |
249
+ | `country_code` | string | ISO 2-letter country code for geo-targeting | No |
250
+
251
+ </details>
252
+
253
+ #### Amazon
254
+
255
+ <details>
256
+ <summary><strong>amazon_product</strong> — Parsed Amazon product details by ASIN</summary>
257
+
258
+ | Parameter | Type | Description | Required |
259
+ |-----------|------|-------------|----------|
260
+ | `asin` | string | 10-character Amazon product identifier (e.g. `B08N5WRWNW`) | Yes |
261
+ | `language` | string | Language code for localized content (e.g. `en_US`) | No |
262
+ | `include_html` | boolean | Include raw HTML alongside parsed data (default: `false`) | No |
263
+ | `output_format` | string | `json` (default) or `csv` | No |
264
+ | `tld` | string | Amazon TLD (e.g. `com`, `co.uk`, `de`) | No |
265
+ | `country_code` | string | ISO 2-letter country code for geo-targeting | No |
266
+
267
+ </details>
268
+
269
+ <details>
270
+ <summary><strong>amazon_search</strong> — Parsed Amazon product search results</summary>
271
+
272
+ | Parameter | Type | Description | Required |
273
+ |-----------|------|-------------|----------|
274
+ | `query` | string | Search query, as typed into Amazon | Yes |
275
+ | `page` | integer | 1-based results page number | No |
276
+ | `sort_by` | string | Sort order (e.g. `price-asc-rank`, `review-rank`) | No |
277
+ | `department` | string | Restrict search to a department/category (e.g. `electronics`) | No |
278
+ | `ref` | string | Amazon `ref` referral/context token (advanced) | No |
279
+ | `language` | string | Language code for localized content | No |
280
+ | `output_format` | string | `json` (default) or `csv` | No |
281
+ | `tld` | string | Amazon TLD (e.g. `com`, `co.uk`, `de`) | No |
282
+ | `country_code` | string | ISO 2-letter country code for geo-targeting | No |
283
+
284
+ </details>
285
+
286
+ <details>
287
+ <summary><strong>amazon_offers</strong> — Parsed seller offers for an Amazon product</summary>
288
+
289
+ | Parameter | Type | Description | Required |
290
+ |-----------|------|-------------|----------|
291
+ | `asin` | string | 10-character Amazon product identifier | Yes |
292
+ | `condition` | string | Comma-separated condition filters (e.g. `f_new,f_usedlikenew,f_usedverygood,f_usedgood,f_usedacceptable`) | No |
293
+ | `f_new` | boolean | Include only New-condition offers | No |
294
+ | `f_used_like_new` | boolean | Include Used - Like New offers | No |
295
+ | `f_used_very_good` | boolean | Include Used - Very Good offers | No |
296
+ | `f_used_good` | boolean | Include Used - Good offers | No |
297
+ | `f_used_acceptable` | boolean | Include Used - Acceptable offers | No |
298
+ | `language` | string | Language code for localized content | No |
299
+ | `output_format` | string | `json` (default) or `csv` | No |
300
+ | `tld` | string | Amazon TLD (e.g. `com`, `co.uk`, `de`) | No |
301
+ | `country_code` | string | ISO 2-letter country code for geo-targeting | No |
302
+
303
+ </details>
304
+
305
+ #### Walmart
306
+
307
+ <details>
308
+ <summary><strong>walmart_search</strong> — Parsed Walmart product search results</summary>
309
+
310
+ | Parameter | Type | Description | Required |
311
+ |-----------|------|-------------|----------|
312
+ | `query` | string | Product search query, as typed into Walmart | Yes |
313
+ | `page` | integer | 1-based results page number | No |
314
+ | `output_format` | string | `json` (default) or `csv` | No |
315
+ | `tld` | string | Walmart TLD (e.g. `com`, `ca`, `com.mx`) | No |
316
+ | `country_code` | string | ISO 2-letter country code for geo-targeting | No |
317
+
318
+ </details>
319
+
320
+ <details>
321
+ <summary><strong>walmart_product</strong> — Parsed Walmart product details by product ID</summary>
322
+
323
+ | Parameter | Type | Description | Required |
324
+ |-----------|------|-------------|----------|
325
+ | `product_id` | string | Walmart product ID | Yes |
326
+ | `output_format` | string | `json` (default) or `csv` | No |
327
+ | `tld` | string | Walmart TLD (e.g. `com`, `ca`, `com.mx`) | No |
328
+ | `country_code` | string | ISO 2-letter country code for geo-targeting | No |
329
+
330
+ </details>
331
+
332
+ <details>
333
+ <summary><strong>walmart_category</strong> — Parsed products within a Walmart category</summary>
334
+
335
+ | Parameter | Type | Description | Required |
336
+ |-----------|------|-------------|----------|
337
+ | `category` | string | Walmart category ID | Yes |
338
+ | `page` | integer | 1-based results page number | No |
339
+ | `output_format` | string | `json` (default) or `csv` | No |
340
+ | `tld` | string | Walmart TLD (e.g. `com`, `ca`, `com.mx`) | No |
341
+ | `country_code` | string | ISO 2-letter country code for geo-targeting | No |
342
+
343
+ </details>
344
+
345
+ <details>
346
+ <summary><strong>walmart_review</strong> — Parsed customer reviews for a Walmart product</summary>
347
+
348
+ | Parameter | Type | Description | Required |
349
+ |-----------|------|-------------|----------|
350
+ | `product_id` | string | Walmart product ID | Yes |
351
+ | `page` | integer | 1-based results page number | No |
352
+ | `sort` | string | Sort order (e.g. `helpful`, `recent`) | No |
353
+ | `ratings` | string | Comma-separated star ratings to filter by (e.g. `4,5`) | No |
354
+ | `verified_purchase` | boolean | Include only reviews with a "Verified Purchase" badge (default: `false`) | No |
355
+ | `output_format` | string | `json` (default) or `csv` | No |
356
+ | `tld` | string | Walmart TLD (e.g. `com`, `ca`, `com.mx`) | No |
357
+ | `country_code` | string | ISO 2-letter country code for geo-targeting | No |
358
+
359
+ </details>
360
+
361
+ #### eBay
362
+
363
+ <details>
364
+ <summary><strong>ebay_search</strong> — Parsed eBay product search results</summary>
365
+
366
+ | Parameter | Type | Description | Required |
367
+ |-----------|------|-------------|----------|
368
+ | `query` | string | Search keywords | Yes |
369
+ | `page` | integer | 1-based results page number | No |
370
+ | `items_per_page` | integer | Number of items per page | No |
371
+ | `seller_id` | string | Restrict results to a specific seller | No |
372
+ | `condition` | string | Comma-separated: `new`, `used`, `open_box`, `refurbished`, `for_parts`, `not_working` | No |
373
+ | `buying_format` | string | `buy_it_now`, `auction`, or `accepts_offers` | No |
374
+ | `show_only` | string | Comma-separated: `returns_accepted`, `authorized_seller`, `completed_items`, `sold_items`, `sale_items`, `listed_as_lots`, `search_in_description`, `benefits_charity`, `authenticity_guarantee` | No |
375
+ | `sort_by` | string | `best_match`, `ending_soonest`, `newly_listed`, `price_lowest`, `price_highest`, or `distance_nearest` | No |
376
+ | `output_format` | string | `json` (default) or `csv` | No |
377
+ | `tld` | string | eBay TLD (e.g. `com`, `co.uk`, `de`) | No |
378
+ | `country_code` | string | ISO 2-letter country code for geo-targeting | No |
379
+
380
+ </details>
381
+
382
+ <details>
383
+ <summary><strong>ebay_product</strong> — Parsed eBay listing details by item ID</summary>
384
+
385
+ | Parameter | Type | Description | Required |
386
+ |-----------|------|-------------|----------|
387
+ | `product_id` | string | eBay item ID | Yes |
388
+ | `output_format` | string | `json` (default) or `csv` | No |
389
+ | `tld` | string | eBay TLD (e.g. `com`, `co.uk`, `de`) | No |
390
+ | `country_code` | string | ISO 2-letter country code for geo-targeting | No |
391
+
392
+ </details>
393
+
394
+ #### Redfin
395
+
396
+ Every Redfin tool takes a full Redfin URL matching the tool (property, search, or agent page).
397
+
398
+ <details>
399
+ <summary><strong>redfin_for_sale</strong> — Parsed Redfin listing data for a home for sale</summary>
400
+
401
+ | Parameter | Type | Description | Required |
402
+ |-----------|------|-------------|----------|
403
+ | `url` | string | Full Redfin for-sale property URL | Yes |
404
+ | `raw` | boolean | Return raw extracted JSON instead of parsed data (default: `false`) | No |
405
+ | `output_format` | string | `json` (default) or `csv` | No |
406
+ | `tld` | string | Redfin TLD (`com`, `ca`) | No |
407
+ | `country_code` | string | ISO 2-letter country code for geo-targeting | No |
408
+
409
+ </details>
410
+
411
+ <details>
412
+ <summary><strong>redfin_for_rent</strong> — Parsed Redfin listing data for a rental property</summary>
413
+
414
+ | Parameter | Type | Description | Required |
415
+ |-----------|------|-------------|----------|
416
+ | `url` | string | Full Redfin rental property URL | Yes |
417
+ | `raw` | boolean | Return raw extracted JSON instead of parsed data (default: `false`) | No |
418
+ | `output_format` | string | `json` (default) or `csv` | No |
419
+ | `tld` | string | Redfin TLD (`com`, `ca`) | No |
420
+ | `country_code` | string | ISO 2-letter country code for geo-targeting | No |
421
+
422
+ </details>
423
+
424
+ <details>
425
+ <summary><strong>redfin_search</strong> — Parsed Redfin search results</summary>
426
+
427
+ | Parameter | Type | Description | Required |
428
+ |-----------|------|-------------|----------|
429
+ | `url` | string | Full Redfin search-results URL (with filters) | Yes |
430
+ | `output_format` | string | `json` (default) or `csv` | No |
431
+ | `tld` | string | Redfin TLD (`com`, `ca`) | No |
432
+ | `country_code` | string | ISO 2-letter country code for geo-targeting | No |
433
+
434
+ </details>
435
+
436
+ <details>
437
+ <summary><strong>redfin_agent</strong> — Parsed Redfin real-estate agent profile data</summary>
438
+
439
+ | Parameter | Type | Description | Required |
440
+ |-----------|------|-------------|----------|
441
+ | `url` | string | Full Redfin agent profile URL | Yes |
442
+ | `output_format` | string | `json` (default) or `csv` | No |
443
+ | `tld` | string | Redfin TLD (`com`, `ca`) | No |
444
+ | `country_code` | string | ISO 2-letter country code for geo-targeting | No |
445
+
446
+ </details>
447
+
448
+ ### Crawler
449
+
450
+ The crawler is asynchronous: `crawler_job_start` returns a job id immediately, then you poll `crawler_job_status` until the crawl finishes. Per-page results can also be pushed to a `callback_url` webhook.
451
+
452
+ <details>
453
+ <summary><strong>crawler_job_start</strong> — Start an async crawl job from a starting URL</summary>
454
+
455
+ | Parameter | Type | Description | Required |
456
+ |-----------|------|-------------|----------|
457
+ | `start_url` | string | The URL where crawling begins (depth 0) | Yes |
458
+ | `url_regexp_include` | string | Regex selecting which links to follow. Use `.*` to crawl all links. Advanced: named groups `(?<full_url>...)` / `(?<relative_url>...)` target absolute vs relative URLs | Yes |
459
+ | `max_depth` | integer | Maximum crawl depth (start URL is depth 0). Provide `max_depth` or `crawl_budget` | No* |
460
+ | `crawl_budget` | integer | Maximum ScraperAPI credits the crawl may consume. Provide `max_depth` or `crawl_budget` | No* |
461
+ | `url_regexp_exclude` | string | Regex for URLs to exclude from crawling | No |
462
+ | `api_params` | object | Per-scrape controls applied to each page (e.g. `render`, `country_code`, `premium`, `device_type`, `output_format`) | No |
463
+ | `callback_url` | string | Webhook URL to receive per-page results and the final summary | No |
464
+ | `additional_data` | object | Arbitrary metadata to attach to the job | No |
465
+ | `schedule` | object | Recurring schedule: `{ name, interval (once/hourly/daily/weekly/monthly), cron }` | No |
466
+ | `enabled` | boolean | For scheduled projects, whether the schedule is enabled (default: `true`) | No |
467
+
468
+ \* Provide either `max_depth` or `crawl_budget`.
469
+
470
+ Returns: JSON with the job id and initial status (e.g. `{"status": "initiated", "jobId": "..."}`).
471
+
472
+ </details>
473
+
474
+ <details>
475
+ <summary><strong>crawler_job_status</strong> — Get the status of a crawl job</summary>
476
+
477
+ | Parameter | Type | Description | Required |
478
+ |-----------|------|-------------|----------|
479
+ | `job_id` | string | The job id returned by `crawler_job_start` | Yes |
480
+
481
+ Returns: JSON with the job's page counts (done/failed/active).
482
+
483
+ </details>
484
+
485
+ <details>
486
+ <summary><strong>crawler_job_delete</strong> — Cancel and delete a crawl job</summary>
487
+
488
+ | Parameter | Type | Description | Required |
489
+ |-----------|------|-------------|----------|
490
+ | `job_id` | string | The job id returned by `crawler_job_start` | Yes |
491
+
492
+ </details>
493
+
494
+ ### AI Parser
495
+
496
+ Build a reusable parser from a few example URLs, then apply it to any similar page for structured extraction. Two-phase: `ai_parser_create` returns a parser id immediately and generation runs in the background — poll `ai_parser_get_details` until its `status` is `FINISHED`, then call `ai_parser_parse_url`.
497
+
498
+ <details>
499
+ <summary><strong>ai_parser_create</strong> — Create a reusable AI parser from example URLs</summary>
500
+
501
+ | Parameter | Type | Description | Required |
502
+ |-----------|------|-------------|----------|
503
+ | `name` | string | A name for the parser | Yes |
504
+ | `urls` | array&lt;string&gt; | 1–3 example URLs of the same page type (same structure) | Yes |
505
+ | `scraper_params` | object | ScraperAPI fetch options for the example pages: `render`, `country_code`, `premium`, `session_number`, `keep_headers`, `device_type`, `ultra_premium`, `follow_redirect`, `retry_404` | No |
506
+ | `fields` | array | Pre-declared fields to extract: `[{ name, description, type?, selector? }]` (`type` is `string`/`number`/`array`). If omitted, fields are inferred | No |
507
+
508
+ Returns: JSON with the new parser's `id` and `version`. Generation is asynchronous — poll `ai_parser_get_details` until `status` is `FINISHED`.
509
+
510
+ </details>
511
+
512
+ <details>
513
+ <summary><strong>ai_parser_get_details</strong> — Get a parser's details and generation status</summary>
514
+
515
+ | Parameter | Type | Description | Required |
516
+ |-----------|------|-------------|----------|
517
+ | `parser_id` | string | The parser id returned by `ai_parser_create` | Yes |
518
+ | `version` | integer | Specific parser version (default: latest) | No |
519
+
520
+ Returns: JSON with the parser's `status` (`GENERATING`/`FINISHED`/`FAILED`), fields, and example results.
521
+
522
+ </details>
523
+
524
+ <details>
525
+ <summary><strong>ai_parser_parse_url</strong> — Parse a URL with an existing parser</summary>
526
+
527
+ | Parameter | Type | Description | Required |
528
+ |-----------|------|-------------|----------|
529
+ | `parser_id` | string | The parser id to run | Yes |
530
+ | `url` | string | The URL to scrape and parse | Yes |
531
+ | `version` | integer | Specific parser version (default: latest) | No |
532
+
533
+ Returns: JSON `{"parser": ..., "version": ..., "result": {...}}`. Costs 1 credit per call.
534
+
535
+ </details>
536
+
537
+ <details>
538
+ <summary><strong>ai_parser_list</strong> — List the parsers on your account</summary>
539
+
540
+ No parameters. Returns a JSON array of parser summaries (id, name, status, version, generation time).
541
+
542
+ </details>
543
+
544
+ <details>
545
+ <summary><strong>ai_parser_delete</strong> — Delete a parser</summary>
546
+
547
+ | Parameter | Type | Description | Required |
548
+ |-----------|------|-------------|----------|
549
+ | `parser_id` | string | The parser id to delete | Yes |
550
+
551
+ </details>
552
+
553
+ <details>
554
+ <summary><strong>ai_parser_update</strong> — Edit a parser's fields (creates a new version)</summary>
555
+
556
+ | Parameter | Type | Description | Required |
557
+ |-----------|------|-------------|----------|
558
+ | `parser_id` | string | The parser id to update | Yes |
559
+ | `version` | integer | Version to base the update on (default: latest) | No |
560
+ | `add_fields` | array | Fields to add: `[{ name, description, type?, selector? }]` (triggers async regeneration) | No |
561
+ | `modify_fields` | array | Fields to modify (triggers async regeneration) | No |
562
+ | `rename_fields` | array | Renames: `[{ name, new_name }]` (applied immediately) | No |
563
+ | `remove_fields` | array&lt;string&gt; | Field names to remove (applied immediately) | No |
564
+
565
+ </details>
566
+
567
+ ### Prompt templates
568
+
569
+ - Please scrape this URL `<URL>`. If you receive a 500 server error identify the website's geo-targeting and add the corresponding country_code to overcome geo-restrictions. If errors continues, upgrade the request to use premium proxies by adding premium=true. For persistent failures, activate ultra_premium=true to use enhanced anti-blocking measures.
570
+ - Can you scrape URL `<URL>` to extract `<SPECIFIC_DATA>`? If the request returns missing/incomplete`<SPECIFIC_DATA>`, set render=true to enable JS Rendering.
571
+
572
+ ## Configuration
573
+
574
+ ### Settings
575
+
576
+ Configure the server through environment variables. Only `API_KEY` is required.
577
+
578
+ | Variable | Default | Description |
579
+ |----------|---------|-------------|
580
+ | `API_KEY` | — | **Required.** Your ScraperAPI API key. |
581
+ | `API_URL` | `https://api.scraperapi.com` | Base URL for the ScraperAPI API and structured-data endpoints.
582
+ | `SCRAPER_SDK` | `mcp-server` | Client identifier sent to ScraperAPI on every request. |
583
+ | `API_TIMEOUT_SECONDS` | `70` | Per-request timeout, in seconds. |
584
+ | `RATE_LIMIT_MAX_CALLS` | `10` | Maximum tool calls allowed per rate-limit window. |
585
+ | `RATE_LIMIT_WINDOW_SECONDS` | `60` | Length of the rate-limit window, in seconds. |
586
+ | `IMAGE_SIZE_LIMIT_BYTES` | `700000` | Maximum size of an image the `scrape` tool returns inline. |
587
+
588
+ ### Client Setup
589
+
590
+ Use [the JSON configuration file](#installation) from the Installation section. Below are steps for common clients.
591
+
592
+ <details>
593
+ <summary><strong>Claude Desktop & Claude Code</strong></summary>
594
+
595
+ **Claude Desktop:**
596
+ 1. Open Claude Desktop and click the settings icon
597
+ 2. Select the "Developer" tab
598
+ 3. Click "Edit Config" and paste [the JSON configuration file](#installation)
599
+
600
+ **Claude Code:**
601
+ 1. Add the server manually to your `.claude/settings.json` with [the JSON configuration file](#installation), or run:
602
+ ```bash
603
+ claude mcp add scraperapi -e API_KEY=<YOUR_SCRAPERAPI_API_KEY> -- python -m scraperapi_mcp_server
604
+ ```
605
+
606
+ </details>
607
+
608
+ <details>
609
+ <summary><strong>Cursor Editor</strong></summary>
610
+
611
+ 1. Open Cursor
612
+ 2. Access the Settings Menu
613
+ 3. Open Cursor Settings
614
+ 4. Go to Tools & Integrations section
615
+ 5. Click '+ Add MCP Server'
616
+ 6. Choose Manual and paste [the JSON configuration file](#installation)
617
+
618
+ More [here](https://cursor.com/docs/context/mcp#servers)
619
+
620
+ </details>
621
+
622
+ <details>
623
+ <summary><strong>Windsurf Editor</strong></summary>
624
+
625
+ 1. Open Windsurf
626
+ 2. Access the Settings Menu
627
+ 3. Click on the Cascade settings
628
+ 4. Click on the MCP server section
629
+ 5. Click on the gear icon, the `mcp_config.json` file will open
630
+ 6. Paste [the JSON configuration file](#installation)
631
+
632
+ More [here](https://docs.windsurf.com/windsurf/cascade/mcp#adding-a-new-mcp)
633
+
634
+ </details>
635
+
636
+ <details>
637
+ <summary><strong>Cline (VS Code extension)</strong></summary>
638
+
639
+ 1. Open VS Code and click the Cline icon in the activity bar to open the Cline panel
640
+ 2. Click the MCP Servers icon in the top navigation bar of the Cline pane
641
+ 3. Select the "Configure" tab
642
+ 4. Click "Configure MCP Servers" at the bottom of the pane — this opens `cline_mcp_settings.json`
643
+ 5. Paste [the JSON configuration file](#installation)
644
+
645
+ More [here](https://docs.cline.bot/mcp/adding-and-configuring-servers#editing-configuration-files)
646
+
647
+ </details>
648
+
649
+ ## Development
650
+
651
+ ### Local setup
652
+
653
+ 1. **Clone the repository:**
654
+ ```bash
655
+ git clone https://github.com/scraperapi/scraperapi-mcp
656
+ cd scraperapi-mcp
657
+ ```
658
+
659
+ 2. **Install dependencies:**
660
+ - **Using Poetry:**
661
+ ```bash
662
+ poetry install
663
+ ```
664
+ - **Using pip:**
665
+ ```bash
666
+ # Create virtual environment and activate it
667
+ python -m venv .venv
668
+ source .venv/bin/activate # MacOS/Linux
669
+ # OR
670
+ .venv/Scripts/activate # Windows
671
+
672
+ # Install the local package in editable mode
673
+ pip install -e .
674
+ ```
675
+ - **Using Docker:**
676
+ ```bash
677
+ # Build the Docker image locally
678
+ docker build -t scraperapi-mcp-server .
679
+ ```
680
+
681
+ ### Run the server
682
+ - **Using Python:**
683
+ ```bash
684
+ python -m scraperapi_mcp_server
685
+ ```
686
+ - **Using Docker:**
687
+ ```bash
688
+ # Run the Docker container with your API key
689
+ docker run -e API_KEY=<YOUR_SCRAPERAPI_API_KEY> scraperapi-mcp-server
690
+ ```
691
+
692
+ ### Debug
693
+
694
+ ```bash
695
+ python3 -m scraperapi_mcp_server --debug
696
+ ```
697
+
698
+ ### Testing
699
+
700
+ This project uses [pytest](https://docs.pytest.org/en/stable/) for testing.
701
+
702
+ #### Install Test Dependencies
703
+ - **Using Poetry:**
704
+ ```bash
705
+ poetry install --with dev
706
+ ```
707
+ - **Using pip:**
708
+ ```bash
709
+ pip install -e .
710
+ pip install pytest pytest-mock pytest-asyncio
711
+ ```
712
+
713
+ #### Running Tests
714
+
715
+ ```bash
716
+ # Run All Tests
717
+ pytest
718
+
719
+ # Run Specific Test
720
+ pytest <TEST_FILE_PATH>
721
+ ```