Yourtraffic

io.github.kozmos-tech由 GitHub 账号 kozmos-tech 发布v0.1.1更新于 Oct 24, 2026

Open-source, privacy-first web analytics for tracking your sites' traffic.

已验证STDIO仅桌面开发者工具数据与分析

概览

AI 生成的概览

让助手通过受 OAuth 保护的 MCP 端点,读取自托管、隐私优先的网站分析部署中的流量统计数据。

可以做什么
YourTraffic 是一个开源、不使用 Cookie 的网站分析应用,同时提供原生 MCP 服务器。助手连接到该部署的 /mcp 端点,通过 OAuth 登录授权后读取该实例中所跟踪站点的统计数据。同样的数据也可以通过 /api/v1/stats 的 REST API 使用每个项目的 API 密钥获取。它的定位是读取分析数据,而不是管理站点本身。
适用场景
当你已经自托管或计划自托管 YourTraffic,并希望助手直接获取站点流量数据、而不必从仪表盘手动复制时使用。如果你没有运行 YourTraffic 实例,它就没有用处,因为 MCP 端点位于你自己的部署上。
运行要求
需要一个助手可访问的自托管 YourTraffic 部署,以及该部署自身的前置条件:Node 20 或更高版本、Vercel CLI 和一个 Postgres 数据库。服务器需要配置 DATABASE_URL、BETTER_AUTH_SECRET 和 BETTER_AUTH_URL,且 BETTER_AUTH_URL 必须是精确的公开源地址,因为 MCP 客户端据此发现 OAuth。可选的 Google 登录需要 GOOGLE_CLIENT_ID 和 GOOGLE_CLIENT_SECRET。npm 包通过 stdio 在本地运行,仅支持桌面端。
安装前请注意
MCP 端点使用 OAuth,因此批准某个助手即授予其访问你的分析数据的权限,请确认你授权的是哪个客户端。BETTER_AUTH_SECRET 用于为访客哈希加盐,弱值或默认值会削弱隐私保护,绝不能原样上线。DATABASE_URL 是完整的 Postgres 连接字符串,属于凭据。Google OAuth 凭据是可选项,但启用后即为机密。README 说明不收集 Cookie 和个人数据。

安装

在 SourceWeft 中

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

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

其他 MCP 客户端

参照 仓库 中的启动说明。

README

YourTraffic

Open-source, privacy-first web analytics. Unlimited websites, a first-class REST API and a native MCP server for agents. No cookies, no personal data, no consent banners.

Self-hosting

Prerequisites

  • Vercel CLI installed globally
  • A Postgres database
  • Node 20 or newer

Set up

Clone the repo and install dependencies.

git clone https://github.com/kozmos-tech/yourtrafficcd yourtrafficnpm install

Copy the example env file and fill it in.

cp .env.example .env
  • DATABASE_URL. Your Postgres connection string. The app fails to start without it.
  • BETTER_AUTH_SECRET. A long random secret. Generate one with openssl rand -base64 32. Never ship the default, since visitor hashes are salted from it.
  • BETTER_AUTH_URL. The public origin of your deployment, like https://analytics.example.com. Use http://localhost:3000 in development. This is also the origin MCP clients discover for OAuth, so it must be the exact public URL with no trailing path.
  • GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET. Optional. Set both to enable Google sign-in on the login and signup pages. Create OAuth credentials in the Google Cloud console and add BETTER_AUTH_URL + /api/auth/callback/google as an authorized redirect URI. Leave them blank to hide the Google button.

Create the database tables before the first run.

npm run db:migrate

Run it

vc devopen http://localhost:3000

Sign in, add a website, then drop the shown snippet into the <head> of your site. Stats appear within seconds of the first visit.

Deploy

npm installvc deploy

Set DATABASE_URL, BETTER_AUTH_SECRET and BETTER_AUTH_URL in your Vercel project settings, then run the migration against your production database.

Database

Schema lives in src/db/schema.ts. Generate a migration after changing it, then apply it.

npm run db:generatenpm run db:migrate

Reading your stats

Every project has an api key, shown under Settings in the dashboard.

  • REST API. Pass the key as a Bearer token to /api/v1/stats. See llms.txt for the full guide.
  • MCP server. Point an agent at /mcp. It uses OAuth, so you sign in to approve access and no api key is needed.

来源:README.md,提交 c50080e

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.1.1最新Sep 16, 2026

评分

已满足适用检查项的 50%

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

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

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

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分