Labsco
MCP SERVER

Yandex Metrica MCP

by askads

Ask where your visitors came from and how conversion is moving — Metrica connects from inside the chat, with no token to create first.

SEO, Web & Product AnalyticsVerified
Summary
It says when the numbers are approximate instead of presenting a sample as a fact.

Metrica samples long periods and complex reports, and this server surfaces that rather than hiding it: results carry totals, row counts and a sampling flag, and you can narrow the period or ask for accuracy: "full" when the estimate is not good enough. Size limits are visible for the same reason: automatic pagination stops at 100 pages or roughly 1 MB, and a capped result is marked _truncated rather than just ending, so narrow the period instead of trusting a truncated answer. The only call that can change anything is raw_request with POST or DELETE, gated behind confirmWrite=true; and since Metrica has no sandbox, those land on live objects.

What it is

An MCP server for Yandex Metrica web analytics. It lists the counters your access reaches, the goals configured on them, and builds reports from the Reporting API — visits, users, pageviews, bounce rate and visit duration, split by date, traffic source, device or goal. Connecting happens in the conversation: Yandex opens a sign-in page, you send the one-time code back, and the server immediately checks that it can see your counters.

What you get
  • list_counters returns the counters your access reaches with id, name and site domain, filtered by a name or site substring
  • list_goals returns the conversions configured on a counter along with the goal ids that make ym:s:goal<id>reaches and ym:s:goal<id>conversionRate available in a report
  • get_statistics answers with a single aggregated row for the period by default — visits, users, pageviews, bounceRate, avgVisitDuration — and splits into rows once you add dimensions such as ym:s:date for a daily trend or ym:s:lastTrafficSource
  • Every report carries the totals across all rows, the size of the result and a sampling flag, so an approximate answer says that it is approximate
  • raw_request reaches any Metrica API path — management/v1/counters, management/v1/counter/{id}/goals, stat/v1/data and the rest. GET runs freely; POST and DELETE can change real Metrica objects and only run with confirmWrite=true
  • The in-chat connection has its own calls: start_login and finish_login exchange the code, auth_status reports which account is connected, and logout removes the locally stored token
Requirements

Node.js 20 or newer, over stdio as npx -y mcp-yandex-metrica@latest. No token is needed in advance: ask the assistant to connect, sign in with an account that can see the counters, and send back the code, which lasts 10 minutes and is exchanged using PKCE inside the running server. The token is kept locally at ~/.config/mcp-yandex-metrica/credentials.json with owner-only permissions and renews itself when a refresh token is present. YANDEX_METRIKA_TOKEN takes priority over the in-chat flow and needs the metrika:read scope; YANDEX_METRIKA_COUNTER_ID sets a default counter, YANDEX_METRIKA_LANG the response language (default ru), YANDEX_METRIKA_TIMEOUT_MS the per-request timeout (default 60000) and YANDEX_METRIKA_MAX_RETRIES the retry count (default 3). Anonymous technical telemetry is on by default; ASKADS_TELEMETRY=0 switches it off. MIT.

Setup effort

One command — npx -y mcp-yandex-metrica@latest