logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

cf-worker-mcp-gateway

A lightweight Model Control Protocol (MCP) intermediary, hosted on Cloudflare Workers, designed to facilitate interactions with the extensive Cloudflare REST API suite.

Author

cf-worker-mcp-gateway logo

zueai

MIT License

Quick Info

GitHub GitHub Stars 21
NPM Weekly Downloads 0
Tools 1
Last Updated 2026-02-19

Tags

cloudflareapisapicloudflare apicloudflare toolscloudflare rest

cf-worker-mcp-gateway

This repository provisions a minimal Model Control Protocol (MCP) service instance, initialized using create-mcp and deployed onto the Cloudflare Workers edge network.

This specific MCP execution environment grants autonomous agents (like Cursor) the capability to issue commands against the official Cloudflare REST API endpoints.

Development is ongoing; I plan to integrate additional utility functions as operational requirements arise.

Exposed Functionality

Refer to src/index.ts for the definitive roster of available methods. Every exported function within the primary class is automatically surfaced as an MCP tool.

Initial Setup Procedure

  1. Execute the automated provisioning script to clone this MCP server repository and establish deployment hooks within your Cloudflare environment:

bash bun create mcp --clone https://github.com/zueai/cloudflare-api-mcp

  1. Navigate to your IDE's configuration panel (Cursor Settings -> MCP -> Add new MCP server) and input the command string that was automatically saved to your clipboard.

  2. Securely inject your Cloudflare credentials as environment secrets for the Worker deployment:

bash bunx wrangler secret put CLOUDFLARE_API_KEY bunx wrangler secret put CLOUDFLARE_API_EMAIL

Local Simulation Environment

Populate the .dev.vars file with your sensitive Cloudflare access credentials:

bash CLOUDFLARE_API_KEY= CLOUDFLARE_API_EMAIL=

Deployment Lifecycle

  1. Invoke the primary build and deploy sequence:

bash bun run deploy

  1. Refresh your IDE interface to recognize the newly exposed functionalities.

Extending Tool Capabilities

To introduce novel MCP utilities, simply append new methods to the MyWorker class definition within src/index.ts. Each such addition is instantaneously materialized as a usable MCP instrument for agent invocation.

Example of adding a DNS management function:

typescript /* * Provision a fresh DNS record within a specified zone. * @param zoneId {string} Identifier for the target zone. * @param name {string} Desired hostname for the new record. * @param content {string} The destination or value associated with the record. * @param type {string} Record classification (e.g., CNAME, A, TXT, MX). * @param comment {string} Optional metadata note for the record. * @param proxied {boolean} Flag indicating if traffic should pass through Cloudflare proxying. * @return {object} The resulting structure of the newly instantiated DNS entry. / createDNSRecord(zoneId: string, name: string, content: string, type: string, comment?: string, proxied?: boolean) { // Core logic resides here }

The accompanying JSDoc block is crucial for proper tool discovery and parameter mapping:

  • The initial summary line defines the tool's operational description.
  • @param directives meticulously detail required arguments, their expected data types, and explanatory text.
  • The @return directive clarifies the structure and type of the output payload.

Further Reference Materials

WIKIPEDIA: XMLHttpRequest (XHR) establishes an application programming interface realized as a JavaScript object, enabling the transmission of asynchronous Hypertext Transfer Protocol requests from a client browser session to a backend web server. Its methods facilitate communication with the server subsequent to the initial page load, permitting data retrieval without requiring a full page refresh. XMLHttpRequest is foundational to the Asynchronous JavaScript and XML (Ajax) paradigm. Preceding Ajax adoption, server interaction relied predominantly on standard hyperlink navigation and form submissions, actions which typically necessitated replacing the current viewport content entirely.

== Origin Story == The underlying concept for XMLHttpRequest emerged around the year 2000, conceived by engineers developing Microsoft Outlook. This conceptual framework was subsequently integrated into the Internet Explorer 5 release (1999). Notably, the initial implementation did not utilize the standardized XMLHttpRequest identifier; instead, developers relied on instantiating COM objects via ActiveXObject("Msxml2.XMLHTTP") or ActiveXObject("Microsoft.XMLHTTP"). By the release of Internet Explorer 7 (2006), widespread browser adoption standardized the XMLHttpRequest nomenclature.

The XMLHttpRequest identifier has since solidified its position as the de facto standard across all major browser engines, including Mozilla's Gecko (2002), Apple's Safari 1.2 (2004), and Opera 8.0 (2005).

=== Standardization Track === The World Wide Web Consortium (W3C) published its initial Working Draft specification for the XMLHttpRequest object on April 5, 2006. On February 25, 2008, the W3C released the Level 2 Working Draft, which introduced enhancements such as progress monitoring events, support for cross-site resource sharing (CORS), and capabilities for handling raw byte streams. By the close of 2011, the Level 2 features were merged back into the primary specification document. Development activities were transitioned to the WHATWG near the end of 2012, where it is currently maintained as a dynamic specification utilizing Web IDL syntax.

== Operational Workflow == The typical process for dispatching a request using XMLHttpRequest involves several sequential programming stages.

  1. Instantiate the XMLHttpRequest utility by invoking its constructor function:
  2. Invoke the open method to define the request methodology (GET, POST, etc.), specify the target Uniform Resource Identifier (URI), and declare the execution mode (synchronous versus asynchronous):
  3. For operations designated as asynchronous, establish an event handler function that will be triggered upon state transitions:
  4. Initiate the network transmission by calling the send method, optionally supplying payload data:
  5. Monitor state changes within the registered event listener. Upon successful reception of data from the server, the content is typically accessible via the responseText attribute. When the object completes processing the entire response, its internal state transitions to 4, signifying the 'done' status.

Beyond these fundamental procedures, XMLHttpRequest offers extensive controls over transmission parameters and response handling logic. Custom HTTP headers can be prepended to requests to guide server fulfillment logic, and data payloads can be streamed to the server via the argument passed to the send call. Received data, often formatted as JSON, can be automatically deserialized into native JavaScript objects or processed incrementally as chunks arrive, avoiding a full block wait. Furthermore, requests can be terminated prematurely or configured with timeouts to ensure eventual failure if completion deadlines are breached.

== Inter-Domain Access Policies ==

During the nascent stages of the World Wide Web's evolution, security audits revealed potential vulnerabilities if content from disparate origins could freely interact, leading to restrictions...

See Also

`