Skip to main content
Glama
jeffgolden

Cloudflare MCP Server

by jeffgolden

cloudflare-dns-mcp_delete_security_rule

Remove a firewall security rule by specifying the zone name and rule ID, ensuring precise management of your Cloudflare DNS and security settings.

Instructions

Delete a firewall security rule

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
rule_idYes
zone_nameYes

Implementation Reference

  • Handler function that parses input, resolves the Cloudflare zone ID from zone_name, deletes the WAF security rule by rule_id using the CloudflareClient, and returns a formatted MCP response confirming deletion.
    handler: async (params: z.infer<typeof DeleteSecurityRuleInputSchema>) => { const { zone_name, rule_id } = DeleteSecurityRuleInputSchema.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; const resp = await client.delete<{ id: string }>(`/zones/${zoneId}/firewall/rules/${rule_id}`); return { content: [ { type: "text", text: JSON.stringify({ id: resp.id ?? rule_id, deleted: true }, null, 2) } ] }; }, };
  • Zod schema defining the input parameters: zone_name (string) and rule_id (string) for the tool.
    const DeleteSecurityRuleInputSchema = z.object({ zone_name: z.string(), rule_id: z.string(), });
  • The delete_security_rule tool is registered within the tools object returned by getSecurityTools function.
    tools: { 'cloudflare-dns-mcp/list_waf_rules': listWafRulesTool, 'cloudflare-dns-mcp/create_security_rule': createSecurityRuleTool, 'cloudflare-dns-mcp/update_security_rule': updateSecurityRuleTool, 'cloudflare-dns-mcp/delete_security_rule': deleteSecurityRuleTool, }, };
  • src/index.ts:18-32 (registration)
    Higher-level registration where securityTools (including delete_security_rule) are merged into the allTools object for the MCP server.
    const dnsTools = getDnsTools(cfClient); const securityTools = getSecurityTools(cfClient); const sslCertTools = getSslCertTools(cfClient); const zoneTools = getZoneManagementTools(cfClient); const echoTools = getEchoTools(); const redirectTools = getRedirectTools(cfClient); 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