> ## Documentation Index
> Fetch the complete documentation index at: https://docs.scrapely.io/llms.txt
> Use this file to discover all available pages before exploring further.

# MCP Server for AI Agents

> Connect your AI agents directly to Scrapely using the Model Context Protocol (MCP).

Scrapely provides an official **Model Context Protocol (MCP)** server. This allows AI agents (like Claude, Trae, Cursor, and custom LLM workflows) to natively call Scrapely tools to crawl websites, bypass anti-bot protections, and take screenshots directly from their chat interface.

## Configuration

To add Scrapely to your MCP-compatible client, add the following configuration to your `mcp.json` or client settings. Make sure to replace `YOUR_API_KEY_HERE` with your actual Scrapely API key.

```json theme={null}
{
  "mcpServers": {
    "scrapely": {
      "type": "streamable-http",
      "url": "https://scrapely.io/streamable/mcp",
      "headers": {
        "X-API-Key": "YOUR_API_KEY_HERE"
      }
    }
  }
}
```

## Available Tools

Once configured, your AI agent will have access to the following tools:

### 1. `crawl`

Opens a website in a real headless browser, bypasses anti-bot systems, renders JavaScript, and returns the raw HTML or extracted text.

**Parameters:**

* `websiteUrl` (string, required): The target URL to crawl (must start with `http://` or `https://`).
* `return_page_source` (boolean, optional): If `true`, returns the raw HTML source code. Default is `false`.
* `return_page_text` (boolean, optional): If `true`, returns the visible extracted text from the page. Default is `true`.
* `device` (string, optional): Emulate a specific device. Either `"desktop"` or `"mobile"`. Default is `"desktop"`.

*(Note: You must choose either `return_page_source` or `return_page_text`, but not both).*

### 2. `screenshot`

Captures a high-quality screenshot of the website in a real browser with JavaScript rendering enabled. The AI agent receives this directly as an image object.

**Parameters:**

* `websiteUrl` (string, required): The target URL to screenshot (must start with `http://` or `https://`).
* `screenshot_type` (string, optional): Whether to capture the full page (`"full"`) or just the visible viewport (`"partial"`). Default is `"partial"`.
* `device` (string, optional): Emulate a specific device. Either `"desktop"` or `"mobile"`. Default is `"desktop"`.
