Skip to content

🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.

Add MCP documentation: introduce pages for Claude Code, Claude Desktop, Codex, Cursor, opencode, and VS Code integrations with Rybbit's MCP server. Each page details connection methods via OAuth or API key, client setup instructions, and verification steps, enhancing user guidance for analytics integration.

Bill Yang5a7e4ce4420a
diff --git a/docs/content/docs/(docs)/mcp/claude-code.mdx b/docs/content/docs/(docs)/mcp/claude-code.mdx
new file mode 100644
index 000000000..32822db53
--- /dev/null
+++ b/docs/content/docs/(docs)/mcp/claude-code.mdx
@@ -0,0 +1,68 @@
+---
+title: Claude Code
+description: Connect Claude Code to Rybbit's MCP server with OAuth or an API key
+---
+
+Connecting Claude Code to Rybbit lets it answer analytics questions mid-task β€” whether the error it just fixed still occurs in production, which pages get traffic before a refactor, whether a newly instrumented event is firing β€” and wire up goals and funnels as you ship features.
+
+This page covers client setup only. The [MCP overview](/docs/mcp) covers the endpoint, API keys and scopes, the full tool list, and troubleshooting.
+
+## Connect with OAuth
+
+The simplest way to connect β€” no API key to create or store:
+
+```bash
+claude mcp add --transport http rybbit https://app.rybbit.io/api/mcp
+```
+
+For a self-hosted installation, replace the host with your configured `BASE_URL`.
+
+Then run `/mcp` inside a Claude Code session, select **rybbit**, and choose **Authenticate**. Your browser opens to log in to Rybbit and approve access, and the connection acts with your user's role.
+
+By default the server registers at the `local` scope β€” available to you in the current project only. Add `--scope user` to use it in all of your projects.
+
+## Team setup
+
+OAuth makes the team setup trivial: commit a project-scoped `.mcp.json` at the repository root containing only the URL, and each developer authenticates once with `/mcp`. No secret ever touches the repo:
+
+```json
+{
+ "mcpServers": {
+ "rybbit": {
+ "type": "http",
+ "url": "https://app.rybbit.io/api/mcp"
+ }
+ }
+}
+```
+
+## Connect with an API key
+
+Use an [API key](/docs/mcp#1-create-an-api-key) instead when there is no browser to authenticate in (CI, headless `claude -p` runs) or when you want to hand the agent a narrower, scoped credential:
+
+```bash
+claude mcp add --transport http rybbit https://app.rybbit.io/api/mcp \
+ --header "Authorization: Bearer <RYBBIT_API_KEY>"
+```
+
+In a committed `.mcp.json`, pass the key through an environment variable rather than hard-coding it β€” Claude Code expands `${VAR}` references from each developer's environment:
+
+```json
+{
+ "mcpServers": {
+ "rybbit": {
+ "type": "http",
+ "url": "https://app.rybbit.io/api/mcp",
+ "headers": {
+ "Authorization": "Bearer ${RYBBIT_API_KEY}"
+ }
+ }
+ }
+}
+```
+
+## Verify
+
+Run `claude mcp list` (or `/mcp` inside a session) to confirm the server shows as connected, then try:
+
+> List my Rybbit sites and summarize last week's traffic for each.
diff --git a/docs/content/docs/(docs)/mcp/claude-desktop.mdx b/docs/content/docs/(docs)/mcp/claude-desktop.mdx
new file mode 100644
index 000000000..e25712f53
--- /dev/null
+++ b/docs/content/docs/(docs)/mcp/claude-desktop.mdx
@@ -0,0 +1,41 @@
+---
+title: Claude Desktop
+description: Add Rybbit as a custom connector on claude.ai, Claude Desktop, and mobile
+---
+
+import { Callout } from "fumadocs-ui/components/callout";
+
+Adding Rybbit as a custom connector turns Claude into a conversational analytics interface: ask how a launch went, why traffic spiked on Tuesday, or where a funnel drops off β€” without opening the dashboard. Connectors are shared across claude.ai, Claude Desktop, and the mobile apps.
+
+This page covers client setup only. The [MCP overview](/docs/mcp) covers the endpoint, the full tool list, permissions, and troubleshooting.
+
+## Add the connector
+
+1. Open **Settings β†’ Connectors** (in Claude Desktop: `Cmd/Ctrl + ,`, then **Connectors**; on claude.ai: your profile menu β†’ **Settings** β†’ **Connectors**).
+2. Click **Add custom connector**.
+3. Name it **Rybbit** and paste the endpoint URL:
+
+ ```text
+ https://app.rybbit.io/api/mcp
+ ```
+
+ For a self-hosted installation, use your configured `BASE_URL` host instead.
+
+4. Confirm, then click **Connect**. Your browser opens Rybbit's [OAuth flow](/docs/mcp#or-connect-with-oauth) β€” log in and approve access. The connector acts with your user's role.
+
+There is no API key to manage: custom connectors authenticate through OAuth, and the **Advanced settings** fields (OAuth client ID and secret) can stay empty β€” Rybbit registers the client automatically. Custom connectors are available on all Claude plans; the Free plan is limited to one.
+
+<Callout type="warn">
+ **Self-hosted installations must be publicly reachable.** Claude connects to
+ custom connectors from Anthropic's infrastructure, not from your device β€” a
+ Rybbit instance on a private network, behind a VPN, or on `localhost` will
+ not connect, even if you can reach it in your own browser.
+</Callout>
+
+## Use it
+
+Once connected, Rybbit appears in the chat's tools menu β€” enable it there if it isn't already. Then try:
+
+> List my Rybbit sites and summarize last month's traffic for the main one.
+
+Claude asks for confirmation before tool calls by default; destructive tools (deleting goals, funnels, sites) are marked so it always confirms those.
diff --git a/docs/content/docs/(docs)/mcp/codex.mdx b/docs/content/docs/(docs)/mcp/codex.mdx
new file mode 100644
index 000000000..c899dc6cc
--- /dev/null
+++ b/docs/content/docs/(docs)/mcp/codex.mdx
@@ -0,0 +1,44 @@
+---
+title: Codex
+description: Connect the Codex CLI to Rybbit's MCP server with OAuth or an API key
+---
+
+Connecting Codex to Rybbit lets it check analytics as part of your development workflow β€” verifying that a fixed error stopped occurring, checking which routes get traffic before a refactor, or creating goals and funnels for features as you ship them.
+
+This page covers client setup only. The [MCP overview](/docs/mcp) covers the endpoint, API keys and scopes, the full tool list, and troubleshooting.
+
+## Connect with OAuth
+
+The simplest way to connect β€” add the server and log in:
+
+```bash
+codex mcp add rybbit --url https://app.rybbit.io/api/mcp
+codex mcp login rybbit
+```
+
+For a self-hosted installation, replace the host with your configured `BASE_URL`.
+
+`codex mcp login` opens your browser to log in to Rybbit and approve access; the connection acts with your user's role.
+
+## Connect with an API key
+
+Use an [API key](/docs/mcp#1-create-an-api-key) instead for non-interactive runs or a narrower, scoped credential. Register the name of an environment variable holding the key:
+
+```bash
+codex mcp add rybbit --url https://app.rybbit.io/api/mcp \
+ --bearer-token-env-var RYBBIT_API_KEY
+```
+
+Codex reads the key from that variable rather than storing it, so `RYBBIT_API_KEY` must be exported in the shell that launches Codex. Equivalently, configure it in `~/.codex/config.toml`:
+
+```toml
+[mcp_servers.rybbit]
+url = "https://app.rybbit.io/api/mcp"
+bearer_token_env_var = "RYBBIT_API_KEY"
+```
+
+## Verify
+
+Run `codex mcp list` (or `/mcp` inside the Codex TUI) to confirm the server is connected, then try:
+
+> List my Rybbit sites and summarize last week's traffic for each.
diff --git a/docs/content/docs/(docs)/mcp/cursor.mdx b/docs/content/docs/(docs)/mcp/cursor.mdx
new file mode 100644
index 000000000..b340660bb
--- /dev/null
+++ b/docs/content/docs/(docs)/mcp/cursor.mdx
@@ -0,0 +1,36 @@
+---
+title: Cursor
+description: Connect Cursor to Rybbit's MCP server with an API key
+---
+
+Connecting Cursor to Rybbit lets its agent check analytics while you code β€” confirming an error fix landed in production, checking traffic to a route before deleting it, or setting up goals and funnels for a new feature.
+
+This page covers client setup only. The [MCP overview](/docs/mcp) covers the endpoint, API keys and scopes, the full tool list, and troubleshooting.
+
+## Add the server
+
+1. [Create an API key](/docs/mcp#1-create-an-api-key) in Rybbit.
+2. Add the server to `~/.cursor/mcp.json` (global β€” available in all projects) or `.cursor/mcp.json` in a project:
+
+```json
+{
+ "mcpServers": {
+ "rybbit": {
+ "url": "https://app.rybbit.io/api/mcp",
+ "headers": {
+ "Authorization": "Bearer <RYBBIT_API_KEY>"
+ }
+ }
+ }
+}
+```
+
+For a self-hosted installation, replace the host with your configured `BASE_URL`.
+
+Prefer the global file for a personal key. If you configure the server in a project's `.cursor/mcp.json`, don't commit the key β€” give each developer their own, ideally [scoped](/docs/mcp#1-create-an-api-key) to what the agent needs.
+
+## Verify
+
+Open **Cursor Settings β†’ MCP**: the server should show as connected with its tool list, and can be toggled on and off there. Then ask the agent:
+
+> List my Rybbit sites and summarize last week's traffic for each.
diff --git a/docs/content/docs/(docs)/mcp.mdx b/docs/content/docs/(docs)/mcp/index.mdx
similarity index 86%
rename from docs/content/docs/(docs)/mcp.mdx
rename to docs/content/docs/(docs)/mcp/index.mdx
index afb625365..2587c0062 100644
--- a/docs/content/docs/(docs)/mcp.mdx
+++ b/docs/content/docs/(docs)/mcp/index.mdx
@@ -4,6 +4,8 @@ description: Let an AI assistant explore and manage your Rybbit analytics throug
---
import { Callout } from "fumadocs-ui/components/callout";
+import { Cards, Card } from "fumadocs-ui/components/card";
+import { SiClaude } from "@icons-pack/react-simple-icons";
Rybbit includes a hosted [Model Context Protocol](https://modelcontextprotocol.io/) (MCP) endpoint. It gives an AI assistant read and write access to your analytics: exploring traffic and behavior data, and managing sites, goals, funnels, organization members, teams, and user profiles β€” through the same API the dashboard uses, with the same access checks, roles, and rate limits.
@@ -11,6 +13,8 @@ Your MCP client connects to Rybbit over HTTPS and sends your API key with each p
## Connect a client
+If your client supports the MCP authorization flow β€” Claude Code, Codex, Claude Desktop, and opencode all do β€” you can [connect with OAuth](#or-connect-with-oauth) and skip API keys entirely. The steps below describe the API-key path, which works in every client and supports scoped credentials.
+
### 1. Create an API key
1. Open **Settings β†’ Account** in Rybbit.
@@ -54,7 +58,7 @@ MCP clients use different configuration formats. A typical remote-server configu
}
```
-Use your client's secret or environment-variable support when available instead of saving the key in a file. Query-string API keys are not accepted by the MCP endpoint.
+Use your client's secret or environment-variable support when available instead of saving the key in a file. Query-string API keys are not accepted by the MCP endpoint. Per-client walkthroughs β€” Claude Code, Codex, Claude Desktop, Cursor, VS Code, opencode β€” are in [Client guides](#client-guides) below.
### Or connect with OAuth
@@ -62,11 +66,6 @@ Clients that support the MCP authorization flow can skip API keys entirely: add
OAuth grants support the same `resource:action` scopes as API keys (advertised in `scopes_supported`). A grant that requests only the standard OIDC scopes is unrestricted; a grant that requests custom scopes like `analytics:read` is limited to them. The requesting client controls which scopes it asks for β€” consent is currently approve-or-deny as a whole.
-<Callout type="info">
- Self-hosted instances need the OAuth tables created once before OAuth clients can connect: run `npm run db:push` in
- `server/` after upgrading. API-key authentication works regardless.
-</Callout>
-
### 3. Start with context
Ask the assistant to call `list_sites`, or prompt it with something like:
@@ -75,6 +74,47 @@ Ask the assistant to call `list_sites`, or prompt it with something like:
`list_sites` returns the numeric `site_id` and `organization_id` required by the other tools, plus the key's role in each organization. It does not return API keys or member email addresses.
+## Client guides
+
+Coding agents can use the endpoint to pull analytics into your development workflow β€” checking whether an error you just fixed still occurs in production, or looking up which pages matter before a refactor β€” and chat clients like Claude Desktop turn it into a conversational analytics interface. Follow the guide for your client:
+
+<Cards>
+ <Card
+ icon={<SiClaude />}
+ title="Claude Code"
+ description="One command with OAuth or an API key, plus a no-secrets team setup"
+ href="/docs/mcp/claude-code"
+ />
+ <Card
+ title="Codex"
+ description="codex mcp add, then OAuth login or a key from the environment"
+ href="/docs/mcp/codex"
+ />
+ <Card
+ icon={<SiClaude />}
+ title="Claude Desktop"
+ description="Add a custom connector on claude.ai, desktop, and mobile"
+ href="/docs/mcp/claude-desktop"
+ />
+ <Card
+ title="Cursor"
+ description="mcp.json with an API key header"
+ href="/docs/mcp/cursor"
+ />
+ <Card
+ title="VS Code"
+ description="Copilot agent mode, with the key kept out of the config file"
+ href="/docs/mcp/vscode"
+ />
+ <Card
+ title="opencode"
+ description="Remote server config with OAuth login or env-based headers"
+ href="/docs/mcp/opencode"
+ />
+</Cards>
+
+Any other MCP client that supports Streamable HTTP works with the generic configuration from [step 2](#2-add-the-endpoint).
+
## Available tools
### Analytics (read)
diff --git a/docs/content/docs/(docs)/mcp/meta.json b/docs/content/docs/(docs)/mcp/meta.json
new file mode 100644
index 000000000..c6ff9e9ab
--- /dev/null
+++ b/docs/content/docs/(docs)/mcp/meta.json
@@ -0,0 +1,11 @@
+{
+ "title": "AI integrations (MCP)",
+ "pages": [
+ "claude-code",
+ "codex",
+ "claude-desktop",
+ "cursor",
+ "vscode",
+ "opencode"
+ ]
+}
diff --git a/docs/content/docs/(docs)/mcp/opencode.mdx b/docs/content/docs/(docs)/mcp/opencode.mdx
new file mode 100644
index 000000000..382635126
--- /dev/null
+++ b/docs/content/docs/(docs)/mcp/opencode.mdx
@@ -0,0 +1,61 @@
+---
+title: opencode
+description: Connect opencode to Rybbit's MCP server with OAuth or an API key
+---
+
+Connecting opencode to Rybbit lets it pull analytics into your terminal workflow β€” verifying an error fix in production, checking a route's traffic before removing it, or wiring up goals and funnels as you ship.
+
+This page covers client setup only. The [MCP overview](/docs/mcp) covers the endpoint, API keys and scopes, the full tool list, and troubleshooting.
+
+## Connect with OAuth
+
+Add the server to `opencode.json` at your project root (or your global opencode config):
+
+```json
+{
+ "$schema": "https://opencode.ai/config.json",
+ "mcp": {
+ "rybbit": {
+ "type": "remote",
+ "url": "https://app.rybbit.io/api/mcp",
+ "enabled": true
+ }
+ }
+}
+```
+
+For a self-hosted installation, replace the host with your configured `BASE_URL`.
+
+Then authenticate:
+
+```bash
+opencode mcp auth rybbit
+```
+
+Your browser opens Rybbit's [OAuth flow](/docs/mcp#or-connect-with-oauth) β€” log in and approve access. The connection acts with your user's role, and the committed config carries no secret. `opencode mcp logout rybbit` removes the stored credential.
+
+## Connect with an API key
+
+To use an [API key](/docs/mcp#1-create-an-api-key) instead β€” for non-interactive runs or a narrower, scoped credential β€” add a headers block that reads the key from the environment, so the config stays committable:
+
+```json
+{
+ "$schema": "https://opencode.ai/config.json",
+ "mcp": {
+ "rybbit": {
+ "type": "remote",
+ "url": "https://app.rybbit.io/api/mcp",
+ "enabled": true,
+ "headers": {
+ "Authorization": "Bearer {env:RYBBIT_API_KEY}"
+ }
+ }
+ }
+}
+```
+
+## Verify
+
+Run `opencode mcp list` to see the server and its authentication status (`opencode mcp debug rybbit` gives detailed diagnostics), then try:
+
+> List my Rybbit sites and summarize last week's traffic for each.
diff --git a/docs/content/docs/(docs)/mcp/vscode.mdx b/docs/content/docs/(docs)/mcp/vscode.mdx
new file mode 100644
index 000000000..51c36391b
--- /dev/null
+++ b/docs/content/docs/(docs)/mcp/vscode.mdx
@@ -0,0 +1,45 @@
+---
+title: VS Code
+description: Connect VS Code and Copilot agent mode to Rybbit's MCP server
+---
+
+Connecting VS Code to Rybbit gives Copilot's agent mode access to your analytics β€” checking whether a fixed error still occurs, looking up which pages matter before a refactor, or creating goals for a feature as you build it.
+
+This page covers client setup only. The [MCP overview](/docs/mcp) covers the endpoint, API keys and scopes, the full tool list, and troubleshooting.
+
+## Add the server
+
+1. [Create an API key](/docs/mcp#1-create-an-api-key) in Rybbit.
+2. Create `.vscode/mcp.json` in your workspace. The `inputs` block keeps the key out of the file β€” VS Code prompts for it once when the server first starts and stores it securely, so this file is safe to commit:
+
+```json
+{
+ "inputs": [
+ {
+ "type": "promptString",
+ "id": "rybbit-api-key",
+ "description": "Rybbit API key",
+ "password": true
+ }
+ ],
+ "servers": {
+ "rybbit": {
+ "type": "http",
+ "url": "https://app.rybbit.io/api/mcp",
+ "headers": {
+ "Authorization": "Bearer ${input:rybbit-api-key}"
+ }
+ }
+ }
+}
+```
+
+For a self-hosted installation, replace the host with your configured `BASE_URL`.
+
+To make the server available in every workspace instead, run **MCP: Open User Configuration** from the Command Palette and add the same JSON there. **MCP: Add Server** offers a guided setup as an alternative to editing the file.
+
+## Verify
+
+Run **MCP: List Servers** from the Command Palette β€” Rybbit should be listed with its tools, which also appear in the tools picker in Copilot's agent mode. Then ask the agent:
+
+> List my Rybbit sites and summarize last week's traffic for each.