Web Content MCP Server
Experimentos de renderizado del navegador Cloudflare y servidor MCP
Este proyecto demuestra cómo usar la renderización del navegador de Cloudflare para extraer contenido web para el contexto LLM. Incluye experimentos con la API REST y la API de enlace de trabajadores, así como una implementación de servidor MCP que puede utilizarse para proporcionar contexto web a los LLM.
Estructura del proyecto
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 LicenseRelated MCP server: MCP Web Tools Server
Prerrequisitos
Node.js (v16 o posterior)
Una cuenta de Cloudflare con la representación del navegador habilitada
Mecanografiado
CLI de Wrangler (para implementar el trabajador)
Instalación
Clonar el repositorio:
git clone https://github.com/yourusername/cloudflare-browser-rendering.git
cd cloudflare-browser-renderingInstalar dependencias:
npm installConfiguración de Cloudflare Worker
Instalar el paquete Puppeteer de Cloudflare:
npm install @cloudflare/puppeteerConfigurar Wrangler:
# wrangler.toml
name = "browser-rendering-api"
main = "puppeteer-worker.js"
compatibility_date = "2023-10-30"
compatibility_flags = ["nodejs_compat"]
[browser]
binding = "browser"Implementar el trabajador:
npx wrangler deployPon a prueba al trabajador:
node test-puppeteer.jsEjecución de los experimentos
Experimento básico de API REST
Este experimento demuestra cómo utilizar la API REST de representación del navegador de Cloudflare para obtener y procesar contenido web:
npm run experiment:restExperimento de API de enlace de Puppeteer
Este experimento demuestra cómo usar la API de enlace de trabajadores de representación del navegador de Cloudflare con Puppeteer para una automatización más avanzada del navegador:
npm run experiment:puppeteerExperimento de extracción de contenido
Este experimento demuestra cómo extraer y procesar contenido web específicamente para su uso como contexto en LLM:
npm run experiment:contentServidor MCP
El servidor MCP proporciona herramientas para obtener y procesar contenido web mediante Cloudflare Browser Rendering para su uso como contexto en LLM.
Construyendo el servidor MCP
npm run buildEjecución del servidor MCP
npm startO, para el desarrollo:
npm run devHerramientas del servidor MCP
El servidor MCP proporciona las siguientes herramientas:
fetch_page: obtiene y procesa una página web para el contexto LLMsearch_documentation: busca la documentación de Cloudflare y devuelve contenido relevante.extract_structured_content: extrae contenido estructurado de una página web mediante selectores CSSsummarize_content- Resume el contenido web para un contexto LLM más conciso
Configuración
Para utilizar el punto final de representación del navegador de Cloudflare, configure la variable de entorno BROWSER_RENDERING_API :
export BROWSER_RENDERING_API=https://YOUR_WORKER_URL_HEREReemplace YOUR_WORKER_URL_HERE con la URL de su Cloudflare Worker implementado. Deberá reemplazar este marcador de posición en varios archivos:
En los archivos de prueba:
test-puppeteer.js,examples/debugging-tools/debug-test.js,examples/testing/content-test.jsEn la configuración del servidor MCP:
cline_mcp_settings.json.exampleEn el cliente del navegador:
src/browser-client.ts(como alternativa si la variable de entorno no está configurada)
Integración con Cline
Para integrar el servidor MCP con Cline, copie el archivo cline_mcp_settings.json.example en la ubicación adecuada:
cp cline_mcp_settings.json.example ~/Library/Application\ Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.jsonO agregue la configuración a su archivo cline_mcp_settings.json existente.
Aprendizajes clave
La representación del navegador de Cloudflare requiere el paquete
@cloudflare/puppeteerpara interactuar con el enlace del navegador.El patrón correcto para utilizar el enlace del navegador es:
import puppeteer from '@cloudflare/puppeteer'; // Then in your handler: const browser = await puppeteer.launch(env.browser); const page = await browser.newPage();Al implementar un Worker que utiliza el enlace de representación del navegador, debe habilitar el indicador de compatibilidad
nodejs_compat.Cierre siempre el navegador después de usarlo para evitar fugas de recursos.
Licencia
Instituto Tecnológico de Massachusetts (MIT)
Available Tools
4 toolsextract_structured_contentC
Extracts structured content from a web page using CSS selectors
Inputs: selectors (required), url (required).
fetch_pageC
Fetches and processes a web page for LLM context
Inputs: url (required), includeScreenshot, maxContentLength.
search_documentationC
Searches Cloudflare documentation and returns relevant content
Inputs: query (required), maxResults.
summarize_contentC
Summarizes web content for more concise LLM context
Inputs: url (required), maxLength.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
The tools are mostly distinct in purpose, with extract_structured_content, fetch_page, and summarize_content each handling different aspects of web content processing. However, fetch_page and summarize_content could be slightly confused as both relate to processing web content for LLM context, though their specific focuses differ.
All tool names follow a consistent verb_noun pattern with snake_case, such as extract_structured_content and fetch_page. This uniformity makes the set predictable and easy to understand, with no deviations in naming conventions.
With 4 tools, the count is on the lower side for a web content server, which might feel thin for covering a broad domain like web content processing. However, it is reasonable for a focused set, though it could benefit from additional tools for more comprehensive coverage.
There are significant gaps in the tool surface for web content processing. For example, there are no tools for updating or deleting content, handling dynamic content like JavaScript, or managing multiple pages. The inclusion of search_documentation is also inconsistent with the general web content focus, creating a notable gap in core operations.
Maintenance
Related MCP Connectors
Cloud browser, web extraction, screenshots, and remote CDP tools for AI agents.
Web search and any page as LLM-ready Markdown for AI agents. Free keyless tier, no signup.
Hosted browser for agents: open pages, search the web, extract data, read PDFs and take screenshots.
Web scraping, search, crawling, structured extraction and research for AI agents.
Related MCP Servers
- AlicenseBqualityDmaintenanceA server that enables browser automation using Playwright, allowing interaction with web pages, capturing screenshots, and executing JavaScript in a browser environment through LLMs.1213,391 npm1MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that allows LLMs to interact with web content through standardized tools, currently supporting web scraping functionality.1MIT
- AlicenseAqualityDmaintenanceThis MCP server provides tools for interacting with Cloudflare Browser Rendering, allowing you to fetch and process web content for use as context in LLMs directly from Cline or Claude Desktop.511MIT
- FlicenseNot gradedqualityDmaintenanceA server that enables AI systems to browse, retrieve content from, and interact with web pages through the Model Context Protocol.1-