scraperapi-mcp-server 1.1.0__tar.gz → 1.2.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 (28) hide show
  1. {scraperapi_mcp_server-1.1.0 → scraperapi_mcp_server-1.2.0}/PKG-INFO +128 -17
  2. {scraperapi_mcp_server-1.1.0 → scraperapi_mcp_server-1.2.0}/README.md +127 -16
  3. {scraperapi_mcp_server-1.1.0 → scraperapi_mcp_server-1.2.0}/pyproject.toml +1 -1
  4. {scraperapi_mcp_server-1.1.0 → scraperapi_mcp_server-1.2.0}/src/scraperapi_mcp_server/__init__.py +0 -5
  5. {scraperapi_mcp_server-1.1.0 → scraperapi_mcp_server-1.2.0}/src/scraperapi_mcp_server/aiparser/aiparser.py +14 -7
  6. {scraperapi_mcp_server-1.1.0 → scraperapi_mcp_server-1.2.0}/src/scraperapi_mcp_server/aiparser/models.py +19 -4
  7. {scraperapi_mcp_server-1.1.0 → scraperapi_mcp_server-1.2.0}/src/scraperapi_mcp_server/config.py +1 -1
  8. {scraperapi_mcp_server-1.1.0 → scraperapi_mcp_server-1.2.0}/src/scraperapi_mcp_server/crawler/crawler.py +13 -4
  9. {scraperapi_mcp_server-1.1.0 → scraperapi_mcp_server-1.2.0}/src/scraperapi_mcp_server/execution.py +10 -6
  10. {scraperapi_mcp_server-1.1.0 → scraperapi_mcp_server-1.2.0}/src/scraperapi_mcp_server/scrape/scrape.py +10 -4
  11. scraperapi_mcp_server-1.2.0/src/scraperapi_mcp_server/sdes/ai.py +267 -0
  12. {scraperapi_mcp_server-1.1.0 → scraperapi_mcp_server-1.2.0}/src/scraperapi_mcp_server/sdes/base.py +35 -17
  13. {scraperapi_mcp_server-1.1.0 → scraperapi_mcp_server-1.2.0}/src/scraperapi_mcp_server/sdes/ebay.py +1 -1
  14. scraperapi_mcp_server-1.2.0/src/scraperapi_mcp_server/sdes/homedepot.py +290 -0
  15. {scraperapi_mcp_server-1.1.0 → scraperapi_mcp_server-1.2.0}/src/scraperapi_mcp_server/sdes/redfin.py +2 -1
  16. {scraperapi_mcp_server-1.1.0 → scraperapi_mcp_server-1.2.0}/src/scraperapi_mcp_server/sdes/walmart.py +1 -1
  17. {scraperapi_mcp_server-1.1.0 → scraperapi_mcp_server-1.2.0}/src/scraperapi_mcp_server/server.py +4 -0
  18. {scraperapi_mcp_server-1.1.0 → scraperapi_mcp_server-1.2.0}/src/scraperapi_mcp_server/utils/http.py +1 -1
  19. {scraperapi_mcp_server-1.1.0 → scraperapi_mcp_server-1.2.0}/LICENSE +0 -0
  20. {scraperapi_mcp_server-1.1.0 → scraperapi_mcp_server-1.2.0}/src/scraperapi_mcp_server/__main__.py +0 -0
  21. {scraperapi_mcp_server-1.1.0 → scraperapi_mcp_server-1.2.0}/src/scraperapi_mcp_server/crawler/models.py +0 -0
  22. {scraperapi_mcp_server-1.1.0 → scraperapi_mcp_server-1.2.0}/src/scraperapi_mcp_server/scrape/models.py +0 -0
  23. {scraperapi_mcp_server-1.1.0 → scraperapi_mcp_server-1.2.0}/src/scraperapi_mcp_server/sdes/amazon.py +0 -0
  24. {scraperapi_mcp_server-1.1.0 → scraperapi_mcp_server-1.2.0}/src/scraperapi_mcp_server/sdes/google.py +0 -0
  25. {scraperapi_mcp_server-1.1.0 → scraperapi_mcp_server-1.2.0}/src/scraperapi_mcp_server/utils/country_codes.py +0 -0
  26. {scraperapi_mcp_server-1.1.0 → scraperapi_mcp_server-1.2.0}/src/scraperapi_mcp_server/utils/exceptions.py +0 -0
  27. {scraperapi_mcp_server-1.1.0 → scraperapi_mcp_server-1.2.0}/src/scraperapi_mcp_server/utils/image_detection.py +0 -0
  28. {scraperapi_mcp_server-1.1.0 → scraperapi_mcp_server-1.2.0}/src/scraperapi_mcp_server/utils/rate_limiter.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: scraperapi-mcp-server
3
- Version: 1.1.0
3
+ Version: 1.2.0
4
4
  Summary: ScraperAPI MCP server
5
5
  License: MIT
6
6
  Keywords: http,mcp,llm,automation,scraping
