Skip to main content
Glama
expremiental

yandex-metrika-mcp

by expremiental

yandex-metrika-mcp

License: MIT Python 3.10+ FastMCP MCP

Query Yandex Metrika analytics in plain language, right inside Claude. "How many visits this week?", "Top traffic sources for June", "Mobile share today?" — the assistant queries Metrika and answers directly. No dashboards, no SQL, no API keys to manage.

Open-source by aiaiai — we build what we teach.


Задавай вопросы по Яндекс.Метрике обычным языком прямо в Claude. «Сколько визитов за неделю?», «топ источников за июнь», «доля мобильных?» — ассистент сам сходит в Метрику и ответит. Без дашбордов.

Спросил про географию аудитории обычным языком — агент сам построил карту из живой Яндекс.Метрики

Works with

Claude.ai  ·  Claude Code  ·  Claude Desktop  ·  Cursor  ·  any MCP-compatible client

Related MCP server: Plausible MCP

Connect in one minute (hosted)

No installation needed — connect to the hosted service.

Claude.ai (Settings → Connectors → Add):

https://mcp.getaiaiai.ru/yandex-metrika

Click Connect → sign in with Yandex → allow access.

Claude Code CLI:

claude mcp add --transport http yandex-metrika https://mcp.getaiaiai.ru/yandex-metrika/
claude mcp login yandex-metrika

A browser window opens → sign in with Yandex → done. On headless/SSH: add --no-browser to mcp login and paste the redirect URL when prompted.

Claude Desktop / Cursor — add to mcpServers:

{
  "mcpServers": {
    "yandex-metrika": {
      "type": "http",
      "url": "https://mcp.getaiaiai.ru/yandex-metrika/"
    }
  }
}

No app registration, no tokens to manage. Read-only — the service never writes to your Metrika account.

Claude.ai (Настройки → Коннекторы → Добавить):

https://mcp.getaiaiai.ru/yandex-metrika

Нажмите Подключить → войдите через Яндекс → разрешите доступ.

Claude Code CLI:

claude mcp add --transport http yandex-metrika https://mcp.getaiaiai.ru/yandex-metrika/
claude mcp login yandex-metrika

Откроется браузер → войти через Яндекс → готово.

Tools

Tool

Description

list_counters

List all Yandex Metrika counters available to the token (id, name, site)

query

Run a Reporting API query — visits, users, pageviews, bounce rate, traffic sources, devices, geography, UTMs, and more

query parameters

Parameter

Default

Description

counter_id

required

Counter ID from list_counters

metrics

required

Comma-separated metrics, e.g. ym:s:visits,ym:s:users

dimensions

Group-by fields: ym:s:date, ym:s:lastTrafficSource, ym:s:deviceCategory, …

date1 / date2

7daysAgo / today

Date range: YYYY-MM-DD or relative (today, yesterday, NdaysAgo)

filters

Filter expression, e.g. ym:s:deviceCategory=='mobile'

sort

Sort field; prefix - for descending, e.g. -ym:s:visits

limit

100

Max rows returned

Common metrics: ym:s:visits, ym:s:users, ym:s:pageviews, ym:s:bounceRate, ym:s:avgVisitDurationSeconds, ym:s:newUsers

Common dimensions: ym:s:date, ym:s:lastTrafficSource, ym:s:startURL, ym:s:deviceCategory, ym:s:regionCountry, ym:s:lastsourceUTMSource


Self-host with your own token

Requires Python 3.10+ and uv.

git clone https://github.com/expremiental/yandex-metrika-mcp.git
cd yandex-metrika-mcp
uv sync

Get a token. Go to oauth.yandex.ru, create an app (platform: "Web services"), enable Yandex Metrika → Read statistics (metrika:read), then get an OAuth token:

export YANDEX_METRIKA_TOKEN="<your-token>"

Connect (Claude Desktop / Cursor — add to mcpServers):

{
  "mcpServers": {
    "yandex-metrika": {
      "command": "uv",
      "args": ["run", "yandex-metrika-mcp"],
      "env": { "YANDEX_METRIKA_TOKEN": "<your-token>" }
    }
  }
}

Run over HTTP:

MCP_TRANSPORT=http PORT=8000 uv run yandex-metrika-mcp
# endpoint: http://localhost:8000/mcp

Embed in your own backend. The engine accepts an injectable async token resolver — wrap it with your own auth:

from yandex_metrika_mcp import build_server

async def my_token_resolver() -> str:
    return "<metrika:read token>"

build_server(token_resolver=my_token_resolver).run(transport="stdio")

Public API: build_server, YandexMetrikaClient, TokenResolver, env_token_resolver, main.

License

MIT · made by aiaiai

Available Tools

2 tools
list_countersList CountersAInspect

List Yandex Metrika counters available to the token.

