ai-tracker-mcp 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -0
- package/index.mjs +85 -0
- package/package.json +24 -0
package/README.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# AI Tracker MCP server
|
|
2
|
+
|
|
3
|
+
Pull your AI-visit analytics from [AI Tracker](https://ai-tracker-weld.vercel.app) into Claude
|
|
4
|
+
(Desktop or Code) and any MCP client.
|
|
5
|
+
|
|
6
|
+
## Tools
|
|
7
|
+
- `list_sites` — your tracked sites
|
|
8
|
+
- `get_summary(site_id, days?)` — metrics + change vs previous period
|
|
9
|
+
- `get_top_pages(site_id, days?, limit?)` — pages with the most AI visits
|
|
10
|
+
- `get_platforms(site_id, days?)` — which AIs visited (ChatGPT, Claude, Perplexity, …)
|
|
11
|
+
- `get_timeseries(site_id, days?, bucket?)` — trend data
|
|
12
|
+
- `get_recent_hits(site_id, limit?)` — raw hit log
|
|
13
|
+
|
|
14
|
+
## Setup
|
|
15
|
+
|
|
16
|
+
1. In AI Tracker → **Account → API & MCP access**, generate a token.
|
|
17
|
+
2. Add to your MCP config (Claude Desktop: `claude_desktop_config.json`):
|
|
18
|
+
|
|
19
|
+
```json
|
|
20
|
+
{
|
|
21
|
+
"mcpServers": {
|
|
22
|
+
"ai-tracker": {
|
|
23
|
+
"command": "npx",
|
|
24
|
+
"args": ["-y", "ai-tracker-mcp"],
|
|
25
|
+
"env": {
|
|
26
|
+
"AITRACKER_API_URL": "https://ai-tracker-weld.vercel.app",
|
|
27
|
+
"AITRACKER_TOKEN": "aitk_your_token_here"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
3. Restart Claude. Ask: *"Which pages on my site are getting the most AI visits this month?"*
|
|
35
|
+
|
|
36
|
+
## Run locally
|
|
37
|
+
```bash
|
|
38
|
+
cd mcp-server
|
|
39
|
+
npm install
|
|
40
|
+
AITRACKER_API_URL=https://ai-tracker-weld.vercel.app AITRACKER_TOKEN=aitk_... node index.mjs
|
|
41
|
+
```
|
package/index.mjs
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* AI Tracker MCP server.
|
|
4
|
+
* Exposes your AI-visit analytics as MCP tools for Claude and any MCP client.
|
|
5
|
+
*
|
|
6
|
+
* Env:
|
|
7
|
+
* AITRACKER_API_URL e.g. https://ai-tracker-weld.vercel.app
|
|
8
|
+
* AITRACKER_TOKEN an API token from Account → API & MCP access
|
|
9
|
+
*/
|
|
10
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
11
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
12
|
+
import { z } from "zod";
|
|
13
|
+
|
|
14
|
+
const BASE = (process.env.AITRACKER_API_URL || "").replace(/\/$/, "");
|
|
15
|
+
const TOKEN = process.env.AITRACKER_TOKEN || "";
|
|
16
|
+
|
|
17
|
+
if (!BASE || !TOKEN) {
|
|
18
|
+
console.error("AI Tracker MCP: set AITRACKER_API_URL and AITRACKER_TOKEN env vars.");
|
|
19
|
+
process.exit(1);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
async function api(path) {
|
|
23
|
+
const res = await fetch(`${BASE}/api/v1${path}`, {
|
|
24
|
+
headers: { Authorization: `Bearer ${TOKEN}` },
|
|
25
|
+
});
|
|
26
|
+
if (!res.ok) {
|
|
27
|
+
const body = await res.text();
|
|
28
|
+
throw new Error(`AI Tracker API ${res.status}: ${body}`);
|
|
29
|
+
}
|
|
30
|
+
return res.json();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const ok = (data) => ({ content: [{ type: "text", text: JSON.stringify(data, null, 2) }] });
|
|
34
|
+
|
|
35
|
+
const server = new McpServer({ name: "ai-tracker", version: "1.0.0" });
|
|
36
|
+
|
|
37
|
+
server.tool(
|
|
38
|
+
"list_sites",
|
|
39
|
+
"List all websites tracked in this AI Tracker account (id, name, domain, platform).",
|
|
40
|
+
{},
|
|
41
|
+
async () => ok(await api("/sites"))
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
server.tool(
|
|
45
|
+
"get_summary",
|
|
46
|
+
"Get headline AI-visit metrics for a site over the last N days, with change vs the previous period. AI counts are IP-VERIFIED only (total, live user fetches, AI search crawls, training scrapes). Also returns `unverified` (claimed an AI user-agent but the source IP could not be confirmed) and `traditional_search_crawls` (Googlebot — a readability proxy, NOT counted as an AI visit).",
|
|
47
|
+
{ site_id: z.string(), days: z.number().optional() },
|
|
48
|
+
async ({ site_id, days = 28 }) => ok(await api(`/sites/${site_id}/summary?days=${days}`))
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
server.tool(
|
|
52
|
+
"get_top_pages",
|
|
53
|
+
"Get the pages on a site receiving the most AI visits over the last N days (with share %).",
|
|
54
|
+
{ site_id: z.string(), days: z.number().optional(), limit: z.number().optional() },
|
|
55
|
+
async ({ site_id, days = 28, limit = 25 }) =>
|
|
56
|
+
ok(await api(`/sites/${site_id}/breakdown?dim=path&days=${days}&limit=${limit}`))
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
server.tool(
|
|
60
|
+
"get_platforms",
|
|
61
|
+
"Get the breakdown of which AI platforms (ChatGPT, Claude, Perplexity, etc.) visited a site over the last N days.",
|
|
62
|
+
{ site_id: z.string(), days: z.number().optional() },
|
|
63
|
+
async ({ site_id, days = 28 }) =>
|
|
64
|
+
ok(await api(`/sites/${site_id}/breakdown?dim=platform&days=${days}`))
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
server.tool(
|
|
68
|
+
"get_timeseries",
|
|
69
|
+
"Get the verified AI-visit time series for a site (per day or per hour) for charting trends. Each point also carries `traditional_search_crawls` (Googlebot — not an AI visit).",
|
|
70
|
+
{ site_id: z.string(), days: z.number().optional(), bucket: z.enum(["day", "hour"]).optional() },
|
|
71
|
+
async ({ site_id, days = 28, bucket = "day" }) =>
|
|
72
|
+
ok(await api(`/sites/${site_id}/timeseries?days=${days}&bucket=${bucket}`))
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
server.tool(
|
|
76
|
+
"get_recent_hits",
|
|
77
|
+
"Get the most recent raw AI-visit log entries for a site (time, platform, bot, type, URL, IP, country, `verified` flag, referrer, HTTP status).",
|
|
78
|
+
{ site_id: z.string(), limit: z.number().optional() },
|
|
79
|
+
async ({ site_id, limit = 100 }) =>
|
|
80
|
+
ok(await api(`/sites/${site_id}/hits?limit=${limit}`))
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
const transport = new StdioServerTransport();
|
|
84
|
+
await server.connect(transport);
|
|
85
|
+
console.error("AI Tracker MCP server running.");
|
package/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ai-tracker-mcp",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "MCP server for AI Tracker — pull your AI-visit analytics into Claude and any MCP client.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"ai-tracker-mcp": "index.mjs"
|
|
8
|
+
},
|
|
9
|
+
"files": ["index.mjs", "README.md"],
|
|
10
|
+
"engines": { "node": ">=18" },
|
|
11
|
+
"keywords": ["mcp", "model-context-protocol", "ai-tracker", "analytics", "claude", "ai-crawlers", "gptbot", "claudebot"],
|
|
12
|
+
"homepage": "https://ai-tracker-weld.vercel.app",
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git+https://github.com/builtbyish/ai-tracker.git",
|
|
16
|
+
"directory": "mcp-server"
|
|
17
|
+
},
|
|
18
|
+
"author": "Built By Ish",
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@modelcontextprotocol/sdk": "^1.0.4",
|
|
22
|
+
"zod": "^3.23.8"
|
|
23
|
+
}
|
|
24
|
+
}
|