Web Content MCP Server
Cloudflareブラウザレンダリング実験とMCPサーバー
このプロジェクトでは、Cloudflare Browser Renderingを用いてLLMコンテキスト用のWebコンテンツを抽出する方法を紹介します。REST APIとWorkers Binding APIを用いた実験に加え、LLMにWebコンテキストを提供するために使用できるMCPサーバー実装も含まれています。
プロジェクト構造
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
前提条件
Node.js (v16以降)
ブラウザレンダリングが有効になっているCloudflareアカウント
タイプスクリプト
Wrangler CLI (ワーカーのデプロイ用)
インストール
リポジトリをクローンします。
git clone https://github.com/yourusername/cloudflare-browser-rendering.git
cd cloudflare-browser-rendering依存関係をインストールします:
npm installCloudflareワーカーのセットアップ
Cloudflare Puppeteer パッケージをインストールします。
npm install @cloudflare/puppeteerWrangler を設定します。
# 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ワーカーをテストする:
node test-puppeteer.js実験の実行
基本的なREST API実験
この実験では、Cloudflare ブラウザ レンダリング REST API を使用して Web コンテンツを取得および処理する方法を示します。
npm run experiment:restPuppeteer バインディング API 実験
この実験では、より高度なブラウザ自動化を実現するために、Puppeteer で Cloudflare Browser Rendering Workers Binding API を使用する方法を示します。
npm run experiment:puppeteerコンテンツ抽出実験
この実験では、LLM のコンテキストとして使用するために Web コンテンツを抽出して処理する方法を示します。
npm run experiment:contentMCPサーバー
MCP サーバーは、LLM のコンテキストとして使用するために、Cloudflare ブラウザ レンダリングを使用して Web コンテンツを取得および処理するためのツールを提供します。
MCPサーバーの構築
npm run buildMCPサーバーの実行
npm startあるいは、開発の場合:
npm run devMCP サーバーツール
MCP サーバーは次のツールを提供します。
fetch_page- LLMコンテキストのWebページを取得して処理しますsearch_documentation- Cloudflareのドキュメントを検索し、関連するコンテンツを返しますextract_structured_content- CSSセレクターを使用してWebページから構造化コンテンツを抽出しますsummarize_content- LLM コンテキストをより簡潔にするために Web コンテンツを要約します
構成
Cloudflare ブラウザ レンダリング エンドポイントを使用するには、 BROWSER_RENDERING_API環境変数を設定します。
export BROWSER_RENDERING_API=https://YOUR_WORKER_URL_HEREYOUR_WORKER_URL_HERE 、デプロイしたCloudflare WorkerのURLに置き換えてください。このプレースホルダは、以下のファイルで置き換える必要があります。
テストファイル内:
test-puppeteer.js、examples/debugging-tools/debug-test.js、examples/testing/content-test.jsMCP サーバー構成:
cline_mcp_settings.json.exampleブラウザクライアントの場合:
src/browser-client.ts(環境変数が設定されていない場合のフォールバックとして)
Clineとの統合
MCP サーバーを Cline と統合するには、 cline_mcp_settings.json.exampleファイルを適切な場所にコピーします。
cp cline_mcp_settings.json.example ~/Library/Application\ Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.jsonまたは、既存のcline_mcp_settings.jsonファイルに構成を追加します。
主な学び
Cloudflare ブラウザ レンダリングでは、ブラウザ バインディングと対話するために
@cloudflare/puppeteerパッケージが必要です。ブラウザ バインディングを使用する正しいパターンは次のとおりです。
import puppeteer from '@cloudflare/puppeteer'; // Then in your handler: const browser = await puppeteer.launch(env.browser); const page = await browser.newPage();ブラウザ レンダリング バインディングを使用するワーカーをデプロイする場合は、
nodejs_compat互換性フラグを有効にする必要があります。リソースの漏洩を防ぐため、使用後は必ずブラウザを閉じてください。
ライセンス
マサチューセッツ工科大学
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-