Connect AI agents to the Cloudflare MCP server
Vendor MCP3 toolsOAuth 2.1/DCRDeveloper ToolsAutomationThe Cloudflare MCP connector routes your AI agent's tool calls to Cloudflare's own MCP server through Scalekit. Each user signs in to Cloudflare once, and Scalekit stores and refreshes their tokens, so your agent never handles credentials. It comes with 3 tools.
-
Install the SDK
Section titled “Install the SDK”Terminal window npm install @scalekit-sdk/node dotenvTerminal window pip install scalekit-sdk-python python-dotenv -
Set your credentials
Section titled “Set your credentials”Add your Scalekit credentials to your
.envfile. Find values in app.scalekit.com > Developers > API Credentials..env SCALEKIT_ENVIRONMENT_URL=<your-environment-url>SCALEKIT_CLIENT_ID=<your-client-id>SCALEKIT_CLIENT_SECRET=<your-client-secret> -
Authorize and make your first call
Section titled “Authorize and make your first call”quickstart.mts import { ScalekitClient } from '@scalekit-sdk/node'import 'dotenv/config'import { createInterface } from 'node:readline/promises'const scalekit = new ScalekitClient(process.env.SCALEKIT_ENVIRONMENT_URL,process.env.SCALEKIT_CLIENT_ID,process.env.SCALEKIT_CLIENT_SECRET,)const actions = scalekit.actionsconst connector = 'cloudfaremcp'const identifier = 'user_123'// Generate an authorization link for the userconst { link } = await actions.getAuthorizationLink({ connectionName: connector, identifier })console.log('Authorize Cloudflare MCP:', link)const rl = createInterface({ input: process.stdin, output: process.stdout })await rl.question('Press Enter after authorizing...')rl.close()// Make your first callconst result = await actions.executeTool({connector,identifier,toolName: 'cloudfaremcp_search',toolInput: { code: 'YOUR_CODE' },})console.log(result)Terminal window npx tsx quickstart.mtsquickstart.py import osfrom scalekit import ScalekitClientfrom dotenv import load_dotenvload_dotenv()scalekit_client = ScalekitClient(env_url=os.getenv("SCALEKIT_ENVIRONMENT_URL"),client_id=os.getenv("SCALEKIT_CLIENT_ID"),client_secret=os.getenv("SCALEKIT_CLIENT_SECRET"),)actions = scalekit_client.actionsconnection_name = "cloudfaremcp"identifier = "user_123"# Generate an authorization link for the userlink_response = actions.get_authorization_link(connection_name=connection_name,identifier=identifier,)print("Authorize Cloudflare MCP:", link_response.link)input("Press Enter after authorizing...")# Make your first callresult = actions.execute_tool(tool_input={"code":"YOUR_CODE"},tool_name="cloudfaremcp_search",connection_name=connection_name,identifier=identifier,)print(result)Terminal window python quickstart.py
What you can do
Section titled “What you can do”Connect this agent connector to let your agent:
- Docs records — Search the Cloudflare documentation
- Search records — Search the Cloudflare OpenAPI spec to discover API endpoints, request parameters, and response schemas
- Execute records — Execute JavaScript code against the Cloudflare API using the
cloudflare.request()helper
Tool list
Section titled “Tool list”Use the exact tool names from the Tool list below when you call execute_tool. If you’re not sure which name to use, list the tools available for the current user first.
cloudfaremcp_docs#Search the Cloudflare documentation. Use this tool to answer any question about Cloudflare products or features, including Workers, Pages, R2, Images, Stream, D1, Durable Objects, KV, Workflows, Hyperdrive, Queues, AI Search, Workers AI, Vectorize, AI Gateway, Browser Rendering, Zero Trust, Access, Tunnel, Gateway, Browser Isolation, WARP, DDOS, Magic Transit, Magic WAN, CDN, Cache, DNS, Zaraz, Argo, Rulesets, Terraform, Account and Billing. Results are returned as semantically similar chunks to the query.1 param
Search the Cloudflare documentation. Use this tool to answer any question about Cloudflare products or features, including Workers, Pages, R2, Images, Stream, D1, Durable Objects, KV, Workflows, Hyperdrive, Queues, AI Search, Workers AI, Vectorize, AI Gateway, Browser Rendering, Zero Trust, Access, Tunnel, Gateway, Browser Isolation, WARP, DDOS, Magic Transit, Magic WAN, CDN, Cache, DNS, Zaraz, Argo, Rulesets, Terraform, Account and Billing. Results are returned as semantically similar chunks to the query.
querystringrequiredCloudflare documentation search query.cloudfaremcp_execute#Execute JavaScript code against the Cloudflare API using the `cloudflare.request()` helper. Use the search tool first to discover the right endpoint path and schema.2 params
Execute JavaScript code against the Cloudflare API using the `cloudflare.request()` helper. Use the search tool first to discover the right endpoint path and schema.
codestringrequiredJavaScript async arrow function that calls `cloudflare.request()` to interact with the Cloudflare API.account_idstringoptionalYour Cloudflare account ID. Auto-selected if you only have one account.cloudfaremcp_search#Search the Cloudflare OpenAPI spec to discover API endpoints, request parameters, and response schemas. Run this before execute to find the right path and method for your operation.1 param
Search the Cloudflare OpenAPI spec to discover API endpoints, request parameters, and response schemas. Run this before execute to find the right path and method for your operation.
codestringrequiredJavaScript async arrow function that queries `spec.paths` to find matching Cloudflare API endpoints.