Skip to main content
Glama
jeffgolden

Cloudflare MCP Server

by jeffgolden

cloudflare-dns-mcp_delete_page_rule

Delete a Cloudflare page rule by specifying the zone name and rule ID to manage DNS, security, or redirection settings efficiently.

Instructions

Delete a page rule by ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
rule_idYes
zone_nameYes

Implementation Reference

  • The main handler function that parses input, resolves the zone ID via Cloudflare API, deletes the page rule, and returns a confirmation in MCP format.
    handler: async (params: unknown) => { const { zone_name, rule_id } = DeletePageRuleInputSchema.parse(params); const zones = await client.get<Array<{ id: string; name: string }>>('/zones', { name: zone_name }); if (zones.length === 0) throw new Error(`Zone ${zone_name} not found`); const zoneId = zones[0].id; await client.delete(`/zones/${zoneId}/pagerules/${rule_id}`); return { content: [ { type: "text", text: JSON.stringify({ id: rule_id, deleted: true }, null, 2) } ] }; },
  • Zod input schema definition and JSON schema for input/output, including tool name and description.
    const DeletePageRuleInputSchema = z.object({ zone_name: z.string(), rule_id: z.string() }); const deletePageRuleTool: Tool = { name: 'cloudflare-dns-mcp/delete_page_rule', description: 'Delete a page rule by ID', inputSchema: zodToJsonSchema(DeletePageRuleInputSchema) as any, outputSchema: { type: 'object', properties: { id: { type: 'string' }, deleted: { type: 'boolean' } }, required: ['id', 'deleted'], } as any,
  • Registration of the tool in the module's tools record, returned by getRedirectTools.
    return { tools: { 'cloudflare-dns-mcp/list_page_rules': listPageRulesTool, 'cloudflare-dns-mcp/create_redirect': createRedirectTool, 'cloudflare-dns-mcp/delete_page_rule': deletePageRuleTool, } };
  • src/index.ts:25-32 (registration)
    Global registration where redirect tools (including delete_page_rule) are merged into the allTools object used by the MCP server.
    const allTools = { ...dnsTools.tools, ...securityTools.tools, ...sslCertTools.tools, ...echoTools.tools, ...redirectTools.tools, ...zoneTools.tools, } as Record<string, any>;

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jeffgolden/cloudflare_mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server