# ClearFetch - Comprehensive Technical Specification & LLM Reference > ClearFetch is an unblocked web access layer and Model Context Protocol (MCP) server engineered specifically for AI Agents, LLMs, and automated scraping workflows. ## 1. System Overview ClearFetch provides real-time access to the live web without 403 Forbidden errors, CAPTCHA hurdles, or Cloudflare Turnstile blocks. It converts live, JS-rendered HTML into clean, token-optimized Markdown, strictly-typed JSON schemas, and crisp PNG/JPEG/WebP screenshots. ### Primary Distribution Channels - Web Portal: https://clearfetch.dev - Web Screenshot API: https://clearfetch.dev/screenshot - REST API Base: https://api.clearfetch.dev - npm MCP Package: https://www.npmjs.com/package/clearfetch (`npx -y clearfetch`) - PyPI Client Package: https://pypi.org/project/clearfetch (`pip install clearfetch`) - n8n Community Node: https://www.npmjs.com/package/n8n-nodes-clearfetch - GitHub Repository: https://github.com/zenkdom/clearfetch --- ## 2. Model Context Protocol (MCP) Server ClearFetch implements the standard Model Context Protocol (MCP) over `stdio`. It runs with Node.js 18+ and requires no manual compilation when invoked through `npx`. ### 2.1 Configuration #### Claude Desktop (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS or `%APPDATA%\Claude\claude_desktop_config.json` on Windows): ```json { "mcpServers": { "clearfetch": { "command": "npx", "args": ["-y", "clearfetch"], "env": { "CLEARFETCH_API_KEY": "cf_live_your_api_key_here" } } } } ``` #### Cursor IDE (`.cursor/mcp.json`): ```json { "mcpServers": { "clearfetch": { "command": "npx", "args": ["-y", "clearfetch"], "env": { "CLEARFETCH_API_KEY": "cf_live_your_api_key_here" } } } } ``` ### 2.2 Tool Definitions #### Tool: `clearfetch_read` Fetches a target web page, renders client-side JavaScript, solves any bot challenges (Cloudflare Turnstile, DataDome, Akamai), and strips out navigation bars, footers, scripts, tracking pixels, and ads to return clean, LLM-optimized Markdown. - **Input Schema:** - `url` (string, required): Full HTTP/HTTPS URL of the target page. - `stealth` (string, optional, default: `"auto"`): Proxy mode: `"auto"` (standard with automatic anti-bot escalation) or `"force"` (always route through stealth residential proxies). - `max_age` (integer, optional, default: `3600`): Cache TTL in seconds (`0` bypasses cache). - `include_links` (boolean, optional, default: `true`): Include extracted page links in the response. - `only_main_content` (boolean, optional, default: `true`): Strip boilerplate navbars, footers, and ads. - **Output:** Markdown text formatted with headers, lists, code blocks, and primary textual content. #### Tool: `clearfetch_extract` Extracts structured JSON data conforming to a developer-specified JSON schema directly from a live web page. - **Input Schema:** - `url` (string, required): Full URL of the webpage to extract from. - `json_schema` (object, required): Valid JSON Schema describing the target data model. - `prompt` (string, optional): Specific instructions or extraction focus for the parser. - `stealth` (string, optional, default: `"auto"`): Proxy mode (`"auto"` or `"force"`). - **Output:** Validated JSON object adhering exactly to the provided schema. #### Tool: `clearfetch_search` Searches the web for real-time information and returns parsed Markdown summaries of the top matching results. - **Input Schema:** - `query` (string, required): Keyword search query. - `limit` (number, optional, default: `5`): Maximum number of search results to return (1-10). - **Output:** Array of search result objects containing title, URL, and clean content snippet. #### Tool: `clearfetch_screenshot` Captures a pixel-perfect PNG, JPEG, or WebP screenshot of any target URL using a stealth Chromium browser with Cloudflare/DataDome bypass and ad/cookie-banner blocking. - **Input Schema:** - `url` (string, required): Full HTTP/HTTPS URL of the target page. - `format` (string, optional, default: `"png"`): `"png"`, `"jpeg"`, or `"webp"`. - `quality` (integer, optional, default: `85`): Compression quality (1-100) for JPEG/WebP. - `full_page` (boolean, optional, default: `false`): Capture full scrollable height. - `width` / `height` (integer, optional, default: `1440` / `900`): Viewport dimensions. - `device_scale_factor` (number, optional, default: `1.0`): HiDPI/Retina scale (1-3). - `is_mobile` (boolean, optional, default: `false`): Mobile viewport & touch emulation. - `dark_mode` (boolean, optional, default: `false`): Dark color-scheme emulation. - `block_ads` (boolean, optional, default: `true`): Block ads and cookie banners. - `selector` (string, optional): CSS selector to crop tightly around an element. - `wait_for_selector` (string, optional): CSS selector to wait for before capture. - **Output:** Native MCP image content block plus metadata (dimensions, format, byte size, latency). --- ## 3. REST API Specification ### Authentication Requests to `https://api.clearfetch.dev` must pass an API key via the `Authorization` header: ```http Authorization: Bearer cf_live_... ``` ### Endpoints #### POST `/v1/read` Fetch and convert a URL into token-optimized Markdown (1 credit standard, 3 stealth; **0 credits on blocked or failed requests**). - **Request Headers:** - `Content-Type: application/json` - `Authorization: Bearer ` - **Request Body:** ```json { "url": "https://example.com/article", "stealth": "auto", "max_age": 3600, "only_main_content": true, "include_links": true } ``` - **Response (200 OK):** ```json { "success": true, "url": "https://example.com/article", "title": "Article Title", "markdown": "# Article Title\n\nArticle body content...", "links": [], "metadata": { "status_code": 200, "cached": false, "stealth_used": false, "estimated_tokens": 185, "latency_ms": 210, "credits_used": 1 } } ``` #### POST `/v1/extract` AI-driven structured data extraction using your natural-language prompt and strict JSON Schema validation (3 credits on success, **0 credits on error or schema failure**). - **Request Body:** ```json { "url": "https://example.com/product/123", "prompt": "Extract product name, retail price in USD, and stock availability", "stealth": "auto", "json_schema": { "type": "object", "properties": { "product_name": {"type": "string"}, "price": {"type": "number"}, "in_stock": {"type": "boolean"} }, "required": ["product_name", "price"] } } ``` - **Response (200 OK):** ```json { "success": true, "url": "https://example.com/product/123", "data": { "product_name": "Premium Keyboard", "price": 149.99, "in_stock": true }, "metadata": { "status_code": 200, "cached": false, "stealth_used": false, "estimated_tokens": 120, "latency_ms": 480, "credits_used": 3 } } ``` #### POST `/v1/screenshot` (and GET `/v1/screenshot`) Capture a full-page, viewport, mobile, dark-mode, or element-cropped screenshot in PNG, JPEG, or WebP (3 credits on success, 0 credits on errors). - **Request Body:** ```json { "url": "https://example.com", "format": "png", "full_page": true, "width": 1440, "height": 900, "dark_mode": true, "block_ads": true, "response_type": "json" } ``` - **Response (200 OK, `response_type: "json"`):** ```json { "success": true, "url": "https://example.com", "final_url": "https://example.com/", "page_title": "Example Domain", "format": "png", "mime_type": "image/png", "width": 1440, "height": 900, "full_page": true, "size_bytes": 84120, "image_base64": "iVBORw0KGgo...", "data_uri": "data:image/png;base64,iVBORw0KGgo...", "metadata": { "status_code": 200, "cached": false, "stealth_used": true, "latency_ms": 1150, "credits_used": 3 } } ``` #### GET `/v1/usage` Check account credit balance, active subscription plan, concurrency/rate limits, and recent request logs. - **Response (200 OK):** ```json { "credits_balance": 9840, "plan_tier": "starter", "concurrency_limit": 10, "rate_limit_per_min": 120, "recent_logs": [] } ``` --- ## 4. Python SDK (`clearfetch`) ### Installation ```bash pip install clearfetch ``` ### Basic Scraping, AI Extraction & Screenshots ```python from clearfetch import ClearFetch client = ClearFetch(api_key="cf_live_...") doc = client.read("https://en.wikipedia.org/wiki/Artificial_intelligence") print("Title:", doc.title) print("Markdown:\n", doc.markdown) extracted = client.extract( url="https://quotes.toscrape.com/", prompt="Extract the top 2 quotes and authors", json_schema={"type": "object", "properties": {"quotes": {"type": "array"}}, "required": ["quotes"]}, ) print("Extracted JSON:", extracted.data) shot = client.screenshot( "https://example.com", format="png", full_page=True, dark_mode=True, output_path="screenshot.png" ) print(f"Captured {shot.width}x{shot.height} ({shot.size_bytes} bytes)") ``` ### LangChain Integration ```python from clearfetch.integrations.langchain import ClearFetchLoader loader = ClearFetchLoader( urls=["https://docs.anthropic.com/en/docs/welcome"], api_key="cf_live_..." ) documents = loader.load() print(documents[0].page_content) ``` --- ## 5. Pricing & Credit Costs | Plan | Monthly Fee | Monthly Credits | Concurrency | Rate Limit | Residential Solvers | |---|---|---|---|---|---| | **Free** | $0 | 500 (one-time on signup) | 5 streams | 60 req/min | Standard | | **Starter** | $19 / 30 days | 10,000 | 10 streams | 120 req/min | Priority Turnstile | | **Growth** | $79 / 30 days | 60,000 | 20 streams | 300 req/min | Full Residential Bypass | | **Scale** | $249 / 30 days | 250,000 | 50 streams | 1,000 req/min | Dedicated Priority Solvers | Zero-Risk Credit Guarantee: - Failed requests, `403` / WAF anti-bot blocks, timeouts, and upstream HTTP errors always deduct **0 credits** across every plan. Payment Options: - Credit Card / Debit Card / PayPal - Cryptocurrency: USDT (TRC-20, ERC-20), TON, SOL, BTC, ETH via TryBit gateway. - Subscriptions run on a 30-day fixed period with email reminders at T-3 days and zero surprise recurring charges. --- ## 6. Contact & Support - Technical Support: support@clearfetch.dev - Documentation: https://clearfetch.dev/docs - API Health Check: https://api.clearfetch.dev/health