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.
- > Add Pagebee to this repo. Keep Vercel previews out of production.
- pagebee · create_site tally.app, web, Europe/London
- pagebee · get_install_snippet Next.js, script tag in app/layout.tsx
- Edited app/layout.tsx (+3 lines). Pushed to the staging branch.
- pagebee · update_site_settings *.vercel.app is preview, staging.tally.app is staging
- pagebee · upsert_goal Signed up
- pagebee · verify_install staging
- First event received from staging, 4 seconds agopageview / · staging.tally.app · production untouched
How it works
Connect once, then ask in plain words
- 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
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
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 keyslist_sitesEvery site and app the key can seeget_schemaWhat can be asked of a site: metrics, dimensions, events, goals, funnelsquery_metricsAny metric, filtered and broken down, for any rangeget_topTop pages, referrers, channels, countries, devices, campaigns or eventsget_timeseriesMetrics over time by hour, day, week or monthget_funnelHow many visits reach each step, saved or ad hoccompare_periodsA range against the previous period or last yearget_realtimeVisitors in the last 5 and 30 minutes, and what they're onexplain_changeWhich sources, pages, countries or versions moved a number
Dev
Dev keys, adds to readcreate_siteAdd a website, iOS, Mac, Android or server propertyupdate_site_settingsDomains, timezone, currency and hostname rulesget_install_snippetThe script tag, Swift or Kotlin setup for a propertyverify_installCheck the snippet is live and events are arrivinglist_recent_eventsThe latest raw events, with no visitor identifiersupsert_goalCreate or update a goaldelete_goalRemove a goal, after confirmingcreate_api_keyIngest keys, or read-only API keyscreate_channelA live feed channel with an emoji and push settingsend_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:
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.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.