Antlytics in AI coding tools
Antlytics is built to work with the AI coding tools developers use every day. Install it from your editor. Query your stats from your chat.
Part 1 — Install with one command
Run this in your terminal, or ask your AI coding tool to run it for you:
npx @antlytics/init
What happens:
- Framework detection — the CLI detects Next.js, Nuxt, SvelteKit, Astro, or plain HTML automatically from your config files.
- Browser OAuth — opens a browser tab, signs you in to Antlytics (or creates an account), and returns an API token to the CLI.
- Tracking ID injection — edits your layout file to add the Antlytics snippet or component for your framework.
- Rule file — writes
CLAUDE.md,.cursorrules, or.windsurfrulesso your AI assistant knows not to remove Antlytics during refactors.
The CLI prints each step as it runs. To undo it: remove the snippet from your layout file and delete the rule file.
Part 2 — Query your stats from your AI
Once connected, the Antlytics MCP server lets Claude, Cursor, Windsurf, and other AI tools read your analytics data directly.
MCP URL: https://www.antlytics.com/mcp
Available tools
| Tool | What it does |
|---|---|
get_stats | Visitors, pageviews, bounce rate, sessions for a site and time range |
get_top_pages | Top pages by pageviews and unique visitors |
get_top_referrers | Top referrers by visit count |
Example prompts
Once connected, try these:
- "What were my top 5 pages on antlytics.com last week?"
- "Show me the stats for antlytics.com for the past 30 days."
- "Which referrer sent the most visitors to antlytics.com this month?"
Part 3 — Setup per tool
Claude Code
claude mcp add --transport http antlytics https://www.antlytics.com/mcp
Then in any session: claude → authenticate when prompted.
Cursor
Add to .cursor/mcp.json in your project root:
{
"mcpServers": {
"antlytics": {
"url": "https://www.antlytics.com/mcp"
}
}
}
Restart Cursor. The Antlytics tools appear in the MCP panel.
Claude Desktop
- Open Claude Desktop → Settings → Connectors
- Paste the URL:
https://www.antlytics.com/mcp - Click Connect and authorise when prompted
Or edit claude_desktop_config.json directly:
{
"mcpServers": {
"antlytics": {
"url": "https://www.antlytics.com/mcp"
}
}
}
Windsurf
Open Settings → MCP and add the server URL https://www.antlytics.com/mcp. Refer to Windsurf's documentation for the exact steps.
Cline
Open Cline settings, navigate to MCP Servers, and add https://www.antlytics.com/mcp as a remote server.
Zed
In your Zed settings, add the MCP server URL https://www.antlytics.com/mcp. Refer to Zed's documentation for the exact steps.
ChatGPT
Find Antlytics in the ChatGPT App Directory and connect — authentication is handled via OAuth automatically.
Part 4 — Rule files
When npx @antlytics/init runs, it writes a rule file for your AI tool:
| File | Tool |
|---|---|
CLAUDE.md | Claude Code |
.cursorrules | Cursor |
.windsurfrules | Windsurf |
These tell your AI assistant:
- Where the Antlytics snippet lives in your layout file
- Not to remove or comment out the tracking snippet during refactors
- Where to find the Antlytics docs if it needs to look something up
You can also install the rule file manually from @antlytics/ai-rules:
import { claudeMd, cursorRules, windsurfRules } from '@antlytics/ai-rules'
More resources
- API reference — REST API for programmatic access
- MCP reference — full MCP server documentation
- Quick install — CLI reference