MCP Integration

Connect AI assistants to PubPerf via Model Context Protocol

MCP Integration

PubPerf provides a built-in Model Context Protocol (MCP) server that lets AI assistants like Claude, ChatGPT, and other MCP-compatible clients query your analytics data directly.

Overview

The MCP server exposes read-only access to all PubPerf analytics for your organization:

  • Projects — List and inspect websites
  • Core Web Vitals — FCP, LCP, CLS, INP metrics and time-series
  • Real User Monitoring — Traffic, paint timings, DNS, TTFB, DOM, memory
  • Ads — Impressions, Google Publisher Tag load, auction timings, viewability
  • Prebid / Header Bidding — Revenue, CPM, bidders, win rates, forecasts
  • Content Analytics — Pageviews, revenue, authors, categories
  • Content — Distinct page counts and traffic time-series

Setup

1. Create an API Key

  1. Navigate to Connect > API Keys in the sidebar.
  2. Click Create API Key.
  3. Copy the generated secret key.

See API Keys & Integrations for detailed key management instructions.

2. Configure Your AI Client

Claude Desktop

Add the following to your Claude Desktop MCP configuration (claude_desktop_config.json):

{
  "mcpServers": {
    "pubperf": {
      "type": "streamable-http",
      "url": "https://app.pubperf.com/api/mcp",
      "headers": {
        "Authorization": "Bearer {your-api-key}"
      }
    }
  }
}

Replace {your-api-key} with your API key.

Other MCP Clients

The PubPerf MCP server uses the Streamable HTTP transport. Connect any MCP-compatible client to:

POST https://app.pubperf.com/api/mcp
Authorization: Bearer {your-api-key}

Available Tools

Once connected, the following tools are available to your AI assistant:

Projects

ToolDescription
list_projectsList all projects (id, name, domain). Use the id to call other project-scoped tools
get_projectGet project configuration: name, domain, feature flags, GAM prefix, notification rules
get_project_summaryGet a 24h overview: users, pageviews, sessions, pages per session, performance scores (mobile/desktop), impressions, viewability, monthly pageview totals
get_project_top_trafficGet top pages (href), referrers, languages, browsers and countries ranked by unique visitors
get_project_traffic_by_typeGet a single traffic breakdown by dimension (href, referrer, language, browser, country)

Core Web Vitals

ToolDescription
list_web_vitalsList Web Vitals summaries (fcp_cost, lcp, cls, inp) for all projects
get_web_vitalsGet FCP, LCP, CLS and INP for a project (last 24h)
get_web_vitals_chartsGet a Web Vitals time-series with p50/p75/p90 percentiles per interval
get_web_vitals_distributionGet value distribution histogram as { value, count } buckets
get_web_vitals_ratingsGet good / needs-improvement / poor rating breakdown over time
get_web_vitals_topGet worst-performing pages as { id (URL), v (value) } for LCP, CLS or INP

Real User Monitoring

ToolDescription
list_rumList RUM summaries (DNS, connect, TTFB, DOM, FCP, FP, memory, LCP, CLS, INP) for all projects
get_rumGet RUM summary for a project: DNS, TCP connect, TTFB, DOM, JS cost, FCP, FP, memory, LCP, CLS, INP
get_rum_chartsGet RUM time-series: users, pageviews, sessions, pages, FCP, FP, DNS, TTFB, scroll, connect, DOM, memory per interval

Ads

ToolDescription
list_adsList ad performance summaries (last 24h) for all projects
get_adsGet ad performance for a project: users, pageviews, sessions, pages per session, impressions, GPT load, auction times, time to render, viewability
get_ads_chartsGet ad performance time-series: users, pageviews, IVT, sessions, GPT load, auctions, impressions, time to render, active views per interval

Prebid / Header Bidding

ToolDescription
list_prebidList prebid summaries for all projects, sorted by pageviews
get_prebidGet prebid summary: users, pageviews, CPM min/avg/max, revenue, RPM, bidders, timeout, ad units, viewability
get_prebid_chartsGet prebid time-series by type: revenue (default), content, pageview, win-rate, ecpm, bidders, timeout, rpm, viewability
get_prebid_topGet top-N ranking by dimension: bidders, country, brand, size, adunit, domains, viewability, and more
get_prebid_forecastGet a prebid forecast time-series for a given metric
get_prebid_revenue_forecastGet hourly revenue forecast band with upper/lower bounds

Content

ToolDescription
list_content_summariesList content summaries (distinct page count) for all projects
get_content_summaryGet the distinct page count for a project (last 24h)
get_content_chartsGet content time-series: users, pageviews and distinct pages per interval

Content Analytics

ToolDescription
get_content_metricsGet content revenue analytics (last 24h): users, pageviews, impressions, prebid, CPM, RPM, revenue. Optionally filter by author, category or href
get_content_analytics_topGet top-N ranking by dimension: country, browser, referrer, author, category or href
get_content_analytics_chartsGet content analytics time-series: summary, revenue, scroll depth, intents, impression breakdown, and top-N rankings
list_content_authorsList top authors for a project as { author, cnt } sorted by pageviews
list_content_categoriesList top categories for a project as { category, cnt } sorted by pageviews

Common Parameters

Many tools accept these optional parameters:

  • range — Time range: 3h, 24h, 60h, 1w, 1m, 2m, 90d, 1y, or a custom YYYYMMDD-YYYYMMDD window
  • device — Device filter: 0 (all), 1 (mobile), 2 (desktop)
  • projectId — Project ID as returned by list_projects

Example Prompts

Once connected, you can ask your AI assistant questions like:

  • "Show me the Core Web Vitals for all my websites"
  • "What are the worst-performing pages by LCP on example.com?"
  • "Compare prebid revenue across my websites for the last week"
  • "Which bidders have the highest timeout rate?"
  • "Show me the top content authors by pageviews"

Security

  • The MCP server provides read-only access — no data can be modified.
  • All requests are authenticated via API key (Bearer token).
  • Each API key is scoped to a single organization.
  • The endpoint is rate-limited to 60 requests per minute.
  • API keys can be disabled or regenerated at any time from the dashboard.