yandex-metrika-mcp

yandex-metrika-mcp

Enables AI assistants to retrieve comprehensive analytics data from Yandex Metrika accounts, including traffic, content, e-commerce, and user demographics.

Category
访问服务器

README

Yandex Metrika MCP Server (Node.js)

A Model Context Protocol (MCP) server that provides access to Yandex Metrika analytics data through various tools and functions. This server allows AI assistants and applications to retrieve comprehensive analytics data from Yandex Metrika accounts.

Based on atomkraft/yandex-metrika-mcp (MIT, unmaintained since 08.2025). This repo carries a bugfix series on top: several reports were sending invalid Yandex Metrika Reporting API attributes or silently ignoring their date-range parameters — see commit history for details. Maintained on a best-effort basis by @IlyaVorozhbit — file issues/PRs on this repo, not upstream.

Documentation in Russian is located here / Здесь находится документация на русском языке.

Features

  • Account Information: Get basic account and counter information
  • Traffic Analytics: Retrieve visits, page views, and user engagement metrics
  • Traffic Sources: Analyze traffic sources including organic search, direct traffic, and referrals
  • Content Analytics: Get insights about articles, authors, categories, and topics performance
  • User Demographics: Access user demographics and device analysis
  • Geographic Data: Regional traffic analysis and geographical distribution
  • E-commerce Analytics: Product performance and revenue tracking
  • Conversion Tracking: Goals conversion rates and funnel analysis
  • Search Performance: Organic search queries and search engine data
  • Device Analysis: Mobile vs desktop traffic comparison

Requirements

  • Node.js 18+
  • Yandex Metrika API access token (see below)

Setup

  1. Clone the repo and install dependencies:

    git clone https://github.com/IlyaVorozhbit/yandex-metrika-mcp.git
    cd yandex-metrika-mcp
    npm install
    
  2. Build it:

    npm run build
    

    This compiles src/*.ts into build/*.js via tsc, then does a quick smoke-test run of build/index.js. Without a token set, that smoke test fails with ❌ Error: Missing Yandex Metrika token — expected, harmless, not a failed build. The token is only needed when the server actually runs (next steps).

  3. Get an authorization token — see Get authorization token below.

  4. Find the counter ID(s) you want to query — every tool call takes a counter_id parameter. You can find it in your Yandex Metrika dashboard: it's the numeric ID shown next to each counter (also visible in the counter's tracking snippet, e.g. ym(XXXXXXXX, 'init', ...)).

  5. Register the server with your MCP client. Example for Claude Code:

    claude mcp add yandex-metrika -e YANDEX_API_KEY=your_token_here -- node /path/to/yandex-metrika-mcp/build/index.js
    

    Or add it manually to your client's config (e.g. claude_desktop_config.json for Claude Desktop):

    {
      "mcpServers": {
        "yandex-metrika-mcp": {
          "command": "node",
          "args": [
            "/path/to/yandex-metrika-mcp/build/index.js"
          ],
          "env": {
            "YANDEX_API_KEY": "your_token_here"
          }
        }
      }
    }
    

    Replace /path/to/yandex-metrika-mcp with the absolute path to your clone, and your_token_here with the token from step 3.

Get authorization token

To obtain an authorization token:

  1. Create an application, filling in the following fields:

    • name — can be arbitrary;
    • service icon — optional;
    • application platforms — select web services;
    • redirect URI — specify https://oauth.yandex.ru/verification_code;
    • data access — specify the set of access rights for your application. Available access rights:
      • metrika:read — obtaining statistics, reading parameters of your own and trusted counters, obtaining a list of counters;
      • metrika:write — creating counters, changing parameters of your own and trusted counters, uploading any data;
      • metrika:expenses — uploading expenses to counters;
      • metrika:user_params — uploading user parameters to counters;
      • metrika:offline_data — uploading offline data to counters (data from CRM, offline conversions, calls).

    Note: metrika:expenses, metrika:user_params, metrika:offline_data access rights are not mandatory if metrika:write access is used. For read-only usage, metrika:read alone is enough.

  2. Click Create application and copy its ClientID (click the icon next to the identifier).

  3. Add the copied ClientID to a link of the form: https://oauth.yandex.ru/authorize?response_type=token&client_id=<application_id>

  4. Follow the link and copy your authorization token from the opened page. This is the value that goes into YANDEX_API_KEY in the Setup section above.

Available Tools

The server provides 25 different tools for accessing Yandex Metrika data:

Account & Basic Analytics

  • get_account_info - Get basic account and counter information from Yandex Metrika
  • get_visits - Retrieve visit statistics with optional date range filtering (defaults to last 7 days)

Traffic Sources Analysis

  • sources_summary - Get comprehensive traffic sources overview and summary report
  • sources_search_phrases - Retrieve search phrases and browser information from traffic sources
  • get_traffic_sources_types - Analyze different types of traffic sources (organic, direct, referral)
  • get_search_engines_data - Get sessions and users data from search engines with optional filters
  • get_new_users_by_source - Identify which traffic sources are most effective in acquiring new users

Content Analytics

  • get_content_analytics_sources - Get sources that drive users to website articles
  • get_content_analytics_categories - Retrieve overall statistics by content category
  • get_content_analytics_authors - Get statistics on article authors performance
  • get_content_analytics_topics - Analyze performance by article topics
  • get_content_analytics_articles - Get detailed report on article views grouped by article

User Behavior & Demographics

  • get_user_demographics - Access user demographics and engagement by device category
  • get_device_analysis - Analyze user behavior by browser and operating system
  • get_mobile_vs_desktop - Compare traffic and engagement metrics between mobile and desktop users
  • get_page_depth_analysis - Get sessions where users viewed more than specified number of pages

Geographic & Regional Data

  • get_regional_data - Get sessions and users data for specific regions/cities
  • get_geographical_organic_traffic - Analyze geographical distribution of organic traffic

Performance & Conversion

  • get_page_performance - Get pageviews by URL path (bounce rate/duration not available per-page, only site-wide via get_visits)
  • get_goals_conversion - Track conversion rates for specified goals
  • get_organic_search_performance - Analyze organic search performance by search engine and query

E-commerce Analytics

  • get_ecommerce_performance - Get e-commerce performance by product category and region

Browser & Technical Data

  • get_browsers_report - Get browsers report without accounting for browser version

Advanced Analytics

  • get_data_by_time - Get data for specific time periods grouped by day, week, month, quarter, or year
  • get_yandex_direct_experiment - Get bounce rate for specific Yandex Direct experiments

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选