agentlytics
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@agentlyticswhy did my traffic spike yesterday?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
agentlytics-mcp
Website analytics your AI agent can read. A small, cookieless analytics server for one website, with an MCP server built in, so Claude Code, Cursor or Codex can look at your traffic and help you decide what to do next.
You deploy it to your own Cloudflare account (Workers + D1, the free tier is enough for most small sites). Your data stays in your account.

Example questions and answers; the numbers are illustrative.
Don't want to run it yourself? measuremy.site is the hosted version: same MCP tools, plus a dashboard, AI explanations of traffic spikes, tracking of posts that mention you (Hacker News, Bluesky, YouTube...), alerts and weekly summaries. Free for 10,000 pageviews a month.
What your agent can do
Ask in plain words, for example:
"Why did traffic jump yesterday?" It finds the spike and the source, page or event behind it.
"Where do people drop off between the homepage and signup?" It builds a funnel and shows the biggest drop.
"What's working, and what should I post next?" It ranks channels by conversions and turns that into steps.
"Make a tracked link for my Reddit post, and check how it did next week."
Tools exposed over MCP:
Area | Tools |
Traffic |
|
Questions about visits |
|
Spikes |
|
Funnels |
|
Growth |
|
Campaigns |
|
Plus a plan_marketing prompt that walks the agent through a data-backed plan.
Related MCP server: KrystalView MCP Server
Privacy
No cookies and nothing stored in the visitor's browser.
No IP address or user agent is stored. A visitor id is a hash that changes every day, so nobody can be followed from one day to the next.
Only browser and OS names (like "Firefox", "macOS") and the country Cloudflare reports are kept.
Raw events are deleted after 400 days; hourly totals are kept.
Check what applies where you and your visitors are; this is not legal advice.
Deploy
One click
The button copies this repo to your GitHub account, creates the D1 database, runs the migrations and deploys the worker. It asks for three settings:
SITE_DOMAIN: your website's domain, likeexample.com(nohttps://orwww)HASH_SECRET: any long random string, used to make the daily visitor idMCP_READ_KEY: another long random string, the key your AI agent uses
Generate the two random values with openssl rand -hex 32, and keep MCP_READ_KEY for connecting your agent below.
By hand
You need a Cloudflare account and Node.js 20+.
git clone https://github.com/developeron29/agentlytics-mcp.git
cd agentlytics-mcp
npm install
npx wrangler loginCreate the database and paste the printed
database_idintowrangler.jsonc:npx wrangler d1 create agentlytics-mcpSet the three settings. Use long random values for the two keys, for example from
openssl rand -hex 32:npx wrangler secret put SITE_DOMAIN # e.g. example.com npx wrangler secret put HASH_SECRET # makes the daily visitor id; never share it npx wrangler secret put MCP_READ_KEY # the key your agent uses; keep it out of your repoWrangler may offer to create the worker on the first
secret put; say yes.Deploy (this also creates the tables):
npm run deploy
Either way you get a worker URL like https://agentlytics-mcp.<you>.workers.dev. Opening it shows a status page with your domain. You can attach a custom domain such as stats.yourdomain.com in the Cloudflare dashboard.
Optional rate limit: to cap how often one IP can send hits, add this to wrangler.jsonc and deploy again:
"ratelimits": [{ "name": "COLLECT_LIMITER", "namespace_id": "1001", "simple": { "limit": 120, "period": 60 } }]Add the tracker to your site
Put this in the <head> of every page:
<script defer src="https://YOUR-WORKER-URL/t.js"></script>It counts pageviews, including client-side navigation in single-page apps. To count something that matters, like a signup:
agentlytics.track("signup", { plan: "pro" });or without JavaScript, on any element:
<button data-agentlytics-event="cta_click">Start free</button>Only pages on SITE_DOMAIN (and its subdomains) are counted.
Connect your agent
Claude Code
claude mcp add --scope user --transport http agentlytics https://YOUR-WORKER-URL/mcp --header "Authorization: Bearer YOUR_MCP_READ_KEY"Cursor (.cursor/mcp.json or ~/.cursor/mcp.json)
{
"mcpServers": {
"agentlytics": {
"url": "https://YOUR-WORKER-URL/mcp",
"headers": { "Authorization": "Bearer YOUR_MCP_READ_KEY" }
}
}
}Codex (~/.codex/config.toml)
[mcp_servers.agentlytics]
url = "https://YOUR-WORKER-URL/mcp"
bearer_token_env_var = "AGENTLYTICS_READ_KEY"and export AGENTLYTICS_READ_KEY=YOUR_MCP_READ_KEY in the shell that starts Codex.
Then ask: "Use agentlytics to tell me how my site did this week." Spikes need a few days of traffic to compare against.
Let your agent do the setup
Point your coding agent at AGENTS.md: "Deploy agentlytics-mcp for my site by following AGENTS.md". It walks through every step and asks you before anything that needs your Cloudflare login.
Self-hosted or hosted?
agentlytics-mcp (this repo) | ||
MCP tools for your agent | Yes | Yes |
Cookieless tracking, funnels, spikes, campaigns | Yes | Yes |
Sites | One per deploy | Several, one account |
Dashboard | No (ask your agent) | Yes, with filters and a public share link |
AI explanations of spikes | No | Yes |
Posts that mention you (HN, Lobsters, Bluesky, YouTube, Reddit) | No | Yes, on your traffic chart |
Alerts, weekly email summary | No | Yes |
Who runs it | You, on your Cloudflare account | Us |
Price | Free (your Cloudflare usage) | Free up to 10,000 pageviews a month, then paid plans |
Develop
cp .dev.vars.example .dev.vars # then edit the values
npm run db:migrate:local
npx wrangler dev
npm test
npm run typecheckLicense
MIT. See LICENSE.
This server cannot be deployed
Maintenance
Related MCP Connectors
Analytics your AI agent can actually use. Track, experiment, and optimize via MCP.
Marketing data and actions for AI agents: GA4, Search Console, ads, social, SEO and WordPress.
An MCP for marketers that gives agents tools for SEO, AEO, socials and ads data. Generous free tier; works in Claude, ChatGPT, Cursor and other MCP clients.
Real-time web analytics for AI agents: query traffic, funnels, revenue, and manage your sites.
Related MCP Servers
- AlicenseAqualityDmaintenancePrivacy friendly, cookieless web analytics built MCP-first. "Add analytics to my Next.js app" → an AI agent runs the setup_analytics_for_site tool, picks the right install snippet, edits your layout file, and verifies the script is loading. OAuth onboarding, no API keys to paste.2834 npm1MIT
- AlicenseAqualityDmaintenanceEnables AI agents to access website analytics, including visitor sessions, UX friction, conversion funnels, and anomaly alerts.6MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to answer growth questions in plain English by connecting to marketing and product data via 49 MCP tools.25MIT
- AlicenseAqualityDmaintenanceFirst-party web analytics MCP server for AI agents, providing 42 tools to query traffic, events, funnels, conversions, sources, and performance data.4027 npmMIT