Skip to main content

ScraperAPI MCP server

Project description

ScraperAPI MCP server

The ScraperAPI MCP server enables LLM clients to retrieve and process web scraping requests using the ScraperAPI services.

Table of Contents

Features

  • Full implementation of the Model Context Protocol specification
  • Seamless integration with ScraperAPI for web scraping
  • Simple setup with Python

Architecture

          ┌───────────────┐     ┌───────────────────────┐     ┌───────────────┐
          │  LLM Client   │────▶│  Scraper MCP Server   │────▶│    AI Model   │
          └───────────────┘     └───────────────────────┘     └───────────────┘
                                            │
                                            ▼
                                  ┌──────────────────┐
                                  │  ScraperAPI API  │
                                  └──────────────────┘

Installation

The ScraperAPI MCP Server is designed to run as a local server on your machine, your LLM client will launch it automatically when configured.

Prerequisites

  • Python 3.11+

Using Python

Add this to your client configuration file:

{
  "mcpServers": {
    "ScraperAPI": {
      "command": "python",
      "args": ["-m", "scraperapi_mcp_server"],
      "env": {
        "API_KEY": "<YOUR_SCRAPERAPI_API_KEY>"
      }
    }
  }
}

[!TIP]

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:

which <YOUR_COMMAND>

API Reference

Available Tools

  • scrape
    • Scrape a URL from the internet using ScraperAPI
    • Parameters:
      • url (string, required): URL to scrape
      • render (boolean, optional): Whether to render the page using JavaScript. Defaults to False. Set to True only if the page requires JavaScript rendering to display its content.
      • country_code (string, optional): Activate country geotargeting (ISO 2-letter code)
      • premium (boolean, optional): Activate premium residential and mobile IPs
      • ultra_premium (boolean, optional): Activate advanced bypass mechanisms. Can not combine with premium
      • device_type (string, optional): Set request to use mobile or desktop user agents
    • Returns: The scraped content as a string

Prompt templates

  • 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.
  • Can you scrape URL <URL> to extract <SPECIFIC_DATA>? If the request returns missing/incomplete<SPECIFIC_DATA>, set render=true to enable JS Rendering.

Configuration

Settings

  • API_KEY: Your ScraperAPI API key.

Configure for Claude Desktop App

  1. Open Claude Desktop Application
  2. Access the Settings Menu
  3. Click on the settings icon (typically a gear or three dots in the upper right corner)
  4. Select the "Developer" tab
  5. Click on "Edit Config" and paste the JSON configuration file.

Development

Local setup

  1. Clone the repository:

    git clone https://github.com/scraperapi/scraperapi-mcp
    cd scraperapi-mcp
    
  2. Install dependencies and run the package locally:

    • Using Python:
      # Create virtual environment and activate it
      python -m venv .venv
      source .venv/bin/activate # MacOS/Linux
      # OR
      .venv/Scripts/activate # Windows
      
      # Install the local package in editable mode
      pip install -e .
      

Run the server

  • Using Python:
    python -m scraperapi_mcp_server
    

Debug

python3 -m scraperapi_mcp_server --debug

Testing

This project uses pytest for testing.

Install Test Dependencies

# Install the package with test dependencies
pip install -e ".[test]"

Running Tests

# Run All Tests
pytest

# Run Specific Test
pytest <TEST_FILE_PATH>

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scraperapi_mcp_server-0.2.0.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scraperapi_mcp_server-0.2.0-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file scraperapi_mcp_server-0.2.0.tar.gz.

File metadata

  • Download URL: scraperapi_mcp_server-0.2.0.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.13.5 Darwin/25.0.0

File hashes

Hashes for scraperapi_mcp_server-0.2.0.tar.gz
Algorithm Hash digest
SHA256 6101d43d43b1ecdce9f5399daeb2e39cf936742fa1cc442f58838af8d433f8db
MD5 f78f663110e1517655b169426a80bf9b
BLAKE2b-256 7af08083359c8f4ef4cd320fcdfa7c575ef17b44b05b6f5e89e62de4e735459a

See more details on using hashes here.

File details

Details for the file scraperapi_mcp_server-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for scraperapi_mcp_server-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ed8269545c13b64311a9b5a6dc707754b176295f404a1f01c84c5505545186b1
MD5 05b65d766e1e98bded0cde98c90621d4
BLAKE2b-256 2ba489fcf8ac31e524784945b37c7d85a8cedc3ac4afa4d79fc77c1f807b1e25

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page