Agents and the MCP

Measured before you open the dashboard

Connect the Pagebee MCP to Claude Code, Cursor or Codex. Your agent creates the property, installs the snippet, keeps previews out of production and checks the first event arrived. Later, it answers questions about your numbers.

  1. > Add Pagebee to this repo. Keep Vercel previews out of production.
  2. pagebee · create_site tally.app, web, Europe/London
  3. pagebee · get_install_snippet Next.js, script tag in app/layout.tsx
  4. Edited app/layout.tsx (+3 lines). Pushed to the staging branch.
  5. pagebee · update_site_settings *.vercel.app is preview, staging.tally.app is staging
  6. pagebee · upsert_goal Signed up
  7. pagebee · verify_install staging
  8. First event received from staging, 4 seconds agopageview / · staging.tally.app · production untouched

How it works

Connect once, then ask in plain words

  1. 1

    Make a key

    In workspace settings, create an API key. Read can query and change nothing; Dev can also configure. Pick the sites and apps it can see.

  2. 2

    Connect your agent

    One command for Claude Code, a few lines of config for Cursor or Codex. The server is one URL; there's nothing to install.

  3. 3

    Ask it to set up or to answer

    "Add Pagebee to this repo" in your project, or "why did sign-ups drop on Tuesday?" anywhere.

What it replaces

Clicking through setup for every new product

Every new site or app used to mean the same twenty minutes: create the site, copy the key, paste the tag, check it, add the goals. Now it's one sentence to the agent already working in the repo.

Setup checklistsCopying keys between tabsScreenshots of dashboards in chat

Scopes and safety

  • Read keys answer questions and change nothing
  • Dev keys add setup tools, on top of read
  • Keys can be limited to some properties
  • Read tools are marked read-only to the client
  • Deleting a goal asks for confirmation
  • Dev keys can't delete sites or touch billing
  • Revoking a key works within a minute
  • Answers carry their caveats, like per-day uniques
  • No visitor identifiers in any result
  • 120 calls a minute per key

Every tool

Nine tools to ask, ten more to set up

This is the whole list. The server is stateless, speaks streamable HTTP, and returns structured results your agent can chart.

Intelligence

Read keys
  • list_sitesEvery site and app the key can see
  • get_schemaWhat can be asked of a site: metrics, dimensions, events, goals, funnels
  • query_metricsAny metric, filtered and broken down, for any range
  • get_topTop pages, referrers, channels, countries, devices, campaigns or events
  • get_timeseriesMetrics over time by hour, day, week or month
  • get_funnelHow many visits reach each step, saved or ad hoc
  • compare_periodsA range against the previous period or last year
  • get_realtimeVisitors in the last 5 and 30 minutes, and what they're on
  • explain_changeWhich sources, pages, countries or versions moved a number

Dev

Dev keys, adds to read
  • create_siteAdd a website, iOS, Mac, Android or server property
  • update_site_settingsDomains, timezone, currency and hostname rules
  • get_install_snippetThe script tag, Swift or Kotlin setup for a property
  • verify_installCheck the snippet is live and events are arriving
  • list_recent_eventsThe latest raw events, with no visitor identifiers
  • upsert_goalCreate or update a goal
  • delete_goalRemove a goal, after confirming
  • create_api_keyIngest keys, or read-only API keys
  • create_channelA live feed channel with an emoji and push setting
  • send_test_eventOne test event, end to end, not counted

Connect your agent

Make a key in workspace settings, then add the server to your client. To set up a project, paste this prompt:

Setup prompt
Add Pagebee analytics to this project. Create a property for it, install the snippet, make preview deploys count as preview, add a goal for sign-ups, then verify the install and tell me what you saw.
Terminal
claude mcp add --transport http pagebee https://api.pagebee.ai/mcp \
  --header "Authorization: Bearer pb_ak_your_key"

Questions

Asked often

Will my agent change things I don't want changed?

Only with a dev key. A read key can query your numbers and nothing else. A dev key can create sites, keys, goals, channels and hostname rules, and it can't delete sites or touch billing. Deleting a goal asks for confirmation first.

Can I add it to Claude.ai with one click?

Not yet. One-click connection needs OAuth, which is next on the list. Today you connect with an API key from Claude Code, Cursor, Codex or any client that sends a header.

Does the agent see who my visitors are?

No. Pagebee doesn't know who they are, so neither can the agent. Results are counts, breakdowns and raw events without visitor identifiers.

Let your agent set up the next one

Free to 10,000 events a month. No card.