Explore Cloudflare Browser Rendering and MCP server for web content extraction and LLM integration
The Cloudflare Browser Rendering Experiments & MCP Server project demonstrates how to integrate Cloudflare's Browser Rendering APIs into artificial intelligence (AI) applications. This server implements Model Context Protocol (MCP), a standardized protocol enabling AI tools and applications to connect with specific data sources and tools through a unified interface. The experiments included within this repository showcase various methods of leveraging these APIs, from basic Worker examples to more advanced content extraction techniques.
This MCP server provides several key features that enhance the integration of web content into AI applications:
The server implements the Model Context Protocol (MCP) infrastructure to enable seamless interaction between various AI applications. The protocol defines standard methods for exchanging context-specific content, such as search results, structured data, and web page snippets.
graph TD
A[AI Application] -->|MCP Client| B[MCP Protocol]
B --> C[MCP Server]
C --> D[Data Source/Tool]
style A fill:#e1f5fe
style C fill:#f3e5f5
style D fill:#e8f5e8
This diagram illustrates the exchange of data between an AI application (MCP Client), the MCP protocol, a web content server implementation, and external data sources.
To get started with setting up this MCP server, follow these steps:
Clone the Repository:
git clone https://github.com/yourusername/cloudflare-browser-rendering.git
cd cloudflare-browser-rendering
Install Dependencies:
npm install
Set Up Cloudflare Worker:
npm install @cloudflare/puppeteer
# wrangler.toml
name = "browser-rendering-api"
main = "puppeteer-worker.js"
compatibility_date = "2023-10-30"
compatibility_flags = ["nodejs_compat"]
[browser]
binding = "browser"
npx wrangler deploy
Test the Worker:
node test-puppeteer.js
Suppose you are working with Claude Desktop, an advanced language model that requires context from various websites. By integrating this MCP server, you can automatically fetch and process relevant web content:
npm run experiment:content
This script runs a series of tests to extract structured data using CSS selectors.
Integrating the Puppeteer Binding API allows more advanced automation scenarios. For instance, Continue could benefit from dynamic search queries and content scraping:
npm run experiment:puppeteer
This command demonstrates leveraging Puppeteer to automate browser actions and process web pages.
The Cloudflare Browser Rendering Experiments & MCP Server is compatible with several popular AI applications such as Claude Desktop, Continue, Cursor, and others. The MCP client compatibility matrix lists these tools:
MCP Client | Resources | Tools | Prompts | Status |
---|---|---|---|---|
Claude Desktop | ✅ | ✅ | ✅ | Full Support |
Continue | ✅ | ✅ | ✅ | Full Support |
Cursor | ❌ | ✅ | ❌ | Tools Only |
This matrix indicates compatibility in terms of resources, tools, and prompts. Tools are fully supported by the server configuration.
To ensure optimal performance and compatibility, consider the following:
{
"mcpServers": {
"[server-name]": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-[name]"],
"env": {
"API_KEY": "your-api-key"
}
}
}
}
You can configure the server to enhance security and performance:
Example of setting an environment variable:
export BROWSER_RENDERING_API=https://YOUR_WORKER_URL_HERE
To integrate the MCP server with Claude Desktop, follow the installation steps and ensure that you have configured the necessary environment variables.
Yes, most tools are fully supported. However, some may require additional configuration depending on their specific requirements.
The service has been optimized to minimize latency and ensure swift delivery of content. Performance tests have demonstrated minimal overhead costs.
Communication uses HTTPS by default, ensuring that data transmission remains secure during interaction with the cloudflare worker.
Yes, while this initial version supports a limited set of clients, you can extend the configuration to include additional platforms as needed.
If you wish to contribute to or develop with this project:
Explore more about Model Context Protocol and integrations with various tools:
By leveraging this cloudflare-based solution, you can enhance your AI application's ability to fetch and process web content efficiently.
RuinedFooocus is a local AI image generator and chatbot image server for seamless creative control
Simplify MySQL queries with Java-based MysqlMcpServer for easy standard input-output communication
Learn to set up MCP Airflow Database server for efficient database interactions and querying airflow data
Build stunning one-page websites track engagement create QR codes monetize content easily with Acalytica
Explore CoRT MCP server for advanced self-arguing AI with multi-LLM inference and enhanced evaluation methods
Access NASA APIs for space data, images, asteroids, weather, and exoplanets via MCP integration