Skip to main content
Glama
jeffgolden

Cloudflare MCP Server

by jeffgolden

cloudflare-dns-mcp_delete_dns_record

Remove a DNS record from a specified zone using its unique ID, enabling streamlined DNS management within the Cloudflare MCP Server.

Instructions

Delete a DNS record by ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
record_idYes
zone_nameYes

Implementation Reference

  • The core handler function that validates input parameters, looks up the zone ID from the zone name, and performs the DELETE request to Cloudflare's DNS records API endpoint.
    handler: async (params: z.infer<typeof DeleteDnsRecordInputSchema>) => { const { zone_name, record_id } = DeleteDnsRecordInputSchema.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}/dns_records/${record_id}`); return { content: [ { type: "text", text: JSON.stringify({ success: true, id: record_id }, null, 2) } ] }; },
  • Zod input schema defining required parameters: zone_name (string) and record_id (string). Converted to JSON schema for the tool's inputSchema.
    const DeleteDnsRecordInputSchema = z.object({ zone_name: z.string(), record_id: z.string() });
  • Local registration of the tool object in the getDnsTools() return value using the slash-separated name.
    'cloudflare-dns-mcp/delete_dns_record': deleteDnsRecordTool,
  • src/index.ts:18-32 (registration)
    Main server registration: calls getDnsTools and spreads DNS tools into the combined allTools map used for MCP server toolset.
    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>;
  • Helper function that sanitizes tool names, replacing '/' with '_', creating the exact queried name 'cloudflare-dns-mcp_delete_dns_record' from 'cloudflare-dns-mcp/delete_dns_record'.
    const safeName = tool.name.replace(/[^a-zA-Z0-9_-]/g, '_'); toolsMap[safeName] = tool; }

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