Clicky MCP Server
Clicky MCP 服务器
一个模型上下文协议 (MCP) 服务器,将 Clicky 网站分析功能作为 11 个工具提供给 AI 助手使用——包括访客数量、热门页面、流量来源、跳出率、搜索词、实时访客等。请参阅 工具参考 获取完整列表。
快速开始
你需要:
安装 Node.js 20+ (
node --version)一个 Clicky 站点 ID 和站点密钥 — 在 https://clicky.com/user/preferences/site 的“Info”下找到两者
克隆并构建此仓库一次:
git clone https://github.com/colintoh/clicky-mcp.git cd clicky-mcp && npm install && npm run build
然后选择下方的 MCP 宿主。
为什么没有
npm start步骤? MCP stdio 服务器不会作为独立守护进程运行 — 你的 MCP 宿主(Claude Desktop、Claude Code 等)会按需将服务器作为子进程启动,并通过 stdin/stdout 与其通信。无需自行“启动”任何内容。
Claude Desktop
打开配置文件(如果不存在则创建):
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.jsonLinux:
~/.config/Claude/claude_desktop_config.json
将此内容合并到文件的
mcpServers块中(替换三个ALL_CAPS占位符):{ "mcpServers": { "clicky-analytics": { "command": "ABSOLUTE_PATH_TO_NODE", // e.g. /Users/.../.nvm/versions/node/v25.2.1/bin/node "args": ["ABSOLUTE_PATH_TO_CLICKY_MCP_FOLDER/dist/index.js"], // e.g. /Users/.../clicky-mcp/dist/index.js "env": { "CLICKY_SITE_ID": "YOUR_SITE_ID", "CLICKY_SITE_KEY": "YOUR_SITE_KEY" } } } }通过在终端运行
which node获取ABSOLUTE_PATH_TO_NODE。不要只写"node"— Claude Desktop 通过launchd启动,其 PATH 极简,不包含 nvm 或 homebrew,因此直接写"node"会静默失败。dist/index.js的路径也是如此:必须是绝对路径。完全退出 Claude Desktop(macOS 上按
⌘Q— 仅关闭窗口是不够的),然后重新打开。通过询问 Claude "list my Clicky MCP tools" 进行验证 — 你应该能看到 11 个工具。
如果出现问题,请参阅 故障排除。
Claude Code
一条命令:
claude mcp add clicky-analytics \
-e CLICKY_SITE_ID=YOUR_SITE_ID \
-e CLICKY_SITE_KEY=YOUR_SITE_KEY \
-- node /absolute/path/to/clicky-mcp/dist/index.js默认情况下,这会写入 ~/.claude.json。添加 --scope project 以改为写入项目本地的 .mcp.json。重启 Claude Code(或运行 /mcp 刷新),这 11 个工具即可使用。
MCP Inspector (调试)
当你想要直接调用工具而不将服务器提交给宿主时,请使用此工具 — 这对于检查模式或排查响应非常方便:
npx @modelcontextprotocol/inspector node dist/index.js然后打开打印出的 URL,在 Inspector UI 中将 CLICKY_SITE_ID 和 CLICKY_SITE_KEY 设置为环境变量(或者在 dist/index.js 之后作为 CLI 参数传递 --site-id … --site-key …),然后点击即可。
Related MCP server: Plausible MCP Server
日期参数
每个支持日期的工具都接受显式日期范围 或 Clicky 相对日期关键字 — 但不能同时使用:
显式:
start_date+end_date,均为YYYY-MM-DD格式,范围 ≤ 31 天。关键字:
date_range,可选值:today、yesterday、last-7-days、last-30-days、this-week、last-week、this-month、last-month、this-year、last-year。
示例:
{ "date_range": "last-7-days" }工具参考
所有 11 个工具,按用例大致字母顺序排列。
get_total_visitors
一段时间内的总访客数。
start_date/end_date或date_range
get_actions
一段时间内的总页面浏览量/操作数。
start_date/end_date或date_rangelimit(数字,可选,最大 1000)
get_bounce_rate
一段时间内的跳出率和平均网站停留时间。
start_date/end_date或date_range
get_visitors_online
实时访客数和细分。无需参数。
get_top_pages
一段时间内最受欢迎的页面。
start_date/end_date或date_rangelimit(数字,可选,最大 1000)
get_page_traffic
特定页面 URL 的流量数据。
url(字符串,必填)start_date/end_date或date_range
get_traffic_sources
流量来源细分 — 可选择按页面 URL 过滤。
start_date/end_date或date_rangepage_url(字符串,可选) — 完整 URL 或路径
get_referring_domains
带来流量的顶级引荐域名。
start_date/end_date或date_rangelimit(数字,可选,最大 1000)
get_domain_visitors
按引荐域名过滤的访客数据,带有可选的细分。
domain(字符串,必填)start_date/end_date或date_rangesegments(数组,可选) —["pages", "visitors"]。默认为["visitors"]。limit(数字,可选,最大 1000)
get_searches
带来访客的顶级搜索词。
start_date/end_date或date_rangelimit(数字,可选,最大 1000)
get_countries
按国家/地区划分的访客细分。
start_date/end_date或date_rangelimit(数字,可选,最大 1000)
API 限制
由 Clicky 施加,而非本服务器:
最大显式日期范围:31 天
每次请求的最大结果数:1,000 项
每个站点 ID 每个 IP 同时只能有一个请求
故障排除
“Claude Desktop 看不到服务器。” 检查 ~/Library/Logs/Claude/mcp-server-clicky-analytics.log 中的启动日志。最常见的原因是 node 不在 Claude Desktop 的 launchd PATH 中 — 通过将 "command": "node" 替换为 which node 得到的绝对路径来修复。第二常见的原因是忘记完全退出 Claude Desktop(⌘Q,而不是仅关闭窗口)。
“日期范围不能超过 31 天。” 这是 Clicky API 的限制,不是我们的。要么缩小范围,要么使用像 last-30-days 这样的 date_range 关键字。
本地开发
用于开发服务器本身,而不仅仅是使用它。
npm install # install deps
npm run dev # run with tsx, watching for changes (used for local testing only)
npm run build # compile TS to dist/
npm test # 46 unit tests, offline, no credentials needed
npm run test:integration # live API smoke test (requires .env or env vars)对于本地开发,凭据可以来自项目根目录中的 .env 文件:
CLICKY_SITE_ID=your_site_id
CLICKY_SITE_KEY=your_site_key.env 已被 git 忽略。不要在 Claude Desktop 等宿主中使用 .env — 请通过宿主的配置 env 块传递凭据,如 快速开始 所示。服务器仅在凭据尚未存在于环境中时才会加载 .env。
.githooks/pre-push 中的预推送 git 钩子会在任何更新远程 main 分支的推送之前自动运行 npm test,因此回归错误不会被漏掉。它由 npm install 之后的 prepare npm 脚本自动安装。推送到功能分支不受此限制。紧急情况下可以使用 git push --no-verify 跳过。
项目结构
clicky-mcp/
├── src/
│ ├── index.ts # MCP server + tool dispatcher
│ ├── clicky-client.ts # Clicky HTTP API client
│ ├── date-utils.ts # Shared date param builder
│ └── tools/ # One file per tool
├── test/ # node:test unit tests
├── scripts/verify.mjs # Live API smoke runner
├── .githooks/pre-push # Auto-installed test gate for main
├── package.json
├── tsconfig.json
└── README.md通过 AI 代理安装此 MCP
如果你希望 AI 代理(例如另一个项目中的 Claude Code)为你安装此 MCP,请将其指向本节。代理应该:
克隆并构建:
git clone https://github.com/colintoh/clicky-mcp.git cd clicky-mcp && npm install && npm run build向用户询问其 Clicky 站点 ID 和站点密钥 (https://clicky.com/user/preferences/site)。
运行
which node并捕获绝对路径。找到用户的 Claude Desktop 配置(路径见 快速开始 › Claude Desktop)并合并该节中的
mcpServers代码片段,替换绝对node路径、绝对dist/index.js路径以及用户的凭据。告诉用户完全重启 Claude Desktop (
⌘Q),然后通过询问 Claude "list my Clicky MCP tools" 进行验证 — 应该会出现 11 个工具。
对于 Claude Code,快速开始 › Claude Code 中的单条 claude mcp add 命令更快,并且可以一步完成配置写入。
许可证
MIT
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/colintoh/clicky-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server