@@ -41,7 +41,7 @@ This is the self-hosted (local) server. A [hosted (remote) version](https://docs
41
41
  - [Features](#features)
42
42
  - [Architecture](#architecture)
43
43
  - [Installation](#installation)
44
- - [API Reference](#api-reference)
44
+ - [Available tools](#available-tools)
45
45
  - [Configuration](#configuration)
46
46
  - [Settings](#settings)
47
47
  - [Client Setup](#client-setup)
@@ -97,7 +97,7 @@ Add this to your client configuration file:
97
97
  }
98
98
  ```
99
99
 
100
- ### Using Docker
100
+ ### Using Docker
101
101
 
102
102
  Add this to your client configuration file:
103
103
 
@@ -131,8 +131,6 @@ Add this to your client configuration file:
131
131
 
132
132
  ### API
133
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
134
  <details>
137
135
  <summary><strong>scrape</strong> — Scrape any web page or image, bypassing anti-bot protection</summary>
138
136
 
@@ -155,6 +153,8 @@ Returns: the scraped content as a string, or image data for image URLs.
155
153
 
156
154
  ### SDEs
157
155
 
156
+ Structured Data Endpoints (SDEs) return pre-parsed JSON (or CSV) instead of raw HTML. Every SDE tool except the Home Depot ones (JSON only) also accepts `output_format` (`json` by default, or `csv`). Most also accept `tld` and `country_code`. Each tool's table lists the parameters it takes.
157
+
158
158
  #### Google
159
159
 
160
160
  <details>
@@ -349,7 +349,7 @@ Returns: the scraped content as a string, or image data for image URLs.
349
349
  |-----------|------|-------------|----------|
350
350
  | `product_id` | string | Walmart product ID | Yes |
351
351
  | `page` | integer | 1-based results page number | No |
352
- | `sort` | string | Sort order (e.g. `helpful`, `recent`) | No |
352
+ | `sort` | string | Sort order: `relevancy`, `helpful`, `submission-desc`, `submission-asc`, `rating-desc` or `rating-asc` | No |
353
353
  | `ratings` | string | Comma-separated star ratings to filter by (e.g. `4,5`) | No |
354
354
  | `verified_purchase` | boolean | Include only reviews with a "Verified Purchase" badge (default: `false`) | No |
355
355
  | `output_format` | string | `json` (default) or `csv` | No |
@@ -445,6 +445,124 @@ Every Redfin tool takes a full Redfin URL matching the tool (property, search, o
445
445
 
446
446
  </details>
447
447
 
448
+ #### Home Depot
449
+
450
+ Home Depot tools cover homedepot.com (US).
451
+
452
+ <details>
453
+ <summary><strong>homedepot_search</strong> — Parsed Home Depot product search results</summary>
454
+
455
+ 📖 [Official docs](https://docs.scraperapi.com/structured-data-endpoints/e-commerce/homedepot/homedepot-search-api)
456
+
457
+ Provide either `search_term` or `url`. Results are localized to a default Home Depot store; selecting a specific store or ZIP code is not supported. Ranking can change between requests, so use item IDs to deduplicate when paginating.
458
+
459
+ | Parameter | Type | Description | Required |
460
+ |-----------|------|-------------|----------|
461
+ | `search_term` | string | Keyword to search for (e.g. `milwaukee cordless drill`) | One of `search_term` / `url` |
462
+ | `url` | string | Home Depot search (`https://www.homedepot.com/s/...`) or category browse (`https://www.homedepot.com/b/...`) page URL. When given, `page`, `sort_by` and the price filters are ignored | One of `search_term` / `url` |
463
+ | `page` | integer | 1-based results page number (up to 24 results per page) | No |
464
+ | `sort_by` | string | `best_seller`, `most_popular`, `price_low_to_high`, `price_high_to_low`, or `highest_rating` | No |
465
+ | `min_price` | number | Minimum price in USD | No |
466
+ | `max_price` | number | Maximum price in USD | No |
467
+
468
+ </details>
469
+
470
+ <details>
471
+ <summary><strong>homedepot_product</strong> — Parsed Home Depot product details</summary>
472
+
473
+ 📖 [Official docs](https://docs.scraperapi.com/structured-data-endpoints/e-commerce/homedepot/homedepot-product-api)
474
+
475
+ Provide one of `item_id`, `gtin` or `url`; if several are given, `url` takes priority, then `gtin`. A `gtin` must match exactly one Home Depot product, otherwise the response is "Product not found."
476
+
477
+ | Parameter | Type | Description | Required |
478
+ |-----------|------|-------------|----------|
479
+ | `item_id` | string | Home Depot item ID (e.g. `320326855`) | One of `item_id` / `gtin` / `url` |
480
+ | `gtin` | string | Product barcode: UPC, EAN or GTIN (e.g. `045242637720`) | One of `item_id` / `gtin` / `url` |
481
+ | `url` | string | Home Depot product page URL (`https://www.homedepot.com/p/...`) | One of `item_id` / `gtin` / `url` |
482
+
483
+ </details>
484
+
485
+ <details>
486
+ <summary><strong>homedepot_reviews</strong> — Parsed customer reviews for a Home Depot product</summary>
487
+
488
+ 📖 [Official docs](https://docs.scraperapi.com/structured-data-endpoints/e-commerce/homedepot/homedepot-reviews-api)
489
+
490
+ Provide one of `item_id`, `gtin` or `url`; if several are given, `url` takes priority, then `gtin`. To page through all reviews, use `item_id` with `page`. Reviews of related products can appear; each review's `item_id` shows the product it belongs to.
491
+
492
+ | Parameter | Type | Description | Required |
493
+ |-----------|------|-------------|----------|
494
+ | `item_id` | string | Home Depot item ID (e.g. `320326855`) | One of `item_id` / `gtin` / `url` |
495
+ | `gtin` | string | Product barcode: UPC, EAN or GTIN (e.g. `045242637720`). Returns the first 10 reviews only | One of `item_id` / `gtin` / `url` |
496
+ | `url` | string | Product page URL (`https://www.homedepot.com/p/...`, returns the first 10 reviews) or reviews page URL (`https://www.homedepot.com/p/reviews/x/<item_id>/<page>`, returns that page) | One of `item_id` / `gtin` / `url` |
497
+ | `page` | integer | 1-based reviews page number (up to 30 reviews per page). Only applies with `item_id` | No |
498
+
499
+ </details>
500
+
501
+ #### AI results (Beta)
502
+
503
+ These tools return the answer of an AI search product as structured data. Beta: success rate and response time can vary; retry failed requests.
504
+
505
+ <details>
506
+ <summary><strong>google_ai_mode</strong> — Parsed Google AI Mode answer with cited sources</summary>
507
+
508
+ 📖 [Official docs](https://docs.scraperapi.com/structured-data-endpoints/ai-results/google-ai-mode)
509
+
510
+ Provide either `query` or `url`. For classic organic results, use `google_search`.
511
+
512
+ | Parameter | Type | Description | Required |
513
+ |-----------|------|-------------|----------|
514
+ | `query` | string | Question or search query to ask Google AI Mode | One of `query` / `url` |
515
+ | `url` | string | Google AI Mode URL (a Google search URL containing `udm=50`), used as-is | One of `query` / `url` |
516
+ | `hl` | string | Interface/host language code (e.g. `en`, `es`) | No |
517
+ | `gl` | string | Country edition to search (2-letter code) | No |
518
+ | `uule` | string | Google `uule` geolocation string (advanced) | No |
519
+ | `include_html` | boolean | Include the raw page HTML alongside parsed data (default: `false`) | No |
520
+ | `output_format` | string | `json` (default) or `csv` | No |
521
+ | `tld` | string | Google TLD (e.g. `com`, `co.uk`) | No |
522
+ | `country_code` | string | ISO 2-letter country code for geo-targeting | No |
523
+
524
+ </details>
525
+
526
+ <details>
527
+ <summary><strong>google_gemini</strong> — Parsed Google Gemini answer with cited sources</summary>
528
+
529
+ 📖 [Official docs](https://docs.scraperapi.com/structured-data-endpoints/ai-results/gemini)
530
+
531
+ | Parameter | Type | Description | Required |
532
+ |-----------|------|-------------|----------|
533
+ | `query` | string | Prompt to send to Gemini | Yes |
534
+ | `include_html` | boolean | Include the raw page HTML alongside parsed data (default: `false`) | No |
535
+ | `output_format` | string | `json` (default) or `csv` | No |
536
+
537
+ </details>
538
+
539
+ <details>
540
+ <summary><strong>chatgpt_search</strong> — Parsed ChatGPT answer</summary>
541
+
542
+ 📖 [Official docs](https://docs.scraperapi.com/structured-data-endpoints/ai-results/chatgpt)
543
+
544
+ Sources are collected on a best-effort basis. Set `sources` to `true` to require them for a successful response.
545
+
546
+ | Parameter | Type | Description | Required |
547
+ |-----------|------|-------------|----------|
548
+ | `query` | string | Prompt to send to ChatGPT | Yes |
549
+ | `sources` | boolean | Require cited sources for a successful response. Uses premium proxies and additional techniques, so it costs more credits (default: `false`) | No |
550
+ | `output_format` | string | `json` (default) or `csv` | No |
551
+
552
+ </details>
553
+
554
+ <details>
555
+ <summary><strong>perplexity_search</strong> — Parsed Perplexity answer with cited web sources</summary>
556
+
557
+ 📖 [Official docs](https://docs.scraperapi.com/structured-data-endpoints/ai-results/perplexity)
558
+
559
+ | Parameter | Type | Description | Required |
560
+ |-----------|------|-------------|----------|
561
+ | `query` | string | Prompt to send to Perplexity | Yes |
562
+ | `output_format` | string | `json` (default) or `csv` | No |
563
+
564
+ </details>
565
+
448
566
  ### Crawler
449
567
 
450
568
  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.
@@ -529,8 +647,9 @@ Returns: JSON with the parser's `status` (`GENERATING`/`FINISHED`/`FAILED`), fie
529
647
  | `parser_id` | string | The parser id to run | Yes |
530
648
  | `url` | string | The URL to scrape and parse | Yes |
531
649
  | `version` | integer | Specific parser version (default: latest) | No |
650
+ | `scraper_params` | object | ScraperAPI fetch options applied when scraping the target page: `render`, `country_code`, `premium`, `session_number`, `keep_headers`, `device_type`, `ultra_premium`, `follow_redirect`, `retry_404` — needed for dynamic or geo-restricted pages | No |
532
651
 
533
- Returns: JSON `{"parser": ..., "version": ..., "result": {...}}`. Costs 1 credit per call.
652
+ Returns: JSON `{"parser": ..., "version": ..., "result": {...}}`. Parsing uses standard scraping credits (1 for a plain fetch; more if `scraper_params` enable render/premium/etc.).
534
653
 
535
654
  </details>
536
655
 
@@ -567,7 +686,7 @@ No parameters. Returns a JSON array of parser summaries (id, name, status, versi
567
686
  ### Prompt templates
568
687
 
569
688
  - 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.
689
+ - 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
690
 
572
691
  ## Configuration
573
692
 
@@ -578,9 +697,7 @@ Configure the server through environment variables. Only `API_KEY` is required.
578
697
  | Variable | Default | Description |
579
698
  |----------|---------|-------------|
580
699
  | `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. |
700
+ | `API_TIMEOUT_SECONDS` | `200` | Per-request timeout, in seconds. |
584
701
  | `RATE_LIMIT_MAX_CALLS` | `10` | Maximum tool calls allowed per rate-limit window. |
585
702
  | `RATE_LIMIT_WINDOW_SECONDS` | `60` | Length of the rate-limit window, in seconds. |
586
703
  | `IMAGE_SIZE_LIMIT_BYTES` | `700000` | Maximum size of an image the `scrape` tool returns inline. |
@@ -689,12 +806,6 @@ More [here](https://docs.cline.bot/mcp/adding-and-configuring-servers#editing-co
689
806
  docker run -e API_KEY=<YOUR_SCRAPERAPI_API_KEY> scraperapi-mcp-server
690
807
  ```
691
808
 
692
- ### Debug
693
-
694
- ```bash
695
- python3 -m scraperapi_mcp_server --debug
696
- ```
697
-
698
809
  ### Testing
699
810
 
700
811
  This project uses [pytest](https://docs.pytest.org/en/stable/) for testing.
@@ -20,7 +20,7 @@ This is the self-hosted (local) server. A [hosted (remote) version](https://docs
20
20
  - [Features](#features)
21
21
  - [Architecture](#architecture)
22
22
  - [Installation](#installation)
23
- - [API Reference](#api-reference)
23
+ - [Available tools](#available-tools)
24
24
  - [Configuration](#configuration)
25
25
  - [Settings](#settings)
26
26
  - [Client Setup](#client-setup)
@@ -76,7 +76,7 @@ Add this to your client configuration file:
76
76
  }
77
77
  ```
78
78
 
79
- ### Using Docker
79
+ ### Using Docker
80
80
 
81
81
  Add this to your client configuration file:
82
82
 
@@ -110,8 +110,6 @@ Add this to your client configuration file:
110
110
 
111
111
  ### API
112
112
 
113
- 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.
114
-
115
113
  <details>
116
114
  <summary><strong>scrape</strong> — Scrape any web page or image, bypassing anti-bot protection</summary>
117
115
 
@@ -134,6 +132,8 @@ Returns: the scraped content as a string, or image data for image URLs.
134
132
 
135
133
  ### SDEs
136
134
 
135
+ Structured Data Endpoints (SDEs) return pre-parsed JSON (or CSV) instead of raw HTML. Every SDE tool except the Home Depot ones (JSON only) also accepts `output_format` (`json` by default, or `csv`). Most also accept `tld` and `country_code`. Each tool's table lists the parameters it takes.
136
+
137
137
  #### Google
138
138
 
139
139
  <details>
@@ -328,7 +328,7 @@ Returns: the scraped content as a string, or image data for image URLs.
328
328
  |-----------|------|-------------|----------|
329
329
  | `product_id` | string | Walmart product ID | Yes |
330
330
  | `page` | integer | 1-based results page number | No |
331
- | `sort` | string | Sort order (e.g. `helpful`, `recent`) | No |
331
+ | `sort` | string | Sort order: `relevancy`, `helpful`, `submission-desc`, `submission-asc`, `rating-desc` or `rating-asc` | No |
332
332
  | `ratings` | string | Comma-separated star ratings to filter by (e.g. `4,5`) | No |
333
333
  | `verified_purchase` | boolean | Include only reviews with a "Verified Purchase" badge (default: `false`) | No |
334
334
  | `output_format` | string | `json` (default) or `csv` | No |
@@ -424,6 +424,124 @@ Every Redfin tool takes a full Redfin URL matching the tool (property, search, o
424
424
 
425
425
  </details>
426
426
 
427
+ #### Home Depot
428
+
429
+ Home Depot tools cover homedepot.com (US).
430
+
431
+ <details>
432
+ <summary><strong>homedepot_search</strong> — Parsed Home Depot product search results</summary>
433
+
434
+ 📖 [Official docs](https://docs.scraperapi.com/structured-data-endpoints/e-commerce/homedepot/homedepot-search-api)
435
+
436
+ Provide either `search_term` or `url`. Results are localized to a default Home Depot store; selecting a specific store or ZIP code is not supported. Ranking can change between requests, so use item IDs to deduplicate when paginating.
437
+
438
+ | Parameter | Type | Description | Required |
439
+ |-----------|------|-------------|----------|
440
+ | `search_term` | string | Keyword to search for (e.g. `milwaukee cordless drill`) | One of `search_term` / `url` |
441
+ | `url` | string | Home Depot search (`https://www.homedepot.com/s/...`) or category browse (`https://www.homedepot.com/b/...`) page URL. When given, `page`, `sort_by` and the price filters are ignored | One of `search_term` / `url` |
442
+ | `page` | integer | 1-based results page number (up to 24 results per page) | No |
443
+ | `sort_by` | string | `best_seller`, `most_popular`, `price_low_to_high`, `price_high_to_low`, or `highest_rating` | No |
444
+ | `min_price` | number | Minimum price in USD | No |
445
+ | `max_price` | number | Maximum price in USD | No |
446
+
447
+ </details>
448
+
449
+ <details>
450
+ <summary><strong>homedepot_product</strong> — Parsed Home Depot product details</summary>
451
+
452
+ 📖 [Official docs](https://docs.scraperapi.com/structured-data-endpoints/e-commerce/homedepot/homedepot-product-api)
453
+
454
+ Provide one of `item_id`, `gtin` or `url`; if several are given, `url` takes priority, then `gtin`. A `gtin` must match exactly one Home Depot product, otherwise the response is "Product not found."
455
+
456
+ | Parameter | Type | Description | Required |
457
+ |-----------|------|-------------|----------|
458
+ | `item_id` | string | Home Depot item ID (e.g. `320326855`) | One of `item_id` / `gtin` / `url` |
459
+ | `gtin` | string | Product barcode: UPC, EAN or GTIN (e.g. `045242637720`) | One of `item_id` / `gtin` / `url` |
460
+ | `url` | string | Home Depot product page URL (`https://www.homedepot.com/p/...`) | One of `item_id` / `gtin` / `url` |
461
+
462
+ </details>
463
+
464
+ <details>
465
+ <summary><strong>homedepot_reviews</strong> — Parsed customer reviews for a Home Depot product</summary>
466
+
467
+ 📖 [Official docs](https://docs.scraperapi.com/structured-data-endpoints/e-commerce/homedepot/homedepot-reviews-api)
468
+
469
+ Provide one of `item_id`, `gtin` or `url`; if several are given, `url` takes priority, then `gtin`. To page through all reviews, use `item_id` with `page`. Reviews of related products can appear; each review's `item_id` shows the product it belongs to.
470
+
471
+ | Parameter | Type | Description | Required |
472
+ |-----------|------|-------------|----------|
473
+ | `item_id` | string | Home Depot item ID (e.g. `320326855`) | One of `item_id` / `gtin` / `url` |
474
+ | `gtin` | string | Product barcode: UPC, EAN or GTIN (e.g. `045242637720`). Returns the first 10 reviews only | One of `item_id` / `gtin` / `url` |
475
+ | `url` | string | Product page URL (`https://www.homedepot.com/p/...`, returns the first 10 reviews) or reviews page URL (`https://www.homedepot.com/p/reviews/x/<item_id>/<page>`, returns that page) | One of `item_id` / `gtin` / `url` |
476
+ | `page` | integer | 1-based reviews page number (up to 30 reviews per page). Only applies with `item_id` | No |
477
+
478
+ </details>
479
+
480
+ #### AI results (Beta)
481
+
482
+ These tools return the answer of an AI search product as structured data. Beta: success rate and response time can vary; retry failed requests.
483
+
484
+ <details>
485
+ <summary><strong>google_ai_mode</strong> — Parsed Google AI Mode answer with cited sources</summary>
486
+
487
+ 📖 [Official docs](https://docs.scraperapi.com/structured-data-endpoints/ai-results/google-ai-mode)
488
+
489
+ Provide either `query` or `url`. For classic organic results, use `google_search`.
490
+
491
+ | Parameter | Type | Description | Required |
492
+ |-----------|------|-------------|----------|
493
+ | `query` | string | Question or search query to ask Google AI Mode | One of `query` / `url` |
494
+ | `url` | string | Google AI Mode URL (a Google search URL containing `udm=50`), used as-is | One of `query` / `url` |
495
+ | `hl` | string | Interface/host language code (e.g. `en`, `es`) | No |
496
+ | `gl` | string | Country edition to search (2-letter code) | No |
497
+ | `uule` | string | Google `uule` geolocation string (advanced) | No |
498
+ | `include_html` | boolean | Include the raw page HTML alongside parsed data (default: `false`) | No |
499
+ | `output_format` | string | `json` (default) or `csv` | No |
500
+ | `tld` | string | Google TLD (e.g. `com`, `co.uk`) | No |
501
+ | `country_code` | string | ISO 2-letter country code for geo-targeting | No |
502
+
503
+ </details>
504
+
505
+ <details>
506
+ <summary><strong>google_gemini</strong> — Parsed Google Gemini answer with cited sources</summary>
507
+
508
+ 📖 [Official docs](https://docs.scraperapi.com/structured-data-endpoints/ai-results/gemini)
509
+
510
+ | Parameter | Type | Description | Required |
511
+ |-----------|------|-------------|----------|
512
+ | `query` | string | Prompt to send to Gemini | Yes |
513
+ | `include_html` | boolean | Include the raw page HTML alongside parsed data (default: `false`) | No |
514
+ | `output_format` | string | `json` (default) or `csv` | No |
515
+
516
+ </details>
517
+
518
+ <details>
519
+ <summary><strong>chatgpt_search</strong> — Parsed ChatGPT answer</summary>
520
+
521
+ 📖 [Official docs](https://docs.scraperapi.com/structured-data-endpoints/ai-results/chatgpt)
522
+
523
+ Sources are collected on a best-effort basis. Set `sources` to `true` to require them for a successful response.
524
+
525
+ | Parameter | Type | Description | Required |
526
+ |-----------|------|-------------|----------|
527
+ | `query` | string | Prompt to send to ChatGPT | Yes |
528
+ | `sources` | boolean | Require cited sources for a successful response. Uses premium proxies and additional techniques, so it costs more credits (default: `false`) | No |
529
+ | `output_format` | string | `json` (default) or `csv` | No |
530
+
531
+ </details>
532
+
533
+ <details>
534
+ <summary><strong>perplexity_search</strong> — Parsed Perplexity answer with cited web sources</summary>
535
+
536
+ 📖 [Official docs](https://docs.scraperapi.com/structured-data-endpoints/ai-results/perplexity)
537
+
538
+ | Parameter | Type | Description | Required |
539
+ |-----------|------|-------------|----------|
540
+ | `query` | string | Prompt to send to Perplexity | Yes |
541
+ | `output_format` | string | `json` (default) or `csv` | No |
542
+
543
+ </details>
544
+
427
545
  ### Crawler
428
546
 
429
547
  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.
@@ -508,8 +626,9 @@ Returns: JSON with the parser's `status` (`GENERATING`/`FINISHED`/`FAILED`), fie
508
626
  | `parser_id` | string | The parser id to run | Yes |
509
627
  | `url` | string | The URL to scrape and parse | Yes |
510
628
  | `version` | integer | Specific parser version (default: latest) | No |
629
+ | `scraper_params` | object | ScraperAPI fetch options applied when scraping the target page: `render`, `country_code`, `premium`, `session_number`, `keep_headers`, `device_type`, `ultra_premium`, `follow_redirect`, `retry_404` — needed for dynamic or geo-restricted pages | No |
511
630
 
512
- Returns: JSON `{"parser": ..., "version": ..., "result": {...}}`. Costs 1 credit per call.
631
+ Returns: JSON `{"parser": ..., "version": ..., "result": {...}}`. Parsing uses standard scraping credits (1 for a plain fetch; more if `scraper_params` enable render/premium/etc.).
513
632
 
514
633
  </details>
515
634
 
@@ -546,7 +665,7 @@ No parameters. Returns a JSON array of parser summaries (id, name, status, versi
546
665
  ### Prompt templates
547
666
 
548
667
  - 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.
549
- - Can you scrape URL `<URL>` to extract `<SPECIFIC_DATA>`? If the request returns missing/incomplete`<SPECIFIC_DATA>`, set render=true to enable JS Rendering.
668
+ - Can you scrape URL `<URL>` to extract `<SPECIFIC_DATA>`? If the request returns missing/incomplete `<SPECIFIC_DATA>`, set render=true to enable JS Rendering.
550
669
 
551
670
  ## Configuration
552
671
 
@@ -557,9 +676,7 @@ Configure the server through environment variables. Only `API_KEY` is required.
557
676
  | Variable | Default | Description |
558
677
  |----------|---------|-------------|
559
678
  | `API_KEY` | — | **Required.** Your ScraperAPI API key. |
560
- | `API_URL` | `https://api.scraperapi.com` | Base URL for the ScraperAPI API and structured-data endpoints.
561
- | `SCRAPER_SDK` | `mcp-server` | Client identifier sent to ScraperAPI on every request. |
562
- | `API_TIMEOUT_SECONDS` | `70` | Per-request timeout, in seconds. |
679
+ | `API_TIMEOUT_SECONDS` | `200` | Per-request timeout, in seconds. |
563
680
  | `RATE_LIMIT_MAX_CALLS` | `10` | Maximum tool calls allowed per rate-limit window. |
564
681
  | `RATE_LIMIT_WINDOW_SECONDS` | `60` | Length of the rate-limit window, in seconds. |
565
682
  | `IMAGE_SIZE_LIMIT_BYTES` | `700000` | Maximum size of an image the `scrape` tool returns inline. |
@@ -668,12 +785,6 @@ More [here](https://docs.cline.bot/mcp/adding-and-configuring-servers#editing-co
668
785
  docker run -e API_KEY=<YOUR_SCRAPERAPI_API_KEY> scraperapi-mcp-server
669
786
  ```
670
787
 
671
- ### Debug
672
-
673
- ```bash
674
- python3 -m scraperapi_mcp_server --debug
675
- ```
676
-
677
788
  ### Testing
678
789
 
679
790
  This project uses [pytest](https://docs.pytest.org/en/stable/) for testing.
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "scraperapi-mcp-server"
3
- version = "1.1.0"
3
+ version = "1.2.0"
4
4
  description = "ScraperAPI MCP server"
5
5
  license = "MIT"
6
6
  readme = "README.md"
@@ -12,13 +12,8 @@ except PackageNotFoundError: # running from source without an install
12
12
 
13
13
  def main():
14
14
  """ScraperAPI MCP server main module."""
15
- logging.basicConfig(
16
- level=logging.INFO,
17
- format="%(asctime)s %(levelname)s %(message)s",
18
- )
19
15
  logging.info("Starting ScraperAPI MCP server main module.")
20
16
  try:
21
- logging.debug("Running ScraperAPI MCP server...")
22
17
  mcp.run()
23
18
  except Exception as e:
24
19
  logging.exception(
@@ -134,7 +134,9 @@ def register_aiparser_tools(mcp: FastMCP) -> None:
134
134
 
135
135
  Scrapes the given URL and applies the parser, returning the extracted data
136
136
  as structured JSON keyed by the parser's fields. The parser must already be
137
- 'FINISHED' (see 'ai_parser_create' / 'ai_parser_get_details'). Costs 1 credit per call.
137
+ 'FINISHED' (see 'ai_parser_create' / 'ai_parser_get_details'). Parsing uses
138
+ standard scraping credits (1 for a plain fetch; more if scraper_params enable
139
+ render/premium/etc.).
138
140
 
139
141
  When to use:
140
142
  - Extracting structured data from a page using a FINISHED parser
@@ -145,7 +147,8 @@ def register_aiparser_tools(mcp: FastMCP) -> None:
145
147
  - A one-off fetch (use 'scrape') or a supported marketplace/SERP (use the SDE)
146
148
 
147
149
  Args:
148
- params (AiParseParams): parser_id and url are required; optional version.
150
+ params (AiParseParams): parser_id and url are required; optional version
151
+ and scraper_params (fetch options for dynamic/geo-restricted pages).
149
152
 
150
153
  Returns:
151
154
  str: JSON of the form {"parser": ..., "version": ..., "result": {...}}.
@@ -155,11 +158,13 @@ def register_aiparser_tools(mcp: FastMCP) -> None:
155
158
  the request fails.
156
159
  """
157
160
  path = _parser_path("parse", params.parser_id, params.version)
158
- return await run_request(
159
- http.get(
160
- f"{settings.AIPARSER_URL}{path}",
161
- params={"api_key": settings.API_KEY, "url": params.url},
161
+ query = {"api_key": settings.API_KEY, "url": params.url}
162
+ if params.scraper_params is not None:
163
+ query.update(
164
+ params.scraper_params.model_dump(mode="json", exclude_none=True)
162
165
  )
166
+ return await run_request(
167
+ http.get(f"{settings.AIPARSER_URL}{path}", params=query)
163
168
  )
164
169
 
165
170
  @mcp.tool(name="ai_parser_list", annotations=_READ_ANNOTATIONS)
@@ -248,4 +253,6 @@ def register_aiparser_tools(mcp: FastMCP) -> None:
248
253
  mode="json", exclude_none=True, exclude={"parser_id", "version"}
249
254
  )
250
255
  body["api_key"] = settings.API_KEY
251
- return await run_request(http.patch(f"{settings.AIPARSER_URL}{path}", json=body))
256
+ return await run_request(
257
+ http.patch(f"{settings.AIPARSER_URL}{path}", json=body)
258
+ )
@@ -77,11 +77,15 @@ class ParserField(BaseModel):
77
77
  ]
78
78
  type: Annotated[
79
79
  Optional[FieldType],
80
- Field(default=None, description="Expected type: 'string', 'number', or 'array'."),
80
+ Field(
81
+ default=None, description="Expected type: 'string', 'number', or 'array'."
82
+ ),
81
83
  ]
82
84
  selector: Annotated[
83
85
  Optional[str],
84
- Field(default=None, description="Optional CSS/XPath selector hint for the field."),
86
+ Field(
87
+ default=None, description="Optional CSS/XPath selector hint for the field."
88
+ ),
85
89
  ]
86
90
 
87
91
 
@@ -133,7 +137,9 @@ class AiParserGetParams(BaseModel):
133
137
  version: Annotated[
134
138
  Optional[int],
135
139
  Field(
136
- default=None, ge=0, description="Specific parser version. Defaults to the latest."
140
+ default=None,
141
+ ge=0,
142
+ description="Specific parser version. Defaults to the latest.",
137
143
  ),
138
144
  ]
139
145
 
@@ -148,7 +154,16 @@ class AiParseParams(BaseModel):
148
154
  version: Annotated[
149
155
  Optional[int],
150
156
  Field(
151
- default=None, ge=0, description="Specific parser version. Defaults to the latest."
157
+ default=None,
158
+ ge=0,
159
+ description="Specific parser version. Defaults to the latest.",
160
+ ),
161
+ ]
162
+ scraper_params: Annotated[
163
+ Optional[ParserScraperParams],
164
+ Field(
165
+ default=None,
166
+ description="Optional ScraperAPI fetch options applied when scraping the target page (e.g. render, country_code). Needed for dynamic or geo-restricted pages.",
152
167
  ),
153
168
  ]
154
169
 
@@ -19,7 +19,7 @@ class Settings(BaseSettings):
19
19
  CRAWLER_URL: str = "https://crawler.scraperapi.com"
20
20
  AIPARSER_URL: str = "https://aiparser.scraperapi.com"
21
21
  SCRAPER_SDK: str = "mcp-server"
22
- API_TIMEOUT_SECONDS: int = 70
22
+ API_TIMEOUT_SECONDS: int = 200
23
23
  RATE_LIMIT_MAX_CALLS: int = 10
24
24
  RATE_LIMIT_WINDOW_SECONDS: float = 60.0
25
25
  IMAGE_SIZE_LIMIT_BYTES: int = (
@@ -1,14 +1,17 @@
1
1
  """ScraperAPI Crawler tools.
2
2
 
3
3
  The crawler is an asynchronous service on a separate host (``CRAWLER_URL``):
4
- submit a job and receive a job id immediately, then poll for status. These tools
5
- POST a JSON body (with ``api_key`` in the body, not the query string).
4
+ submit a job and receive a job id immediately, then poll for status. Starting a
5
+ job POSTs a JSON body with ``api_key`` in it; status and delete send ``api_key``
6
+ as a query param.
6
7
 
7
8
  The server does NOT poll internally. ``crawler_job_start`` returns the job id and
8
9
  the caller polls ``crawler_job_status`` until the job is done. Per-page results
9
10
  are delivered to the optional ``callback_url`` webhook.
10
11
  """
11
12
 
13
+ from urllib.parse import quote
14
+
12
15
  from mcp.server.fastmcp import FastMCP
13
16
  from mcp.types import ToolAnnotations
14
17
 
@@ -107,7 +110,10 @@ def register_crawler_tools(mcp: FastMCP) -> None:
107
110
  the request fails.
108
111
  """
109
112
  return await run_request(
110
- http.get(f"{settings.CRAWLER_URL}/job/{params.job_id}/status")
113
+ http.get(
114
+ f"{settings.CRAWLER_URL}/job/{quote(params.job_id, safe='')}/status",
115
+ params={"api_key": settings.API_KEY},
116
+ )
111
117
  )
112
118
 
113
119
  @mcp.tool(name="crawler_job_delete", annotations=_DELETE_ANNOTATIONS)
@@ -135,5 +141,8 @@ def register_crawler_tools(mcp: FastMCP) -> None:
135
141
  the request fails.
136
142
  """
137
143
  return await run_request(
138
- http.delete(f"{settings.CRAWLER_URL}/job/{params.job_id}")
144
+ http.delete(
145
+ f"{settings.CRAWLER_URL}/job/{quote(params.job_id, safe='')}",
146
+ params={"api_key": settings.API_KEY},
147
+ )
139
148
  )
@@ -1,12 +1,12 @@
1
1
  """Shared tool-execution plumbing for all ScraperAPI MCP tools."""
2
2
 
3
- from typing import Awaitable
3
+ from typing import Any, Coroutine
4
4
 
5
5
  import httpx
6
6
  from mcp.server.fastmcp.exceptions import ToolError
7
7
 
8
8
  from scraperapi_mcp_server.config import ApiKeyEnvVarNotSetError, settings
9
- from scraperapi_mcp_server.sdes.base import BaseSdeParams, fetch_sde
9
+ from scraperapi_mcp_server.sdes.base import BaseSdeModel, fetch_sde
10
10
  from scraperapi_mcp_server.utils.exceptions import ScraperAPIError
11
11
  from scraperapi_mcp_server.utils.rate_limiter import (
12
12
  RateLimiter,
@@ -36,7 +36,7 @@ def require_ready() -> None:
36
36
  raise ToolError(str(e)) from e
37
37
 
38
38
 
39
- async def run_sde(path: str, params: BaseSdeParams) -> str:
39
+ async def run_sde(path: str, params: BaseSdeModel) -> str:
40
40
  """Run a structured-data endpoint tool end to end.
41
41
 
42
42
  Applies the shared guard rails, calls the endpoint, and converts any
@@ -44,7 +44,7 @@ async def run_sde(path: str, params: BaseSdeParams) -> str:
44
44
 
45
45
  Args:
46
46
  path: Endpoint path including the ``/structured`` prefix.
47
- params: A populated :class:`BaseSdeParams` subclass instance.
47
+ params: A populated :class:`BaseSdeModel` subclass instance.
48
48
 
49
49
  Returns:
50
50
  The raw response body (JSON or CSV) as text.
@@ -56,7 +56,7 @@ async def run_sde(path: str, params: BaseSdeParams) -> str:
56
56
  raise ToolError(str(e)) from e
57
57
 
58
58
 
59
- async def run_request(response: Awaitable[httpx.Response]) -> str:
59
+ async def run_request(response: Coroutine[Any, Any, httpx.Response]) -> str:
60
60
  """Run a raw HTTP tool call end to end.
61
61
 
62
62
  For tools that assemble their own request (e.g. the crawler, which POSTs a
@@ -70,7 +70,11 @@ async def run_request(response: Awaitable[httpx.Response]) -> str:
70
70
  Returns:
71
71
  The response body as text.
72
72
  """
73
- require_ready()
73
+ try:
74
+ require_ready()
75
+ except ToolError:
76
+ response.close() # else Python warns the request "was never awaited"
77
+ raise
74
78
  try:
75
79
  result = await response
76
80
  return result.text