TapCub is live — analytics, insights and live chat, free on one platform
Help center

How do I connect AI agents with MCP?

Create a Read stats API key, copy the MCP endpoint and config from the AI Assistant page, and give your agent ten read-only analytics tools.

Product analytics2 min readLast updated Nov 5, 2026TapCub team

Still have a question?

Could not find it? A person reads every message, usually within a few hours on business days.

Chat with us

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 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

  1. Open Configuration › Settings › API keys and create a key.
  2. Choose the Read stats scope (stats:read). A key without it fails on every tool call.
  3. 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

ToolReturns
list_sitesProjects this key can access
site_overviewSessions, users, pageviews and period change
list_metricsBuilt-in and saved metrics, recent event names, dimensions
list_eventsEvent names from the last 30 days
run_insightA trend, table, funnel or other analysis from a query
list_saved_insightsSaved analyses
run_saved_insightOne saved analysis, with an optional date override
askAn answer to a plain-language question
attribute_changeHow dimension values contributed to a change
dashboard_summaryA 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_id and counts toward open API usage and rate limits.
  • If ask cannot parse a question, it returns a clarification and runs no query.

Common problems

SymptomCauseFix
Every call failsKey lacks Read statsCreate a key with stats:read
"site_id" errorTool called without a projectCall list_sites first and pass the id
dashboard_summary says no dashboardThe project has noneCreate 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.

See your data clearly. Find your growth.

Every click, backed by data. Install one line of code and see your first numbers in a minute.

No credit card · Free plans for analytics and chat · Cookieless analytics