More in Product analytics
- Autocapture and the AI event inbox
- Build a funnel that explains drop-off
- Identify users across web, app and mini-programs
- What is autocapture, and how does it work?
- How do I review and accept events in the inbox?
- What are unplanned events, and how do I manage them?
- When should I use a funnel instead of a goal or path?
- How do I build a funnel?
- How do I read where a funnel drops off?
- What is identified mode, and should I turn it on?
- How do I call login to identify a user?
- How is one person merged across devices?
- How does identity work on apps and mini-programs?
- How do I track clicks on outbound links?
- How do I track file downloads?
- How do I track form submissions?
- How do I track custom events?
- How do I track button clicks?
- How do I create a heatmap?
- How do I track scroll depth?
- How do I track ecommerce purchases and revenue?
- How do I set up goals and track conversions?
- How do I query my data with SQL?
- How do I create a custom metric?
- How do I analyze accounts with groups?
- How do I ask the AI assistant about my data?
- How do I create user segments?
- How do I run an RFM analysis?
- How do I record and watch session replays?
- How do I analyze user paths?
- How do I build a retention report?
- How do I analyze how an event is distributed?
- How do I create a tracking plan?
- How do I view a user’s profile and activity?
- How do I read the lifecycle report (new, returning, resurrecting, dormant)?
- How do I compare attribution models for a conversion?
- All guides in this category
Still have a question?
Could not find it? A person reads every message, usually within a few hours on business days.
Chat with usShort answer
Create an API key with the Read stats scope (stats:read) under Configuration › Settings › API keys, then copy the endpoint and client config from the MCP tab of the AI Assistant page. The agent gets ten read-only tools; every tool except list_sites needs site_id.
Short answer
Create an API key with the Read stats scope (stats:read) under Configuration › Settings › API keys, then copy the endpoint and client config from the MCP tab in All-platform analytics › Operations › AI Assistant. Paste them into your MCP client. The agent gets ten read-only query tools for your projects.
1. Create a read-only key
- Open Configuration › Settings › API keys and create a key.
- Choose the Read stats scope (
stats:read). A key without it fails on every tool call. - The key is shown with a
wck_prefix only. Store it in your client's secret settings, not in a shared file.
2. Copy the endpoint and config
On the MCP tab of the AI Assistant page, copy the endpoint (path /api/v1/mcp), the client config and the curl sample. The transport is Streamable HTTP with JSON responses; there is no server-sent stream.
Test it before adding it to an agent. Sample request, with your endpoint in TAPCUB_MCP_URL and a sample site id:
curl -X POST "$TAPCUB_MCP_URL" \
-H "Authorization: Bearer wck_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"ask","arguments":{"site_id":123,"question":"visitors last 7 days vs previous period"}}}'
On success the answer is text inside content, usually JSON.
3. What the agent can call
| Tool | Returns |
|---|---|
list_sites | Projects this key can access |
site_overview | Sessions, users, pageviews and period change |
list_metrics | Built-in and saved metrics, recent event names, dimensions |
list_events | Event names from the last 30 days |
run_insight | A trend, table, funnel or other analysis from a query |
list_saved_insights | Saved analyses |
run_saved_insight | One saved analysis, with an optional date override |
ask | An answer to a plain-language question |
attribute_change | How dimension values contributed to a change |
dashboard_summary | A summary of each dashboard card |
Every tool except list_sites needs site_id, so a good first step for the agent is list_sites. Dates are a preset or from / to in the site time zone.
4. What it will not do
- Tools are read-only: they do not write events, edit definitions or create monitors.
- There are no resources or prompt templates; do not assume other tools exist.
- Each call checks access to
site_idand counts toward open API usage and rate limits. - If
askcannot parse a question, it returns a clarification and runs no query.
Common problems
| Symptom | Cause | Fix |
|---|---|---|
| Every call fails | Key lacks Read stats | Create a key with stats:read |
| "site_id" error | Tool called without a project | Call list_sites first and pass the id |
dashboard_summary says no dashboard | The project has none | Create a dashboard, or pass a dashboard id |
For the in-console version of the same questions, see ask the AI assistant.
See also
Did this answer your question?
We use your answers to fix and expand this page.
Couldn’t send. Please try again in a minute.
Thanks for the feedback. We’ll use it to improve this page.You’ve already sent feedback on this page. Thanks.