Skip to main content
Glama
yandex-metrica-mcp

yandex-metrica-mcp

by s3rezhkaa

yandex-metrica-mcp

Read-only MCP server for Yandex Metrica. AI assistants and coding agents can read counters, goals, traffic reports, landing pages, device splits, and goal visits without modifying counter settings.

Русская версия (README.ru.md)

Available tools

Tool

Description

get_counters

List Yandex Metrica counters available for the token.

get_goals

List conversion goals for a counter (counter_id).

get_daily_stats

Load daily visits, users, average visit duration, and optional goal reaches.

get_sources_report

Load traffic and engagement stats grouped by traffic source and UTM tags.

get_pages_report

Load traffic and engagement stats grouped by landing page URL.

get_tech_report

Load traffic and engagement stats grouped by device category.

get_goal_visits

Load individual visits that reached a specific goal (with timestamp and UTMContent).

Related MCP server: yandex-metrika-mcp

Getting credentials

  1. Register an app in Yandex OAuth with the metrika:read permission and set the Redirect URI to https://oauth.yandex.com/verification_code.

  2. Open this URL in your browser (replace <CLIENT_ID> with your app ID), approve access, and copy access_token from the redirect URL:

    https://oauth.yandex.com/authorize?response_type=token&client_id=<CLIENT_ID>
  3. Set YANDEX_METRICA_TOKEN to that token. Set YANDEX_CLIENT_LOGIN only if you access another user's account via delegate/agency access.

Environment variables

  • YANDEX_METRICA_TOKEN (required): Yandex Metrica OAuth token.

  • YANDEX_CLIENT_LOGIN (optional): Yandex account login sent in Client-Login.

  • YANDEX_METRICA_API_URL (optional): base URL for the Metrica API, defaults to https://api-metrika.yandex.net. Set this when pointing to a local mock server (for example http://localhost:8092).

Installation in coding agents

Requires uv (uvx). Run it directly from GitHub with uvx, or from a local clone using --directory /path/to/yandex-metrica-mcp.

Standard JSON config (Cursor, Claude Desktop, Windsurf, Antigravity, VS Code, Gemini CLI)

Add this block to your agent's mcpServers JSON config:

{
  "mcpServers": {
    "yandex-metrica": {
      "command": "uvx",
      "args": [
        "--from",
        "git+https://github.com/s3rezhkaa/yandex-metrica-mcp",
        "yandex-metrica-mcp"
      ],
      "env": {
        "YANDEX_METRICA_TOKEN": "your-oauth-token"
      }
    }
  }
}

For a local clone, use "command": "uv" and "args": ["run", "--directory", "/path/to/yandex-metrica-mcp", "yandex-metrica-mcp"].

Claude Code CLI

claude mcp add yandex-metrica \
  -e YANDEX_METRICA_TOKEN=your-oauth-token \
  -- uvx --from git+https://github.com/s3rezhkaa/yandex-metrica-mcp yandex-metrica-mcp

Codex CLI (~/.codex/config.toml)

[mcp_servers.yandex_metrica]
command = "uvx"
args = ["--from", "git+https://github.com/s3rezhkaa/yandex-metrica-mcp", "yandex-metrica-mcp"]

[mcp_servers.yandex_metrica.env]
YANDEX_METRICA_TOKEN = "your-oauth-token"

Optional audit skill

A short audit skill is included in skills/yandex-metrica-audit/SKILL.md. Copy or symlink skills/yandex-metrica-audit into your agent's skills directory (for example ~/.claude/skills/, ~/.codex/skills/, or .agents/skills/ in a workspace) to run a step-by-step site traffic audit.

Local development

uv sync
uv run ruff check .
uv run pytest -v

Available Tools

7 tools
get_countersA

List Yandex Metrica counters available for the configured OAuth token.

Inputs: no named parameters. Returns: result

get_daily_statsB

Load daily visits, users, average visit duration, and goal reaches for a counter.

