MCP integration

Pageviews.ai supports the Model Context Protocol (MCP), an open standard that lets AI tools like Claude, Cursor, and Windsurf access your analytics data directly. MCP integration is available on plans with the API Access feature enabled.

Unlike the REST API (which requires a manually created token for programmatic access), MCP also supports OAuth — meaning tools like Claude.ai can connect with a simple login, no token needed.

What is MCP?

MCP allows AI assistants to call tools on your behalf. Once connected, you can ask your AI assistant questions like "Show me traffic for my website this week" or "What are my top pages today?" and it will query your real Pageviews.ai data.

Available tools

The Pageviews.ai MCP server provides 15 tools for querying your analytics:

  • list-sites — List all your websites
  • list-goals — List goals configured for a site
  • list-funnels — List funnels configured for a site
  • list-properties — List custom properties for a site
  • get-traffic-overview — Visitors, pageviews, bounce rate over time
  • get-top-pages — Top pages, entry pages, and exit pages
  • get-traffic-sources — Traffic sources, channels, and UTM data
  • get-country-breakdown — Visitors by country and city
  • get-device-breakdown — Devices, browsers, and operating systems
  • get-goal-conversions — Goal conversion rates and counts
  • get-funnel-conversions — Step-by-step funnel drop-off data
  • get-revenue-overview — Revenue KPIs and time series
  • get-custom-properties — Custom property analytics
  • get-realtime-data — Current users and live traffic
  • get-recent-activity — Live feed of recent visitor events

Connecting with Claude.ai

Claude.ai supports MCP connectors with OAuth authentication. You don't need an API token — Claude handles the login flow automatically.

  1. In Claude.ai, go to Settings → Connectors → Add Custom Connector.
  2. Enter a name (e.g., "Pageviews.ai") and the server URL: https://pageviews.ai/api/mcp/analytics
  3. Leave the OAuth Client ID and Secret fields empty — Claude handles registration automatically.
  4. Click Add.
  5. You'll be redirected to Pageviews.ai to log in and authorize the connection.
  6. After authorizing, you can start asking Claude about your analytics.

{screenshot: Claude.ai Add Custom Connector dialog with Pageviews.ai URL}

{screenshot: Pageviews.ai OAuth authorization page}

Connecting with Claude Code, Cursor, or Windsurf

Developer tools that support custom headers can connect using an API token instead of OAuth.

  1. Create an API token at Account Settings → API Access.
  2. Add the MCP server to your tool's configuration:
{ "mcpServers": { "pageviews": { "url": "https://pageviews.ai/api/mcp/analytics", "headers": { "Authorization": "Bearer your-api-token-here" } } } }

The exact location of this configuration varies by tool. Check your tool's documentation for where to add MCP servers.

{screenshot: MCP server configuration example}

Example conversations

Once connected, try asking your AI assistant:

  • "List my sites"
  • "Show me today's traffic for example.com"
  • "What are the top traffic sources this week?"
  • "Compare this month's visitors by country"
  • "Which pages have the highest bounce rate?"
  • "How many users are online right now?"

{screenshot: Example conversation with Claude using Pageviews.ai MCP}

Plan requirements

MCP integration requires a plan with API Access enabled. If your plan doesn't include API access, you'll need to upgrade before connecting. You can check your plan's features on the Account Settings → Billing page.

Security

MCP connections are secure and scoped to your account:

  • You can only access sites you own or have been invited to.
  • OAuth tokens are limited to the mcp:use scope — they cannot modify your account or settings.
  • API tokens can be revoked at any time from the API Access page.
  • All data is transmitted over HTTPS.