Returns each counter's id, name and site so you can pick a counter_id for query. Read scope is enough.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full behavioral burden. It discloses that the operation lists only counters accessible to the token, returns each counter's id/name/site, and requires only read scope. This goes beyond the tool name and schema, though it omits details like pagination or error behavior, which are less critical for a list-all endpoint.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two concise sentences. The first sentence states the core purpose; the second explains the output fields and their downstream use. There is no wasted wording or redundancy, and the essential information is front-loaded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool is simple (no parameters, no nested objects) and an output schema exists, so the description does not need to describe return structure. It covers what the tool does, what it returns, how to use the result, and the required scope. Nothing essential is missing for correct invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters, so schema coverage is trivially 100%. The description adds relevant context about the output fields (id, name, site) and their purpose, which helps the agent interpret the result. With no parameters to document, a baseline of 4 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb ('List'), a clear resource ('Yandex Metrika counters'), and scopes it to those 'available to the token.' It also implicitly distinguishes itself from the sibling 'query' by positioning the output as a way to pick a counter_id for query.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context: use this tool to obtain counter ids/names/sites, then feed a selected counter_id into 'query.' It does not explicitly state 'when not to use' or name alternatives, but given the single sibling and the dependency hint, the intended usage is apparent.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

queryQueryAInspect

Run a Reporting API query against a Metrika counter (aggregated stats).

Pass Metrika field names directly. Common ones:

Metrics (comma-separated): ym:s:visits, ym:s:users, ym:s:pageviews, ym:s:bounceRate, ym:s:avgVisitDurationSeconds, ym:s:newUsers

Dimensions (comma-separated, optional — groups the result): ym:s:date, ym:s:lastTrafficSource, ym:s:startURL, ym:s:deviceCategory, ym:s:regionCountry, ym:s:UTMSource

date1 / date2: YYYY-MM-DD or relative (today, yesterday, NdaysAgo). filters: Metrika filter expression, e.g. "ym:s:deviceCategory=='mobile'". sort: field to sort by; prefix with '-' for descending, e.g. "-ym:s:visits".

Returns the raw Reporting API response (query meta, totals and data rows).

ParametersJSON Schema
NameRequiredDescriptionDefault
sortNo
date1No7daysAgo
date2Notoday
limitNo
filtersNo
metricsYes
counter_idYes
dimensionsNo

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4.4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It explicitly states the return shape: 'Returns the raw Reporting API response (query meta, totals and data rows).' It also clarifies that Metrika field names are passed through directly, which sets expectations for raw passthrough behavior. It does not mention permissions, rate limits, or side effects, but for a query operation the return-value disclosure is substantive.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured and front-loaded: purpose first, then grouped parameter guidance, then return behavior. Each section is minimal and useful, with practical examples but no filler. The organization makes it easy for an agent to scan and extract the needed details.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given an output schema exists and 8 parameters are involved, the description covers the critical semantics well and even documents return shape. The only gaps are counter_id and limit, which are relatively self-evident from names and schema types. The description is sufficient for an agent to construct a correct query in most cases, though a note on pagination or limit behavior would fully close the gap.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate, and it largely does. It explains metrics, dimensions, date1/date2, filters, and sort with concrete examples and formats. However, it does not explain counter_id or limit, leaving those to inference from names and types. Overall, the description provides strong semantic value for most parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb+resource: 'Run a Reporting API query against a Metrika counter (aggregated stats).' This clearly distinguishes it from the sibling list_counters, which is about enumerating counters rather than executing queries. The purpose is unambiguous and action-oriented.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides extensive how-to guidance: which metrics and dimensions to pass, date formats, filter syntax, and sort prefix. It makes the intended use case clear (aggregated stats queries), though it does not explicitly say when not to use it or mention list_counters as an alternative. Context is clear; exclusions are absent.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 2 tool updatesv0.1.0
    • First observedlist_counters
    • First observedquery

TDQS

A4.4/5.0

Scored across 2 tools

Disambiguation5/5

The two tools have clearly non-overlapping purposes: one discovers available counters, the other runs queries against a specific counter. An agent can easily choose the right tool.

Naming Consistency4/5

list_counters follows a verb_noun pattern while query is a bare verb, which is a minor inconsistency. However, both are concise and readable, and the query description clarifies its role.

Tool Count3/5

With only two tools, the server is minimal but not unreasonable for a read-only analytics API wrapper. It is serviceable yet feels slightly thin compared to more complete analytics integrations.

Completeness4/5

The pair covers the core workflow: list counters to obtain an ID, then query reporting data from that counter. Missing capabilities like retrieving counter metadata or metadata schemas are minor gaps for this read-only domain.

Maintenance

ActivityStale
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    B
    quality
    D
    maintenance
    Enables natural language interaction with Plausible Analytics data to query traffic, visitors, engagement, and more using conversational questions.
    4
    1
    MIT
  • A
    license
    A
    quality
    A
    maintenance
    MCP server for Yandex Metrica analytics: query web analytics metrics, goals, conversions, and raw API data using natural language from AI clients like Claude and Cursor.
    8
    113
    1
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables AI assistants to retrieve comprehensive analytics data from Yandex Metrika accounts, including traffic, content, e-commerce, and user demographics.
    1
    MIT