yourtraffic
Enables agents to access web analytics statistics via OAuth, providing a privacy-first, cookie-free analytics service.
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/yourtraffic
cd yourtraffic
npm 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 withopenssl rand -base64 32. Never ship the default, since visitor hashes are salted from it.BETTER_AUTH_URL. The public origin of your deployment, likehttps://analytics.example.com. Usehttp://localhost:3000in 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_IDandGOOGLE_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 addBETTER_AUTH_URL+/api/auth/callback/googleas 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 dev
open 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 install
vc 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:generate
npm 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.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.