Labsco
rayss868 logo

Web-curl

β˜… 10

from rayss868

Fetch, extract, and process web and API content. Supports resource blocking, authentication, and Google Custom Search.

πŸ”₯πŸ”₯πŸ”₯βœ“ VerifiedAccount requiredAdvanced setup

Google Custom Search API

Google Custom Search API is free with usage limits (e.g., 100 queries per day for free, with additional queries requiring payment). For full details on quotas, pricing, and restrictions, see the official documentation.

Web-curl

<div align="center">

Web-curl Logo

</div>

Developed by Rayss

πŸš€ Open Source Project
πŸ› οΈ Built with Node.js & TypeScript (Node.js v18+ required)


<div align="center">

Node.js License Status

</div>
<div align="center"> <a href="https://glama.ai/mcp/servers/@rayss868/MCP-Web-Curl"> <img width="380" height="200" src="https://glama.ai/mcp/servers/@rayss868/MCP-Web-Curl/badge" alt="Web-curl Server MCP server" /> </a> </div>

🎬 Demo Video

Watch the demo

Click here to watch the demo video directly in your browser.

If your platform supports it, you can also download and play demo/demo_1.mp4 directly.

<div align="center"> <video width="640" height="360" controls autoplay> <source src="demo/demo_1.mp4" type="video/mp4"> Your browser does not support the video tag. </video> </div>

πŸ“š Table of Contents


<a name="changelog"></a>

πŸ“ Changelog / Update History

See CHANGELOG.md for a complete history of updates and new features.

<a name="overview"></a>

πŸ“ Overview

Web-curl is a powerful tool for fetching and extracting text content from web pages and APIs. Use it as a standalone CLI or as an MCP (Model Context Protocol) server. Web-curl leverages Puppeteer for robust web scraping and supports advanced features such as resource blocking, custom headers, authentication, and Google Custom Search.


<a name="features"></a>

✨ Features

πŸš€ Deep Research & Automation (v1.4.2)

  • Advanced Browser Automation: Full control over Chromium via Puppeteer (click, type, scroll, hover, key presses).
  • Always-On Session Persistence: Browser profiles are now always persistent. Login sessions, cookies, and cache are automatically saved in a local user_data/ directory.
  • Token-Efficient Snapshots:
    • Accessibility Tree: Clean, structured snapshots instead of messy HTML.
    • HTML Slice Mode: Raw HTML with startIndex/endIndex for safe chunking when needed.
    • Viewport Filtering: Automatically filters out elements not visible on screen, saving up to 90% of context tokens on long pages.
  • Chrome DevTools Integration (implemented, but hidden from list_tools):
    • Network Monitoring (browser_network_requests)
    • Console Logs (browser_console_messages)
  • Parallel Search:
    • multi_search: Run multiple Google searches at once (only exposed search tool).
  • Intelligent Resource Management:
    • Idle Auto-Close: Browser automatically shuts down after 15 minutes of inactivity to save RAM/CPU.
    • Tab Rotation: Automatically replaces the oldest tab when the 10-tab limit is reached.
  • Media & Documents:
    • Full-Page Screenshots: Capture high-quality screenshots with a 5-day auto-cleanup lifecycle and custom destination support.
    • Document Parsing: Extract text from PDF and DOCX files directly from URLs.

