---
title: "Introducing the Kitbase MCP Server: Query Your Analytics with AI | Kitbase Blog"
description: "Connect Claude Code, Cursor, or any MCP client to Kitbase with @kitbase/analytics-mcp. Query visitors, events, and funnels in natural language."
canonical: https://kitbase.dev/blog/kitbase-mcp-server-launch
---

What if you could ask your AI assistant "How many visitors did we get last week?" and get an instant answer from your actual analytics data? Today, that's a reality.

We're launching `@kitbase/analytics-mcp` — an [MCP (Model Context Protocol)](https://modelcontextprotocol.io) server that connects your AI assistant directly to your Kitbase analytics. No dashboard tab-switching, no manual data exports. Just ask questions in natural language and get answers.

## Quick Start

Add the MCP server to your AI client in one command:

```bash
# Claude Code
claude mcp add kitbase-analytics -e KITBASE_API_KEY=sk_kitbase_your_key_here -- npx -y @kitbase/analytics-mcp

# Codex
codex mcp add kitbase-analytics -e KITBASE_API_KEY=sk_kitbase_your_key_here -- npx -y @kitbase/analytics-mcp
```

Or run it directly with `npx`:

```bash
npx -y @kitbase/analytics-mcp
```

## What Is MCP?

The Model Context Protocol (MCP) is an open standard that lets AI assistants connect to external data sources and tools. Think of it as a universal adapter between your AI coding assistant and the services you use every day.

With Kitbase's MCP server, your AI assistant gains direct access to your analytics data — visitors, events, users, sessions, funnels, journeys, and frustration signals — all queryable through natural conversation.

**How the pieces connect: your AI client talks MCP, the server talks to Kitbase**

```mermaid
flowchart LR
  A["Claude Code · Cursor ·<br/>any MCP client"] <-->|"MCP over stdio"| B["@kitbase/analytics-mcp"]
  B -->|"HTTPS + secret API key"| C["Kitbase API"]
  C --> D["Visitors · Events · Users ·<br/>Sessions · Funnels · Journeys ·<br/>Frustration signals"]
```

## What Can You Do With It?

The Kitbase MCP server exposes **15 tools** across seven categories, giving your AI assistant comprehensive access to your analytics:

### Web Analytics

Get the big picture on your traffic:

- **Summary KPIs**: Visitors, pageviews, bounce rate, visit duration — with percentage changes vs the previous period
- **Timelines**: Metrics over time for charting trends
- **Breakdowns**: Slice metrics by page, country, browser, OS, device, referrer, or UTM parameters
- **Period comparison**: Compare two time ranges to see what changed the most

### Events

Drill into your custom event data:

- **List events**: Filter by event name, user, or date range
- **Event stats**: Aggregated counts, timelines, and property breakdowns

### Users

Understand individual user behavior:

- **List and search users** by name, email, or user ID
- **User summaries**: Total events, first/last seen, top events
- **Activity heatmaps**: Daily activity data over configurable time ranges
- **User event history**: Full paginated event list per user

### Sessions

Explore session-level data:

- **List sessions** with date filtering and sorting
- **Session detail**: Every event within a single session

### Funnels

Measure conversion across multi-step flows:

- Define ordered funnel steps with event names and optional filters
- Get conversion rates between each step
- Identify exactly where users drop off

### Journeys

Visualize how users navigate your product:

- Analyze common navigation paths between pages
- Scope analysis to specific start and/or end pages
- Control path depth for focused or broad analysis

### Frustration Signals

Surface UX issues automatically:

- Detect rage clicks and dead clicks
- See the top pages and elements where users show frustration
- Catch problems before users report them

## Setup in 2 Minutes

### 1. Get a Private API Key

Generate a private API key from your Kitbase dashboard under **Settings > API Keys**. It must start with `sk_kitbase_`.

### 2. Configure Your AI Client

#### Claude Code

Add to your `.claude/settings.json` or project-level `.mcp.json`:

```json
{
  "mcpServers": {
    "kitbase-analytics": {
      "command": "npx",
      "args": ["@kitbase/analytics-mcp"],
      "env": {
        "KITBASE_API_KEY": "sk_kitbase_your_key_here"
      }
    }
  }
}
```

#### Cursor

Add to your `.cursor/mcp.json`:

```json
{
  "mcpServers": {
    "kitbase-analytics": {
      "command": "npx",
      "args": ["@kitbase/analytics-mcp"],
      "env": {
        "KITBASE_API_KEY": "sk_kitbase_your_key_here"
      }
    }
  }
}
```

#### Other MCP Clients

The server communicates over stdio using the standard MCP protocol. Any MCP-compatible client works with the same configuration.

### 3. Start Asking Questions

That's it. Your AI assistant can now query your Kitbase data directly.

## Example Prompts

Here are some things you can ask once the MCP server is connected:

| What You Ask | What Happens |
|--------------|--------------|
| "How many visitors did we get last week?" | Fetches summary KPIs for the last 7 days |
| "What are our top pages by pageviews this month?" | Breaks down pageviews by page |
| "Show me the traffic trend for the past 30 days" | Returns timeseries data for visitors |
| "What countries are our users coming from?" | Breaks down visitors by country |
| "Compare this week's traffic to last week by country" | Compares two periods side by side |
| "How many signup events happened today?" | Returns event stats for the day |
| "Show me the signup funnel conversion rate" | Analyzes a multi-step funnel |
| "What's the most common user journey from the homepage?" | Traces navigation paths |
| "Which pages have the most rage clicks this week?" | Returns frustration signal report |
| "Show me a summary of user U-123's activity" | Fetches comprehensive user analytics |

## Why This Matters

Analytics tools are powerful, but they require context-switching: open a new tab, navigate to the right dashboard, configure filters, interpret charts. With MCP, you stay in your editor and get answers in seconds.

This is especially useful for:

- **Debugging**: "Show me the events for user X in the last hour" — instantly see what a user did before reporting a bug
- **Code reviews**: "What's the conversion rate on the checkout funnel?" — ground discussions in real data
- **Sprint planning**: "Which features have the most frustration signals?" — prioritize fixes with evidence
- **Incident response**: "Compare today's traffic to yesterday" — quickly spot anomalies

## Get Started

1. Install: `npx -y @kitbase/analytics-mcp`
2. Add your private API key (`sk_kitbase_`)
3. Configure your MCP client
4. Start querying

Full documentation is available at [docs.kitbase.dev/sdks/mcp](https://docs.kitbase.dev/sdks/mcp).

---

*Don't have a Kitbase account yet? [Start your free trial](https://app.kitbase.dev/signup/) — 7 days, no credit card required.*
