Plausible Analytics MCP

io.github.surendranb由 GitHub 账号 surendranb 发布v0.1.3更新于 Nov 3, 2026

Plausible Analytics MCP: privacy-first website stats, real-time visitors, breakdowns, and trends.

概览

AI 生成的概览

面向 Plausible Analytics 的只读 MCP 服务器,让助手获取网站流量汇总、细分数据、趋势和实时访客数。

可以做什么
  • 获取访客数、浏览量、跳出率和访问时长等站点汇总指标
  • 按页面、来源、国家、浏览器、操作系统或设备细分指标
  • 获取用于绘图的历史时间序列数据以及当前实时访客数
  • 测试 API 连通性并校验已配置的令牌
  • 列出并读取内置的分析方法与操作手册,检查软件包更新
适用场景
适合让助手回答 Plausible 云端或自建站点的流量问题、快速生成报告或趋势摘要,或查看当前在线访客,而无需打开仪表盘。
运行要求
以 stdio 方式在本地运行,通常通过 uvx(Python)或 npx 桥接启动。需要在 PLAUSIBLE_API_KEY 中提供 Plausible Stats/Sites API 令牌,或通过工具参数传入。自建实例可选用 PLAUSIBLE_BASE_URL,默认连接 Plausible 云端。需要能访问 Plausible 实例的网络。
安装前请注意
该 API 令牌可访问你的分析数据,应放在环境变量中而非共享配置里。README 提到默认开启匿名遥测,可通过 DO_NOT_TRACK=1 关闭。工具本身为只读,但站点 ID 和令牌会发送到所配置的 Plausible 端点。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Plausible Analytics MCP,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

plausible-mcp

[PyPI version] [npm version] [License: MIT]

Fast, privacy-first Plausible Analytics Model Context Protocol (MCP) server for AI coding agents and LLM harnesses. Works seamlessly with both Plausible Cloud and self-hosted Plausible installations.

Quick Start

Run with uvx (Python)

bash
export PLAUSIBLE_API_KEY="your_api_key_here"uvx plausible-mcp

Run with npx (Node / npm bridge)

bash
export PLAUSIBLE_API_KEY="your_api_key_here"npx -y plausible-analytics-mcp

Environment Configuration

VariableDescriptionDefault
PLAUSIBLE_API_KEYYour Plausible Stats/Sites API tokenRequired (or pass via tool token arg)
PLAUSIBLE_BASE_URLBase URL for self-hosted Plausiblehttps://plausible.io
DO_NOT_TRACKSet to 1 to disable anonymous telemetry0

Getting an API Key

  1. Log in to Plausible (Cloud or your self-hosted instance).
  2. Go to Settings (user profile menu) -> API Keys.
  3. Click + New Key, name it mcp-agent, and copy the token.
  4. Export as PLAUSIBLE_API_KEY="your_token".

Available Tools

ToolDescription
get_aggregate_stats(site_id, date_range="30d", metrics=None, token=None)High-level visitor, pageview, bounce rate, and session duration totals
get_breakdown(site_id, property_name="event:page", date_range="30d", limit=20, token=None)Segment metrics by pages, traffic sources, countries, browsers, OS, devices
get_realtime_visitors(site_id, token=None)Current count of active visitors on the site right now
get_timeseries(site_id, date_range="30d", interval="date", token=None)Daily or monthly trendline data points for chart generation
doctor(token=None)Test Plausible API connectivity and validate the configured API token
skills_list()List dynamic analytics playbooks and methodology guides
skill_read(name)Fetch full markdown playbook by name (e.g. plausible-overview, analytics-recipes)
check_for_updates()Check PyPI for newer versions and view upgrade commands

Error Absorption Standard

Errors returned to agents are explicitly classified:

  • [INPUT_FIXABLE]: Parameter errors (e.g., misspelled site_id, unknown dimension). Fix arguments and retry.
  • [ENVIRONMENT_FIXABLE: STOP & ASK HUMAN]: Missing, expired, or unauthorized API key. Prompt user with guided setup steps.
  • [TRANSIENT]: Upstream rate limits (HTTP 429) or network hiccups. Wait briefly and retry.

