cloudflare / cloudflare/mcp-server-cloudflare

Feature Request: Workers Analytics / Request Logs via MCP

Open
#324 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
4.2k
Forks
514
Avg merge
1d 21h
Merged PRs (30d)
2

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:

```graphql
{ 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

1. **`workers_analytics`** — Query request analytics for a Worker or zone
- Parameters: `scriptName` or `zoneId`, `since` (datetime), `limit`, `groupBy` (ip, path, country, etc.)
- Returns: Visitor IPs, request paths, countries, timestamps, status codes

2. **`workers_request_log`** — Tail or query recent requests (like `wrangler tail`)
- Parameters: `scriptName`, `since`, `limit`, `filters` (status, method, IP, path)
- Returns: Individual request log entries

3. **`zone_analytics_summary`** — High-level zone traffic summary
- Parameters: `zoneId`, `since`, `until`
- Returns: Total requests, unique visitors, top pages, top countries, bandwidth

### 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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.