Skip to content

Add account_analytics:read scope for RUM / Web Analytics data access #162

Description

@km-tr

Summary

The MCP server currently does not include the account_analytics:read OAuth scope, which is required to query RUM (Real User Monitoring) / Web Analytics data via the Cloudflare GraphQL Analytics API.

Use Case

I want to retrieve Web Vitals metrics (TTFB, FCP, LCP, etc.) from Cloudflare RUM using the GraphQL Analytics API through the MCP server. The relevant GraphQL dataset is rumPerformanceEventsAdaptiveGroups, which lives under the accounts node and requires the account_analytics:read scope.

Example query:

{
  viewer {
    accounts(filter: { accountTag: "<account_id>" }) {
      rumPerformanceEventsAdaptiveGroups(
        filter: { datetime_gt: "2025-01-01T00:00:00Z", datetime_lt: "2025-01-02T00:00:00Z" }
        limit: 10
        orderBy: [count_DESC]
      ) {
        count
        dimensions { requestPath }
        quantiles { requestTimeP50 requestTimeP75 requestTimeP95 }
      }
    }
  }
}

This currently fails with not authorized for that account because the OAuth token lacks the account_analytics:read scope.

Proposed Change

Add account_analytics:read to ALL_SCOPES in src/auth/scopes.ts:

// Analytics
'account_analytics:read': 'View account-level analytics including RUM and Web Analytics data',

This would enable the scope to be included in both the read-only and yolo templates automatically.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions