Skip to main content
Glama
jeffgolden

Cloudflare MCP Server

by jeffgolden

cloudflare-dns-mcp_list_page_rules

Retrieve and manage active or disabled redirect rules for a specified zone using structured commands, enabling efficient configuration and monitoring of Cloudflare page rules.

Instructions

List all page rules (redirects) for a zone

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
statusNo
zone_nameYes

Implementation Reference

  • Handler function that validates input using the schema, retrieves the zone ID by name, constructs a query for page rules with optional status filter, calls the Cloudflare API to list pagerules, and formats the JSON response in MCP content structure.
    handler: async (params: unknown) => { const { zone_name, status } = ListPageRulesInputSchema.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 query: any = {}; if (status) query.status = status; return { content: [ { type: "text", text: JSON.stringify(await client.get(`/zones/${zoneId}/pagerules`, query), null, 2) } ] }; },
  • Zod input schema defining required zone_name (string) and optional status (enum: 'active' or 'disabled') for filtering page rules.
    const ListPageRulesInputSchema = z.object({ zone_name: z.string(), status: z.enum(['active','disabled']).optional() });
  • Local registration of the tool under its name in the getRedirectTools() function's returned tools object, which is later imported and spread into the global tools map in src/index.ts.
    'cloudflare-dns-mcp/list_page_rules': listPageRulesTool,
  • src/index.ts:25-30 (registration)
    Global aggregation of all tools including redirect tools (containing list_page_rules) into allTools object before mapping to sanitized names and registering with MCP server handlers.
    const allTools = { ...dnsTools.tools, ...securityTools.tools, ...sslCertTools.tools, ...echoTools.tools, ...redirectTools.tools,

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