npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

yandex-metrika-mcp

v1.0.0

Published

MCP server for Yandex Metrika API - web analytics, traffic data, and visitor insights

Readme

yandex-metrika-mcp

MCP server for Yandex Metrika API — web analytics, traffic data, and visitor insights.

npm version License: MIT

English | Русский


English

Features

  • Traffic analytics — visits, users, pageviews, bounce rate, session duration
  • Traffic sources — breakdown by direct, search, social, referral
  • Geography — visitor countries and cities
  • Devices — device types, browsers, operating systems
  • Popular pages — top pages by views
  • Search phrases — keywords that brought visitors
  • Custom reports — flexible queries with any dimensions/metrics
  • Counter management — list counters and goals

Setup

Step 1: Get OAuth Token

Option A: Quick (manual token)

  1. Go to Yandex OAuth
  2. Create an app with Metrika API access (scope: metrika:read)
  3. Get a debug token from the app settings

Option B: OAuth flow (recommended)

  1. Create an app at oauth.yandex.ru/client/new
  2. Enable Yandex Metrica API access with metrika:read scope
  3. Set callback URL to https://oauth.yandex.ru/verification_code
  4. Run the auth helper:
export YANDEX_CLIENT_ID=your_client_id
export YANDEX_CLIENT_SECRET=your_client_secret
npx yandex-metrika-mcp auth

Step 2: Configure Claude

Claude Desktop — edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):

{
  "mcpServers": {
    "yandex-metrika": {
      "command": "npx",
      "args": ["-y", "yandex-metrika-mcp"],
      "env": {
        "YANDEX_METRIKA_TOKEN": "your_oauth_token"
      }
    }
  }
}

Claude Code:

claude mcp add yandex-metrika \
  -e YANDEX_METRIKA_TOKEN=your_oauth_token \
  -- npx -y yandex-metrika-mcp

Tools

| Tool | Description | |------|-------------| | get-counters | List all Metrica counters | | get-counter | Get counter details | | get-goals | List counter goals | | get-traffic-summary | Visits, users, pageviews, bounce rate | | get-traffic-sources | Traffic source breakdown | | get-geography | Visitor countries and cities | | get-devices | Device/browser/OS stats | | get-popular-pages | Top pages by views | | get-search-phrases | Search keywords | | get-report | Custom report with any dimensions/metrics |

Usage Examples

Once configured, ask Claude:

  • "Show me traffic for my site last month"
  • "What are the top traffic sources?"
  • "Which pages get the most views?"
  • "Where are my visitors from?"
  • "What devices do visitors use?"
  • "What search phrases bring traffic?"

Русский

Возможности

  • Аналитика трафика — визиты, пользователи, просмотры, отказы, длительность сессии
  • Источники трафика — разбивка по прямым, поиску, соцсетям, переходам
  • География — страны и города посетителей
  • Устройства — типы устройств, браузеры, ОС
  • Популярные страницы — топ страниц по просмотрам
  • Поисковые фразы — ключевые слова, приводящие посетителей
  • Кастомные отчёты — гибкие запросы с любыми измерениями/метриками
  • Управление счётчиками — список счётчиков и целей

Настройка

Шаг 1: Получите OAuth токен

Вариант A: Быстрый (ручной токен)

  1. Перейдите на Yandex OAuth
  2. Создайте приложение с доступом к API Метрики (scope: metrika:read)
  3. Получите отладочный токен в настройках приложения

Вариант B: OAuth поток (рекомендуется)

  1. Создайте приложение на oauth.yandex.ru/client/new
  2. Включите доступ к Яндекс Метрике с правом metrika:read
  3. Укажите callback URL: https://oauth.yandex.ru/verification_code
  4. Запустите помощник авторизации:
export YANDEX_CLIENT_ID=ваш_client_id
export YANDEX_CLIENT_SECRET=ваш_client_secret
npx yandex-metrika-mcp auth

Шаг 2: Настройте Claude

Claude Desktop — отредактируйте ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) или %APPDATA%\Claude\claude_desktop_config.json (Windows):

{
  "mcpServers": {
    "yandex-metrika": {
      "command": "npx",
      "args": ["-y", "yandex-metrika-mcp"],
      "env": {
        "YANDEX_METRIKA_TOKEN": "ваш_oauth_токен"
      }
    }
  }
}

Claude Code:

claude mcp add yandex-metrika \
  -e YANDEX_METRIKA_TOKEN=ваш_oauth_токен \
  -- npx -y yandex-metrika-mcp

Инструменты

| Инструмент | Описание | |------------|----------| | get-counters | Список счётчиков Метрики | | get-counter | Детали счётчика | | get-goals | Список целей счётчика | | get-traffic-summary | Визиты, пользователи, просмотры, отказы | | get-traffic-sources | Разбивка по источникам трафика | | get-geography | Страны и города посетителей | | get-devices | Статистика устройств/браузеров/ОС | | get-popular-pages | Топ страниц по просмотрам | | get-search-phrases | Поисковые запросы | | get-report | Кастомный отчёт с любыми измерениями/метриками |

Примеры использования

После настройки спросите Claude:

  • "Покажи трафик моего сайта за последний месяц"
  • "Какие основные источники трафика?"
  • "Какие страницы самые популярные?"
  • "Откуда мои посетители?"
  • "Какие устройства используют посетители?"
  • "По каким поисковым запросам приходят?"

License

MIT