Storage & Download Details

  • πŸ—‚οΈ Error log rotation: logs/error-log.txt is rotated when it exceeds ~1MB (renamed to error-log.txt.bak) to prevent unbounded growth.
  • 🧹 Logs & temp cleanup: old temporary files in the logs/ directory are cleaned up at startup.
  • πŸ›‘ Browser lifecycle: Puppeteer browser instances are closed in finally blocks to avoid Chromium temp file leaks.
  • πŸ”Ž Content extraction:
    • Returns raw text, HTML, and Readability "main article" when available. Readability attempts to extract the primary content of a webpage, removing headers, footers, sidebars, and other non-essential elements, providing a cleaner, more focused text.
    • Readability output is subject to startIndex/maxLength/chunkSize slicing when requested.
  • 🚫 Resource blocking: blockResources is now always forced to false, meaning resources are never blocked for faster page loads.
  • ⏱️ Timeout control: navigation and API request timeouts are configurable via tool arguments.
  • πŸ’Ύ Output: results can be printed to stdout or written to a file via CLI options.
  • ⬇️ Download behavior (download_file):
    • destinationFolder accepts relative paths (resolved against the project root) or absolute paths.
    • The server creates destinationFolder if it does not exist.
    • Downloads are streamed using Node streams + pipeline to minimize memory use and ensure robust writes.
    • Filenames are derived from the URL path (e.g., https://.../path/file.jpg -> file.jpg). If no filename is present, the fallback name is downloaded_file.
    • Overwrite semantics: by default the implementation will overwrite an existing file with the same name.
  • πŸ–₯️ Usage modes: CLI and MCP server (stdin/stdout transport).
  • 🌐 REST client: fetch_api returns JSON/text when appropriate and base64 for binary responses.
  • πŸ” Google Custom Search: requires APIKEY_GOOGLE_SEARCH and CX_GOOGLE_SEARCH.
  • πŸ€– Smart command:
    • Auto language detection (franc-min) and optional translation (dynamic translate import).
    • Query enrichment is heuristic-based; results depend on the detected intent.

<a name="architecture"></a>

πŸ—οΈ Architecture

This section outlines the high-level architecture of Web-curl.

graph TD
    A[User/MCP Host] --> B(CLI / MCP Server)
    B --> C{Tool Handlers}
    C -- browser_flow --> D["Puppeteer (Web Scraping)"]
    C -- fetch_api --> E["REST Client"]
    C -- multi_search --> F["Google Custom Search API"]
    C -- parse_document --> G["Document Parser (PDF/DOCX)"]
    C -- download_file --> H["File System (Downloads)"]
    D --> I["Web Content"]
    E --> J["External APIs"]
    F --> K["Google Search Results"]
    H --> L["Local Storage"]
  • CLI & MCP Server: src/index.ts Implements both the CLI entry point and the MCP server.
  • Web Scraping: Uses Puppeteer for headless browsing and content extraction.
  • REST Client: src/rest-client.ts Provides a flexible HTTP client for API requests.

<a name="installation"></a>

πŸ’‘ Examples {#examples}

<details> <summary>Make a REST API Request</summary>
{
  "name": "fetch_api",
  "arguments": {
    "url": "https://api.github.com/repos/nodejs/node",
    "method": "GET",
    "headers": {
      "Accept": "application/vnd.github.v3+json"
    },
    "limit": 10000
  }
}
</details> <details> <summary>Download File</summary>
{
  "name": "download_file",
  "arguments": {
    "url": "https://example.com/image.jpg",
    "destinationFolder": "downloads"
  }
}

Note: destinationFolder can be either a relative path (resolved against the project root) or an absolute path. The server will create the destination folder if it does not exist.

</details> <details> <summary>Configure Browser</summary>
{
  "name": "browser_configure",
  "arguments": {
    "proxy": "http://proxy.example.com:8080",
    "viewport": { "width": 1920, "height": 1080 }
  }
}

Note: Session persistence is always enabled. Cookies and login sessions are automatically stored in the user_data/ directory.

</details>

🧠 Tips & Best Practices {#tips--best-practices}

<details> <summary>Click for advanced tips</summary>
  • For large pages, use maxLength and startIndex to fetch content in slices.
  • Always validate your tool arguments to avoid errors.
  • Secure your API keys and sensitive data using environment variables.
  • Review the MCP tool schemas in src/index.ts for all available options.
</details>

🀝 Contributing & Issues {#contributing--issues}

Contributions are welcome! If you want to contribute, fork this repository and submit a pull request.
If you find any issues or have suggestions, please open an issue on the repository page.


πŸ“„ License & Attribution {#license--attribution}

This project was developed by Rayss.
For questions, improvements, or contributions, please contact the author or open an issue in the repository.


Note: Google Search API is free with usage limits. For details, see: Google Custom Search API Overview