What is this?
The Cloudflare MCP Server is an open-source implementation of the Multi-Cloud Proxy protocol on Cloudflare Workers, allowing AI agents and LLMs to interact securely and efficiently with web content at the edge. It packages web scraping, API proxying, and edge compute functions into a standardized interface that leverages Cloudflare’s global network for ultra-low latency and high throughput.
Incoming MCP protocol requests are received at a Worker HTTP endpoint, authenticated via JWT or API key, and routed to specialized sub-workers for generic HTTP proxying, headless scraping with Puppeteer, API translation, or content transformation. This vendor-neutral, MCP-compliant gateway provides edge-level performance, built-in DDoS protection, and automatic scaling, making it ideal for real-time data extraction and distributed automation.
Quick Start
Install the server using npm:
npm install @modelcontextprotocol/server-cloudflare-mcp-server
Then add it to your MCP client configuration:
{
"mcpServers": {
"cloudflare-mcp-server": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-cloudflare-mcp-server"],
"env": {
"API_KEY": "your-api-key-here"
}
}
}
}
Key Features
Edge-level Performance: Deploy scraping and proxy logic at 200+ global POPs for sub-50ms response times, ensuring low-latency data access.
Security by Design: Leverage Cloudflare’s DDoS protection, token-based authentication, TLS termination, and automatic header sanitization for robust security.
Standardized MCP Interface: Fully compliant with MCP spec v1+, enabling seamless integration with any MCP-aware client or orchestration framework.
Example Usage
Use the fetchPage tool to retrieve the HTML of a static web page:
// Example code
const result = await client.callTool({
name: "fetchPage",
arguments: {
sessionId: "session-123",
resourceType: "page",
parameters: { url: "https://example.com" }
}
});
This code sends a POST request to the MCP endpoint for fetchPage, returning the page HTML in result.data.html for further processing.
Configuration
The server accepts the following environment variables:
API_KEY – Your Cloudflare MCP API key used for authenticating requests.
SETTING_1 (optional) – Enable OAuth2 handshake when set to true.
Available Tools/Resources
cookieJar: Manage cookies across requests, including setCookie and getCookies operations.
rateLimit: Configure per-session or global rate limits to control request throughput.
Who Should Use This?
This server is perfect for:
AI developers: Building agentic workflows that require real-time web data and distributed automation.
Web automation teams: Needing a secure, scalable edge proxy for high-volume scraping and API interactions.
Edge computing architects: Looking to offload infrastructure complexity and leverage global POPs for low-latency tasks.
Conclusion
Cloudflare MCP Server combines edge-native web scraping, API proxying, and content transformation into a single, MCP-compliant package. With global performance, robust security, and a standardized interface, it simplifies building AI-driven workflows at scale.
Check out the GitHub repository for more information and to contribute.