scraperapi-mcp-server 1.1.1__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.1 → scraperapi_mcp_server-1.2.0}/PKG-INFO +124 -11
  2. {scraperapi_mcp_server-1.1.1 → scraperapi_mcp_server-1.2.0}/README.md +123 -10
  3. {scraperapi_mcp_server-1.1.1 → scraperapi_mcp_server-1.2.0}/pyproject.toml +1 -1
  4. {scraperapi_mcp_server-1.1.1 → scraperapi_mcp_server-1.2.0}/src/scraperapi_mcp_server/__init__.py +0 -5
  5. {scraperapi_mcp_server-1.1.1 → scraperapi_mcp_server-1.2.0}/src/scraperapi_mcp_server/aiparser/aiparser.py +14 -7
  6. {scraperapi_mcp_server-1.1.1 → scraperapi_mcp_server-1.2.0}/src/scraperapi_mcp_server/aiparser/models.py +19 -4
  7. {scraperapi_mcp_server-1.1.1 → scraperapi_mcp_server-1.2.0}/src/scraperapi_mcp_server/config.py +1 -1
  8. {scraperapi_mcp_server-1.1.1 → scraperapi_mcp_server-1.2.0}/src/scraperapi_mcp_server/crawler/crawler.py +13 -4
  9. {scraperapi_mcp_server-1.1.1 → scraperapi_mcp_server-1.2.0}/src/scraperapi_mcp_server/execution.py +10 -6
  10. {scraperapi_mcp_server-1.1.1 → 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.1 → scraperapi_mcp_server-1.2.0}/src/scraperapi_mcp_server/sdes/base.py +35 -17
  13. {scraperapi_mcp_server-1.1.1 → 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.1 → scraperapi_mcp_server-1.2.0}/src/scraperapi_mcp_server/sdes/redfin.py +2 -1
  16. {scraperapi_mcp_server-1.1.1 → scraperapi_mcp_server-1.2.0}/src/scraperapi_mcp_server/sdes/walmart.py +1 -1
  17. {scraperapi_mcp_server-1.1.1 → scraperapi_mcp_server-1.2.0}/src/scraperapi_mcp_server/server.py +4 -0
  18. {scraperapi_mcp_server-1.1.1 → scraperapi_mcp_server-1.2.0}/src/scraperapi_mcp_server/utils/http.py +1 -1
  19. {scraperapi_mcp_server-1.1.1 → scraperapi_mcp_server-1.2.0}/LICENSE +0 -0
  20. {scraperapi_mcp_server-1.1.1 → scraperapi_mcp_server-1.2.0}/src/scraperapi_mcp_server/__main__.py +0 -0
  21. {scraperapi_mcp_server-1.1.1 → scraperapi_mcp_server-1.2.0}/src/scraperapi_mcp_server/crawler/models.py +0 -0
  22. {scraperapi_mcp_server-1.1.1 → scraperapi_mcp_server-1.2.0}/src/scraperapi_mcp_server/scrape/models.py +0 -0
  23. {scraperapi_mcp_server-1.1.1 → scraperapi_mcp_server-1.2.0}/src/scraperapi_mcp_server/sdes/amazon.py +0 -0
  24. {scraperapi_mcp_server-1.1.1 → scraperapi_mcp_server-1.2.0}/src/scraperapi_mcp_server/sdes/google.py +0 -0
  25. {scraperapi_mcp_server-1.1.1 → scraperapi_mcp_server-1.2.0}/src/scraperapi_mcp_server/utils/country_codes.py +0 -0
  26. {scraperapi_mcp_server-1.1.1 → scraperapi_mcp_server-1.2.0}/src/scraperapi_mcp_server/utils/exceptions.py +0 -0
  27. {scraperapi_mcp_server-1.1.1 → scraperapi_mcp_server-1.2.0}/src/scraperapi_mcp_server/utils/image_detection.py +0 -0
  28. {scraperapi_mcp_server-1.1.1 → 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.1
3
+ Version: 1.2.0
4
4
  Summary: ScraperAPI MCP server
5
5
  License: MIT
6
6
  Keywords: http,mcp,llm,automation,scraping
@@ -153,7 +153,7 @@ Returns: the scraped content as a string, or image data for image URLs.
153
153
 
154
154
  ### SDEs
155
155
 
156
- 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.
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
157
 
158
158
  #### Google
159
159
 
@@ -349,7 +349,7 @@ Structured Data Endpoints (SDEs) return pre-parsed JSON (or CSV) instead of raw
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
 
@@ -578,7 +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_TIMEOUT_SECONDS` | `70` | Per-request timeout, in seconds. |
700
+ | `API_TIMEOUT_SECONDS` | `200` | Per-request timeout, in seconds. |
582
701
  | `RATE_LIMIT_MAX_CALLS` | `10` | Maximum tool calls allowed per rate-limit window. |
583
702
  | `RATE_LIMIT_WINDOW_SECONDS` | `60` | Length of the rate-limit window, in seconds. |
584
703
  | `IMAGE_SIZE_LIMIT_BYTES` | `700000` | Maximum size of an image the `scrape` tool returns inline. |
@@ -687,12 +806,6 @@ More [here](https://docs.cline.bot/mcp/adding-and-configuring-servers#editing-co
687
806
  docker run -e API_KEY=<YOUR_SCRAPERAPI_API_KEY> scraperapi-mcp-server
688
807
  ```
689
808
 
690
- ### Debug
691
-
692
- ```bash
693
- python3 -m scraperapi_mcp_server --debug
694
- ```
695
-
696
809
  ### Testing
697
810
 
698
811
  This project uses [pytest](https://docs.pytest.org/en/stable/) for testing.
@@ -132,7 +132,7 @@ Returns: the scraped content as a string, or image data for image URLs.
132
132
 
133
133
  ### SDEs
134
134
 
135
- 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
+ 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
136
 
137
137
  #### Google
138
138
 
@@ -328,7 +328,7 @@ Structured Data Endpoints (SDEs) return pre-parsed JSON (or CSV) instead of raw
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
 
@@ -557,7 +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_TIMEOUT_SECONDS` | `70` | Per-request timeout, in seconds. |
679
+ | `API_TIMEOUT_SECONDS` | `200` | Per-request timeout, in seconds. |
561
680
  | `RATE_LIMIT_MAX_CALLS` | `10` | Maximum tool calls allowed per rate-limit window. |
562
681
  | `RATE_LIMIT_WINDOW_SECONDS` | `60` | Length of the rate-limit window, in seconds. |
563
682
  | `IMAGE_SIZE_LIMIT_BYTES` | `700000` | Maximum size of an image the `scrape` tool returns inline. |
@@ -666,12 +785,6 @@ More [here](https://docs.cline.bot/mcp/adding-and-configuring-servers#editing-co
666
785
  docker run -e API_KEY=<YOUR_SCRAPERAPI_API_KEY> scraperapi-mcp-server
667
786
  ```
668
787
 
669
- ### Debug
670
-
671
- ```bash
672
- python3 -m scraperapi_mcp_server --debug
673
- ```
674
-
675
788
  ### Testing
676
789
 
677
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.1"
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
@@ -59,7 +59,6 @@ async def basic_scrape(
59
59
  for key, (value, formatter) in optional_params.items():
60
60
  if value is not None:
61
61
  payload[key] = formatter(value)
62
- logging.debug(f"Added optional param: {key}={payload[key]}")
63
62
  try:
64
63
  logging.info(f"Sending request to {settings.API_URL}")
65
64
  async with httpx.AsyncClient(follow_redirects=True) as client:
@@ -105,7 +104,10 @@ async def basic_scrape(
105
104
  f"{k}={v}" for k, v in payload.items() if k != "api_key"
106
105
  )
107
106
  error_message = f"HTTP error {status_code} when scraping '{url}'. Parameters used: {param_summary}"
108
- logging.exception(f"basic_scrape: {error_message}")
107
+ body_preview = (e.response.text or "").strip()[:500]
108
+ if body_preview:
109
+ error_message += f". Response: {body_preview}"
110
+ logging.error(f"basic_scrape: {error_message}")
109
111
  raise ScrapeError(error_message) from e
110
112
  except httpx.RequestError as e:
111
113
  error_message = f"Connection error when scraping '{url}': {e}"
@@ -125,7 +127,7 @@ _SCRAPE_ANNOTATIONS = ToolAnnotations(
125
127
  )
126
128
 
127
129
 
128
- async def scrape_tool(params: Scrape) -> str:
130
+ async def scrape_tool(params: Scrape) -> str | Image:
129
131
  """Scrape a web page or image from any URL using the ScraperAPI services, bypassing anti-bot protections.
130
132
 
131
133
  Use this tool to retrieve the content of a web page or download an image from a given URL. It handles CAPTCHAs, IP blocks, and rate limits automatically via ScraperAPI's proxy infrastructure.
@@ -194,4 +196,8 @@ async def scrape_tool(params: Scrape) -> str:
194
196
 
195
197
  def register_scrape_tool(mcp: FastMCP) -> None:
196
198
  """Register the scrape tool on the given MCP server."""
197
- mcp.tool(name="scrape", annotations=_SCRAPE_ANNOTATIONS)(scrape_tool)
199
+ # structured_output=False: an output schema can't describe Image, and a
200
+ # str-only schema rejects image results.
201
+ mcp.tool(name="scrape", annotations=_SCRAPE_ANNOTATIONS, structured_output=False)(
202
+ scrape_tool
203
+ )