# Convalytics

Web and product analytics for Convex apps. MCP server to chat with AI about your web traffic and product analytics.

## Quick Start

```bash
# Connect this server (installs CLI if needed)
npx -y @smithery/cli@latest mcp add dancleary54/convalytics

# Browse available tools
npx -y @smithery/cli@latest tool list dancleary54/convalytics

# Get full schema for a tool
npx -y @smithery/cli@latest tool get dancleary54/convalytics list_projects

# Call a tool
npx -y @smithery/cli@latest tool call dancleary54/convalytics list_projects '{}'
```

## Direct MCP Connection

Endpoint: `https://convalytics--dancleary54.run.tools`

**Required config:**
- `x-convalytics-token` (header) — Create one at https://convalytics.dev/tokens. The MCP endpoint requires the Solo ($29/mo) or Pro ($99/mo) plan.

**Optional config:**
- `x-convalytics-environment` (header) — Optional. Scope every query to one environment so mixed dev + prod traffic doesn't pollute results. Leave blank to include everything. Matches what the Environment toggle does on the convalytics.dev dashboard.

## Tools (9)

- `list_projects` — List all Convalytics projects on the team this token belongs to. Useful when the agent needs to confirm the project it'…
- `get_usage` — Return the current month's custom-event usage, monthly quota, retention days, and plan name for the team.
- `top_pages` — Return the top pages for a specific project, ranked by views in a time window. Default window is the last 7 days. Use l…
- `top_referrers` — Return the top referring hosts for a specific project, ranked by visit count in a time window. Includes '(direct)' for …
- `pageviews_count` — Count page views for a specific project in a time window. Page views are the automatic hits captured by the browser scr…
- `events_count` — Count CUSTOM PRODUCT events for a specific project in a time window, optionally filtered to one event name and/or one u…
- `recent_events` — Return the most recent custom events for a specific project, optionally filtered to one event name and/or one user. PII…
- `user_activity` — Composite snapshot of a specific user's activity on a project. Returns an identity block (visitorId, userEmail, userNam…
- `weekly_digest` — Composite snapshot of a project's web analytics over a lookback window. Returns unique visitors, pageviews, sessions, b…

```bash
# Get full input/output schema for a tool
npx -y @smithery/cli@latest tool get dancleary54/convalytics <tool-name>
```
