What is MCP? An open protocol (created by Anthropic, now supported by OpenAI, Cursor, and others) that lets LLMs call external tools. Think of it as USB‑C for AI assistants — one plug, many tools.
What you get
Once connected, your assistant can:Explore your schema
List every event your site tracks and the dimensions you can filter by.
Run queries
Breakdowns, timeseries, counts, and period‑over‑period comparisons — with the same surprise‑detection Kai uses.
Investigate drops
Cluster sessions, compare segments, analyze Tracks (start → goal funnels), and correlate events.
Generate digests
Daily summaries of what changed across your workspace, ready to paste into Slack or Notion.
Endpoint
How auth works (the short version)
Grain is its own OAuth 2.1 authorization server. When an MCP client hits the endpoint without a token:Client asks Grain what it needs
Grain responds
401 with a WWW-Authenticate header pointing at /.well-known/oauth-protected-resource.Client registers itself
The client calls
/oauth/register (RFC 7591 Dynamic Client Registration) and gets a public, PKCE‑only client_id. No shared secrets.You approve in the browser
Grain opens a consent screen where you pick the workspace and review the scopes being granted. A 7‑day preview shows what the assistant will actually be able to see.
Scopes
Grain offers three scopes so you can hand out exactly the access an assistant needs — no more, no less.| Scope | Grants | Typical use |
|---|---|---|
mcp:read | Event list, dimension discovery, integration health | ”Is tracking wired up?” |
mcp:query | Query, count, compare, digest | ”Signups by country last week?” |
mcp:investigate | Segment compare, session cluster, track analyze, correlate event | ”Why did checkout drop on Tuesday?” |
Pick your client
Claude
Claude.ai (web), Claude Desktop, and Claude Code.
Cursor
The AI‑first code editor.
ChatGPT
Via Developer Mode on Pro, Team, Enterprise, and Edu plans.
Any MCP client
Tool reference and raw endpoint details.
Limits and safety
- Workspace‑pinned. Every token carries exactly one
tenantId, chosen at consent. An assistant cannot cross workspaces within a session. - Per‑request budget. Each MCP request is capped at 16 backend calls so a chatty agent can’t accidentally DDoS your data.
- Read‑only in v1. No tool in the current surface writes, deletes, or mutates. You can safely hand an assistant the
mcp:investigatescope without worrying it will change a segment definition. - Encrypted at rest. Upstream tokens are AES‑GCM encrypted before they hit the database. Grain‑issued tokens are stored only as SHA‑256 hashes.