使用说明
Clicky MCP服务器
一个模型上下文协议(MCP)服务器,它公开 点击 网络分析作为人工智能助手的12个工具——访问者数量、首页、流量来源、活动、跳出率、搜索词、实时访问者等等。请参阅 工具参考 查看完整列表。
快速开始
您需要:
- Node.js 20+ 已安装(
node --version) - A. Clicky站点ID和站点密钥 --在以下位置找到两者https://clicky.com/user/preferences/site在“信息”下(您将把这些粘贴到本地
.env文件,从不进入聊天) - 一 具有MCP功能的AI代理 --克劳德代码,克劳德桌面,Codex,开源,游标,Cline…
已安装MCP服务器 通过 你的代理,不是手工开始的——所以最快的设置是移交工作。复制下面的块并将其粘贴到您的代理:
Install the Clicky MCP server for me. It's a stdio MCP server, so the same definition works in any MCP host (Claude Code, Claude Desktop, Codex, opencode, Cursor, Cline, …) — register it using your host's own mechanism; only the config format differs, and you know your host better than this doc does.
1. Clone and build:
git clone https://github.com/colintoh/clicky-mcp.git
cd clicky-mcp && npm install && npm run build
Confirm the build produced dist/index.js. If it's missing, stop and show me
the build output instead of continuing.
2. Set up credentials WITHOUT putting them in this chat:
cp .env.example .env
Then tell me to open clicky-mcp/.env in my editor and paste my Clicky Site ID
and Site Key there myself (from https://clicky.com/user/preferences/site,
under "Info"). Do NOT ask me to paste the keys here, and do NOT read or print
.env — the server loads it at startup; the keys must never enter this chat.
3. Register it with this stdio server definition (no credentials in the host
config — the server reads them from .env):
command: absolute path to node — run `which node`; a bare "node" or a
relative path will fail
args: ["<absolute-path>/clicky-mcp/dist/index.js"]
transport: stdio
Add it with your host's own mechanism. One-line references if helpful:
- Claude Code: `claude mcp add clicky-analytics -- <node> <path>/clicky-mcp/dist/index.js`
- JSON hosts (Claude Desktop, Cursor, Cline, …): a "clicky-analytics"
entry under "mcpServers" with command + args (no env block needed)
- Codex (~/.codex/config.toml): [mcp_servers.clicky-analytics] with the
same command + args
If the host needs a restart to load new servers (Claude Desktop needs a full
Cmd-Q quit, not just closing the window), tell me to do that.
4. Verify: confirm your host lists a "clicky-analytics" server exposing 12 tools.
为什么不
npm start? MCP stdio服务器不是独立的守护进程——代理的MCP主机根据需要将服务器作为子进程生成,并通过stdin/stdout与之通信。没有什么可以自己“启动”的,这也是为什么设置是“告诉你的代理”而不是“运行命令”
日期参数
每个日期感知工具都接受 要么 明确的日期范围 或 a 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" }
工具参考
所有12个工具,按用例按字母顺序排列。
获取总访客数
一段时间内的访客总数。
start_date/end_date或date_range
获取_操作
一段时间内的总页面浏览量/操作数。
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)
获取页面_流量
特定页面URL的流量数据。
url(字符串, 必需的)start_date/end_date或date_range
get_traffic_sources
流量来源细分——可选择按页面URL过滤。
start_date/end_date或date_rangepage_url(字符串,可选)--完整URL或路径
get_reporting_domains
发送流量的顶级引用域。
start_date/end_date或date_rangelimit(数量,可选,最多1000)
get_campaigns
按活动标签分组的流量(utm_campaign 或Clicky活动跟踪)。此处仅显示标记的入站流量,未标记的自然/直接流量则不会显示。
start_date/end_date或date_rangelimit(数量,可选,最多1000)include_keywords(布尔值,可选)--还返回活动关键字/术语标签
get_domain_visitors
访问者数据按引用者域过滤,可选择分段。
domain(字符串, 必需的)start_date/end_date或date_rangesegments(数组,可选)--["pages", "visitors"].默认为["visitors"].limit(数量,可选,最多1000)
获取搜索
吸引访客的热门搜索词。
start_date/end_date或date_rangelimit(数量,可选,最多1000)
get_countries
按国家分列的游客人数。
start_date/end_date或date_rangelimit(数量,可选,最多1000)
API限值
由Clicky强加,而非此服务器:
- 最大显式日期范围: 31天
- 每个请求的最大结果: 1000个项目
- 每个IP每个站点ID一个同时请求
故障排除
“Claude Desktop看不到服务器。” 查看spawn日志 ~/Library/Logs/Claude/mcp-server-clicky-analytics.log最常见的原因是 node 不在Claude Desktop的launchd PATH上——通过替换来修复 "command": "node" 从绝对路径 which node.第二个最常见的原因是忘记完全退出Claude Desktop(⌘Q,而不仅仅是关上窗户)。
“日期范围不能超过31天。” 这是Clicky API的限制,而不是我们。要么缩小范围,要么使用 date_range 关键字类似 last-30-days.
本地开发
为了工作 上 服务器,而不仅仅是使用它。
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 项目根目录中的文件——复制模板并填写您的值:
cp .env.example .env
CLICKY_SITE_ID=your_site_id
CLICKY_SITE_KEY=your_site_key
.env 是gitignore,这是为提供凭据的推荐方式 两者 本地开发和MCP主机:它使您的密钥远离主机配置文件和任何代理聊天。服务器解析 .env 相对于其自身位置,因此无论主机从哪个工作目录启动它,它都会被找到,并且它只加载 .env 当凭据不在环境中时。你仍然可以通过 CLICKY_SITE_ID/CLICKY_SITE_KEY 通过主机 env 阻塞或 --site-id/--site-key args,如果你愿意的话。
一个预推的git钩子 .githooks/pre-push 自动运行 npm test 在任何更新遥控器的推送之前 main 分支,所以回归不能被忽视。它是由自动安装的 prepare npm脚本之后 npm install。对特征分支的推送没有门控。紧急情况下旁通 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
许可证
麻省理工学院