Args: counter_id: Yandex Metrica counter ID. start_date: Start date in YYYY-MM-DD format. end_date: End date in YYYY-MM-DD format. goal_ids: Optional list of Metrica goal IDs to include reach counts.

Inputs: end_date (required), counter_id (required), start_date (required), goal_ids. Returns: result

get_goalsC

List conversion goals configured for a Yandex Metrica counter.

Args: counter_id: Yandex Metrica counter ID.

Inputs: counter_id (required). Returns: result

get_goal_visitsA

Load individual visits that reached a specific goal (with visit time and UTM content).

Args: counter_id: Yandex Metrica counter ID. goal_id: Yandex Metrica goal ID. start_date: Start date in YYYY-MM-DD format. end_date: End date in YYYY-MM-DD format. limit: Maximum number of rows to return (1 to 100000).

Inputs: goal_id (required), end_date (required), counter_id (required), start_date (required), +1 more. Returns: result

get_pages_reportB

Load traffic and engagement stats grouped by landing page URL.

Args: counter_id: Yandex Metrica counter ID. start_date: Start date in YYYY-MM-DD format. end_date: End date in YYYY-MM-DD format. goal_ids: Optional list of Metrica goal IDs to include reach counts. limit: Maximum number of rows to return (1 to 100000).

Inputs: end_date (required), counter_id (required), start_date (required), limit, +1 more. Returns: result

get_sources_reportC

Load traffic and engagement stats grouped by traffic source and UTM tags.

Args: counter_id: Yandex Metrica counter ID. start_date: Start date in YYYY-MM-DD format. end_date: End date in YYYY-MM-DD format. goal_ids: Optional list of Metrica goal IDs to include reach counts. limit: Maximum number of rows to return (1 to 100000).

Inputs: end_date (required), counter_id (required), start_date (required), limit, +1 more. Returns: result

get_tech_reportA

Load traffic and engagement stats grouped by device category.

Args: counter_id: Yandex Metrica counter ID. start_date: Start date in YYYY-MM-DD format. end_date: End date in YYYY-MM-DD format. goal_ids: Optional list of Metrica goal IDs to include reach counts. limit: Maximum number of rows to return (1 to 100000).

Inputs: end_date (required), counter_id (required), start_date (required), limit, +1 more. Returns: result

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 7 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: counter/goal listing, daily aggregate stats, grouped reports by source/page/device, and goal-level visits. The three grouped report tools are similar in shape but explicitly separated by grouping dimension, so an agent can select correctly.

    Naming Consistency5/5

    All tools follow the same get_<resource> pattern with snake_case and concise noun phrases. There are no naming style deviations or ambiguous verb choices.

    Tool Count5/5

    Seven tools is well-scoped for a focused Yandex Metrica analytics server. Each tool covers a distinct reporting or lookup need without excessive surface area.

    Completeness4/5

    The surface covers core analytics workflows: counters, goals, daily stats, traffic source/page/device breakdowns, and goal-reaching visits. Some common Metrica report dimensions (e.g., geography, search engines, demographics, events) are absent, but the main reporting path is covered.

    Maintenance

    ActivityMaintained
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to retrieve comprehensive analytics data from Yandex Metrika accounts, including traffic, content, e-commerce, and user demographics.
      1
      MIT
    • A
      license
      C
      quality
      C
      maintenance
      Enables interaction with Yandex Metrika's Reports and Management APIs, providing tools for querying analytics data and managing counters, goals, filters, and other settings.
      68
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to work with Yandex Webmaster, Direct, and Metrika data through natural language, including managing sites, sitemaps, recrawls, ad campaigns with write-safety guards, and pulling traffic, conversion, and ad statistics.
      MIT
    • F
      license
      Not graded
      quality
      B
      maintenance
      Enables AI assistants to retrieve analytics reports, compare periods, and inspect orders, leads, calls, visits, clients, and funnel data from allowed projects.
      1
      -