plausible-whenever-mcp
MCP server that provides read access to Plausible Analytics data with natural-language date resolution, enabling users to query analytics like 'yesterday' or 'last week' without needing to know exact date formats.
README
plausible-whenever-mcp
The Plausible Analytics MCP server that finally understands "yesterday".
A local Model Context Protocol server that gives an AI assistant full read access to your Plausible data — and, crucially, resolves natural-language dates (yesterday, last week, last 30 days, 3 days ago…) in your site's own timezone. So prompts like "analyze yesterday's traffic" just work, even with small local LLMs.
Why this exists
The Plausible Stats API has presets like day, 7d and month, but no "yesterday" — and to query a specific past day you must send explicit YYYY-MM-DD dates. LLMs (especially smaller local models) routinely get this wrong because they don't reliably know today's date or your site's timezone. The result: "yesterday" silently returns the wrong range, or the model burns turns guessing date formats (/, .., YYYYMMDD, date vs date_range…) and gives up.
This server moves all of that to the server side. The model says date_range: "yesterday"; the server computes the exact dates in your site's timezone before calling Plausible. There is no tool where the model must know Plausible's native date format — and if it ever passes something unrecognizable, the error message lists exactly what's accepted.
Features
- 🗓️ Natural-language dates resolved in the site timezone — keywords, synonyms,
N days ago,last N days/weeks/months, single dates, and ranges with,../ortoseparators. - 🧰 8 tools covering the full read API: sites, realtime, aggregates, time series, breakdowns, period comparison, plus a raw query escape hatch — and all of them resolve friendly dates.
- 🏠 Self-hosted friendly — works against any Plausible instance via
PLAUSIBLE_BASE_URL, with aPLAUSIBLE_TIMEZONEoverride for instances where the Sites API (timezone auto-detect) is disabled. - 🤖 Tuned for local LLMs — forgiving inputs, self-explaining errors, and clean tool output (no HTML dumps).
- 🔒 Read-only — every tool only ever reads your analytics.
Tools
| Tool | What it does |
|---|---|
list_sites |
List sites your API key can access (with timezones). |
get_current_time |
Today + yesterday as concrete dates in a site's timezone. |
get_realtime_visitors |
People on the site right now. |
get_stats |
Aggregate totals for a period (visitors, pageviews, bounce rate…). |
get_timeseries |
Traffic over time (hour/day/week/month) for trends and charts. |
get_breakdown |
Top pages, sources, countries, devices, browsers, UTM tags… |
compare_periods |
Two periods side by side with absolute + % deltas. |
query |
Raw Stats API v2 escape hatch for anything else. |
Date expressions accepted everywhere
- Keywords (resolved in the site timezone):
today,yesterday,this_week,last_week,this_month,last_month,this_year,last_year,last_7_days,last_30_days,last_90_days,last_12_months - Natural phrasing & synonyms:
3 days ago,day before yesterday,last 14 days,last 6 months,previous month,the last week,ytd,mtd,all time, … - Plausible presets:
day,7d,30d,month,6mo,12mo,year,all - A single date:
2024-03-15→ that one day - An explicit range (any separator):
2024-01-01,2024-01-31,2024-01-01..2024-01-31,2024-01-01/2024-01-31,2024-01-01 to 2024-01-31
Install
Requires Node.js ≥ 18 and a Plausible Stats API key (Plausible dashboard → Settings → API Keys; on self-hosted: <your-instance>/settings/api-keys).
git clone https://github.com/Schneckenhausmann/plausible-whenever-mcp.git
cd plausible-whenever-mcp
npm install
npm run build
Configure
Set environment variables (see .env.example):
| Variable | Required | Description |
|---|---|---|
PLAUSIBLE_API_KEY |
Yes | Your Plausible Stats API key. |
PLAUSIBLE_BASE_URL |
No | Self-hosted instance URL (default https://plausible.io). |
PLAUSIBLE_DEFAULT_SITE_ID |
No | Default site domain so you can omit site_id on every call. |
PLAUSIBLE_TIMEZONE |
No | IANA timezone (e.g. Europe/Berlin) for relative dates. Recommended on self-hosted instances where the Sites API is disabled (otherwise falls back to UTC). |
Connect to Claude Desktop
~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"plausible": {
"command": "node",
"args": ["/absolute/path/to/plausible-whenever-mcp/dist/index.js"],
"env": {
"PLAUSIBLE_API_KEY": "your-key",
"PLAUSIBLE_DEFAULT_SITE_ID": "example.com"
}
}
}
}
For a self-hosted instance, add PLAUSIBLE_BASE_URL and PLAUSIBLE_TIMEZONE:
{
"mcpServers": {
"plausible": {
"command": "node",
"args": ["/absolute/path/to/plausible-whenever-mcp/dist/index.js"],
"env": {
"PLAUSIBLE_API_KEY": "your-key",
"PLAUSIBLE_BASE_URL": "https://analytics.example.com",
"PLAUSIBLE_DEFAULT_SITE_ID": "example.com",
"PLAUSIBLE_TIMEZONE": "Europe/Berlin"
}
}
}
}
Connect to Claude Code
claude mcp add plausible \
--env PLAUSIBLE_API_KEY=your-key \
--env PLAUSIBLE_DEFAULT_SITE_ID=example.com \
-- node /absolute/path/to/plausible-whenever-mcp/dist/index.js
Example prompts that just work
- "Look at yesterday's data for example.com and analyze it."
- "Top 10 pages last week vs the week before."
- "Show the hourly visitor trend for yesterday — we had a spike in the morning."
- "Which countries drove the most traffic last month?"
Self-hosted note
On Plausible Community Edition the Sites API (/api/v1/sites) is often disabled, so:
list_siteswill reportsites_api_available: falseand point at your configured default — this is expected and does not affect any stats queries.- Timezones can't be auto-detected, so set
PLAUSIBLE_TIMEZONEto keep relative dates correct.
Develop
npm run build # compile TypeScript -> dist/
npm run dev # tsc --watch
npm test # build + run the date-resolver test suite
npm run inspector # open the MCP Inspector against the server
Acknowledgments
Built fresh, but inspired by two excellent MIT-licensed projects — thank you to their authors:
- Defilan/plausible-mcp by Defilan — clean stdio tool surface.
- getsentry/plausible-mcp by Sergiy Dybskiy — per-tool architecture and the period-comparison idea.
Full third-party license notices are in CREDITS.md.
License
MIT © 2026 Nikias Herzhauser
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。