MCP Client Setup

Claude Desktop (claude_desktop_config.json)

json
{  "mcpServers": {    "plausible": {      "command": "uvx",      "args": ["plausible-mcp"],      "env": {        "PLAUSIBLE_API_KEY": "YOUR_PLAUSIBLE_API_KEY"      }    }  }}

Or using the npm bridge:

json
{  "mcpServers": {    "plausible": {      "command": "npx",      "args": ["-y", "plausible-analytics-mcp"],      "env": {        "PLAUSIBLE_API_KEY": "YOUR_PLAUSIBLE_API_KEY"      }    }  }}

License

MIT License. See LICENSE for details.

来源:README.md,提交 b20381a

工具

8

get_aggregate_stats

Get aggregate website performance totals: visitors, pageviews, bounce_rate, and visit_duration. Args: site_id: Domain name of the site in Plausible (e.g. 'surendranb.com', 'freeinference.dev'). date_range: Time period ('day', 'today', 'yesterday', '7d', '30d', 'month', '6mo', '12mo', or 'YYYY-MM-DD,YYYY-MM-DD'). Default '30d'. metrics: Optional list of metrics (e.g. ['visitors', 'pageviews', 'bounce_rate', 'visit_duration', 'visits']). Defaults to standard 4 metrics. token: Optional Plausible API token. If omitted, uses PLAUSIBLE_API_KEY environment variable.

输入参数tokenmetricssite_id必填date_range

get_breakdown

Get metrics breakdown by dimension: pages, sources, countries, browsers, operating systems, or devices. Args: site_id: Domain name of the site in Plausible (e.g. 'surendranb.com'). property_name: Dimension to segment by. Accepts aliases: 'page', 'source', 'country', 'browser', 'os', 'device', 'entry_page', 'exit_page', 'city', 'region', or full Plausible names like 'event:page', 'visit:source'. date_range: Time period ('day', '7d', '30d', 'month', '6mo', '12mo', or 'YYYY-MM-DD,YYYY-MM-DD'). Default '30d'. limit: Maximum number of rows to return (default 20, max 100). token: Optional Plausible API token. If omitted, uses PLAUSIBLE_API_KEY environment variable.

输入参数limittokensite_id必填date_rangeproperty_name

get_realtime_visitors

Get the current count of active real-time visitors on the website right now. Args: site_id: Domain name of the site in Plausible (e.g. 'surendranb.com'). token: Optional Plausible API token. If omitted, uses PLAUSIBLE_API_KEY environment variable.

输入参数tokensite_id必填

get_timeseries

Get historical timeseries trendlines (visitors, pageviews) over time for plotting charts. Args: site_id: Domain name of the site in Plausible (e.g. 'surendranb.com'). date_range: Time period ('day', '7d', '30d', 'month', '6mo', '12mo', or 'YYYY-MM-DD,YYYY-MM-DD'). Default '30d'. interval: Aggregation bucket: 'date' (daily) or 'month' (monthly). Default 'date'. token: Optional Plausible API token. If omitted, uses PLAUSIBLE_API_KEY environment variable.

输入参数tokensite_id必填intervaldate_range

doctor

Test connectivity to Plausible Cloud or self-hosted instance (PLAUSIBLE_BASE_URL) and validate API token. Args: token: Optional Plausible API token to test. If omitted, tests PLAUSIBLE_API_KEY from environment.

输入参数token

skills_list

List available Plausible Analytics operational skills and playbooks.

无需输入参数。

skill_read

Fetch guidance and analytical playbooks for Plausible Analytics by name. Args: name: Name of skill to read (e.g. 'plausible-overview', 'analytics-recipes'). Call skills_list() to view all.

输入参数name必填

check_for_updates

Check PyPI for newer versions of plausible-mcp and get upgrade instructions.

无需输入参数。

版本历史

1
  1. v0.1.3最新Oct 29, 2026

评分

已满足适用检查项的 90%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分
  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具必需15 分
  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分