Cloudflare Browser Rendering

by amotivv

4 stars
473 downloads
Not rated
GitHub

About

Integrates with Cloudflare's Browser Rendering API to enable web scraping and screenshot capture using Puppeteer for dynamic content processing and automated visual testing.

Details

Author
amotivv
Repository
amotivv/cloudflare-browser-rendering
GitHub stars
4
Downloads
473
License
MIT License
Categories
Productivity, Design, Developer Tools, API, Automation, Frontend, Web Scraping

- Demonstrates Cloudflare Browser Rendering for LLM context
- Includes REST API and Workers Binding API experiments
- Provides an MCP server with four tools
- Tools: fetch_page, search_documentation, extract_structured_content, summarize_content
- Integrates with Cline via MCP settings

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Cloudflare Browser Rendering
    Command (node, npx, python, etc.) npx
    Arguments
    • Argument 1 -y
    • Argument 2 @highlight/mcp-server

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

To use your Cloudflare Browser Rendering endpoint, set the BROWSER_RENDERING_API environment variable:

export BROWSER_RENDERING_API=https://YOUR_WORKER_URL_HERE

Replace YOUR_WORKER_URL_HERE with the URL of your deployed Cloudflare Worker. You'll need to replace this placeholder in several files:

1. In test files: test-puppeteer.js, examples/debugging-tools/debug-test.js, examples/testing/content-test.js
2. In the MCP server configuration: cline_mcp_settings.json.example
3. In the browser client: src/browser-client.ts (as a fallback if the environment variable is not set)

1. Install the Cloudflare Puppeteer package:

npm install @cloudflare/puppeteer

2. Configure Wrangler:


bash npm start

Or, for development:

bash
npm run dev
```

fetch_page

Fetches and processes a web page for LLM context.

search_documentation

Searches Cloudflare documentation and returns relevant content.

extract_structured_content

Extracts structured content from a web page using CSS selectors.

summarize_content

Summarizes web content for more concise LLM context.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "cloudflare browser rendering": {
            "env": {},
            "args": [
                "-y",
                "@highlight/mcp-server"
            ],
            "command": "npx"
        }
    }
}

Linux

{
    "env": [],
    "args": [
        "-y",
        "@highlight/mcp-server"
    ],
    "command": "npx"
}

Macos

{
    "env": [],
    "args": [
        "-y",
        "@highlight/mcp-server"
    ],
    "command": "npx"
}

Windows

{
    "env": [],
    "args": [
        "/c",
        "npx",
        "-y",
        "@highlight/mcp-server"
    ],
    "command": "cmd"
}

Cloudflare Browser Rendering Experiments & MCP Server

This project demonstrates how to use Cloudflare Browser Rendering to extract web content for LLM context. It includes experiments with the REST API and Workers Binding API, as well as an MCP server implementation that can be used to provide web context to LLMs.

<a href="https://glama.ai/mcp/servers/wg9fikq571">
Web Content Server MCP server
</a>

Project Structure

cloudflare-browser-rendering/
├── examples/                   # Example implementations and utilities
│   ├── basic-worker-example.js # Basic Worker with Browser Rendering
│   ├── minimal-worker-example.js # Minimal implementation
│   ├── debugging-tools/        # Tools for debugging
│   │   └── debug-test.js       # Debug test utility
│   └── testing/                # Testing utilities
│       └── content-test.js     # Content testing utility
├── experiments/                # Educational experiments
│   ├── basic-rest-api/         # REST API tests
│   ├── puppeteer-binding/      # Workers Binding API tests
│   └── content-extraction/     # Content processing tests
├── src/                        # MCP server source code
│   ├── index.ts                # Main entry point
│   ├── server.ts               # MCP server implementation
│   ├── browser-client.ts       # Browser Rendering client
│   └── content-processor.ts    # Content processing utilities
├── puppeteer-worker.js         # Cloudflare Worker with Browser Rendering binding
├── test-puppeteer.js           # Tests for the main implementation
├── wrangler.toml               # Wrangler configuration for the Worker
├── cline_mcp_settings.json.example # Example MCP settings for Cline
├── .gitignore                  # Git ignore file
└── LICENSE                     # MIT License

Prerequisites

- Node.js (v16 or later)
- A Cloudflare account with Browser Rendering enabled
- TypeScript
- Wrangler CLI (for deploying the Worker)

Installation

1. Clone the repository:

git clone https://github.com/yourusername/cloudflare-browser-rendering.git
cd cloudflare-browser-rendering

2. Install dependencies:

npm install

Cloudflare Worker Setup

1. Install the Cloudflare Puppeteer package:

npm install @cloudflare/puppeteer

2. Configure Wrangler:

```toml

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.