合理的mcp
一 MCP(模型上下文协议) 服务器 合理分析.直接从Claude等人工智能助手查询您的网站统计数据。
特性
- 汇总统计数据 --访问者、页面浏览量、跳出率、访问持续时间
- 时间序列 --按天、周或月划分的交通趋势
- 分解 --首页、流量来源、国家/地区、设备、浏览器等
- 实时访客 --当前访问人数
- 网站列表 --发现你所有的可信网站
- 原始查询 -对高级用例的合理统计API v2的完全访问
两者都适用 合理云 以及自托管实例。
设置
1.获取一个合理的API密钥
去你的 合理的帐户设置 并创建API密钥。
2.配置您的MCP客户端
克劳德桌面版
添加到您的 claude_desktop_config.json:
{
"mcpServers": {
"plausible": {
"command": "npx",
"args": ["-y", "plausible-mcp"],
"env": {
"PLAUSIBLE_API_KEY": "your-api-key-here"
}
}
}
}克劳德代码
claude mcp add plausible -- npx -y plausible-mcp然后设置环境变量 PLAUSIBLE_API_KEY 在你的壳里。
自我托管合理
添加 PLAUSIBLE_BASE_URL 指向您的实例:
{
"env": {
"PLAUSIBLE_API_KEY": "your-api-key-here",
"PLAUSIBLE_BASE_URL": "https://plausible.example.com"
}
}工具
| 工具 | 说明 |
|---|---|
list-sites | 列出您的合理帐户中的所有网站 |
get-current-visitors | 网站的实时访问者计数 |
get-aggregate-stats | 一段时间内的汇总指标 |
get-timeseries | 随时间变化的交通趋势(按天/周/月) |
get-breakdown | 按维度(页面、来源、国家等)细分统计数据 |
query | 用于高级用例的原始合理统计API v2查询 |
示例提示
- “example.com这个月有多少访客?”
- “显示过去30天的流量趋势”
- “我的前十页是什么?”
- “我的交通从哪里来?”
- “将本月的访客与上个月的访客进行比较”
- “现在我的网站上有多少人?”
环境变量
| 变量 | 必填 | 默认 | 描述 |
|---|---|---|---|
PLAUSIBLE_API_KEY | 是 | - | 您合理的API密钥 |
PLAUSIBLE_BASE_URL | 没有 | https://plausible.io | 自托管实例的基本URL |
发展
git clone https://github.com/Defilan/plausible-mcp.git
cd plausible-mcp
npm install
npm run build要在本地进行测试:
PLAUSIBLE_API_KEY=your-key node dist/index.js许可证
麻省理工学院
