-
Notifications
You must be signed in to change notification settings - Fork 353
Description
Feature Request
Add tools to query Cloudflare Analytics (GraphQL) for Workers sites through the MCP — specifically visitor IP addresses, request paths, country of origin, and timestamps.
Use Case
When managing a Cloudflare Workers site via the MCP, there's no way to see who's visiting the site. I had to drop out to a raw curl against the GraphQL Analytics API to get basic visitor data:
{ viewer { zones(filter: {zoneTag: "..."}) {
httpRequestsAdaptiveGroups(
filter: {datetime_gt: "2026-03-15T22:00:00Z", requestSource: "eyeball"},
limit: 100,
orderBy: [datetime_ASC]
) {
dimensions { datetime clientIP clientRequestHTTPHost clientRequestPath clientCountryName }
}
} } }This returned exactly what I needed — client IPs, paths, countries, timestamps — but it required manual API calls outside the MCP.
Proposed Tools
-
workers_analytics— Query request analytics for a Worker or zone- Parameters:
scriptNameorzoneId,since(datetime),limit,groupBy(ip, path, country, etc.) - Returns: Visitor IPs, request paths, countries, timestamps, status codes
- Parameters:
-
workers_request_log— Tail or query recent requests (likewrangler tail)- Parameters:
scriptName,since,limit,filters(status, method, IP, path) - Returns: Individual request log entries
- Parameters:
-
zone_analytics_summary— High-level zone traffic summary- Parameters:
zoneId,since,until - Returns: Total requests, unique visitors, top pages, top countries, bandwidth
- Parameters:
Why This Matters
The MCP already has great tools for managing Workers (list, get, get code) and infrastructure (KV, D1, R2). But there's a gap: once you deploy, you can't see what's happening without leaving the MCP context. Analytics is a natural complement to the existing deployment tools.
This is especially useful for:
- Verifying a deployment is serving traffic
- Checking if specific users/IPs have visited (e.g., after sharing a demo link)
- Monitoring for unusual traffic patterns
- Quick health checks without opening the CF dashboard
Environment
- MCP Server:
mcp-server-cloudflare - Claude Code 2.1.76
- The underlying data is available via CF GraphQL Analytics API — this would just expose it through the MCP tool interface.