yandex-metrika-mcp-server

v3.3.1
io.github.artgas1/yandex-metrika-mcp-server Checked 6 hours ago Published 2 months ago

Полное покрытие API Яндекс Метрики: Stat, Management и Logs — 108 методов, 108 инструментов

Values you need

VariableWhat it is
YANDEX_API_KEYrequired secret OAuth-токен Яндекса с доступом к Метрике. Без него сервер не стартует.
METRIKA_PROFILEoptional Какая часть каталога объявляется: core (10 инструментов, умолчание), read (51 читающий), all (все 108).
METRIKA_ALLOW_WRITESoptional 1 разрешает и объявляет 57 инструментов, меняющих данные. Пока не задана — их нет в tools/list вовсе.
METRIKA_TOOLSoptional Своя выборка инструментов через запятую: раздел (stat, logs, management), префикс имени или точное имя. Задана — побеждает METRIKA_PROFILE.
METRIKA_TRAFFIC_FILTERoptional Условие сегментации, которое добавляется к отчётам Stat. По умолчанию ym:s:isRobot=='no'.
METRIKA_MAX_OUTPUT_CHARSoptional Потолок длины ответа одного вызова в символах. По умолчанию 120000.

npm (npx) discovery passed

Requires Node.js 18+

Run in a terminal
claude mcp add yandex-metrika-mcp-server -e 'YANDEX_API_KEY=<YANDEX_API_KEY>' -- npx -y --package=yandex-metrika-mcp-server@3.3.1 yandex-metrika-mcp
Add to claude_desktop_config.json
{
  "mcpServers": {
    "yandex-metrika-mcp-server": {
      "args": [
        "-y",
        "--package=yandex-metrika-mcp-server@3.3.1",
        "yandex-metrika-mcp"
      ],
      "command": "npx",
      "env": {
        "YANDEX_API_KEY": "<YANDEX_API_KEY>"
      }
    }
  }
}
Add to ~/.cursor/mcp.json
{
  "mcpServers": {
    "yandex-metrika-mcp-server": {
      "args": [
        "-y",
        "--package=yandex-metrika-mcp-server@3.3.1",
        "yandex-metrika-mcp"
      ],
      "command": "npx",
      "env": {
        "YANDEX_API_KEY": "<YANDEX_API_KEY>"
      }
    }
  }
}
Add to .vscode/mcp.json
{
  "inputs": [
    {
      "description": "YANDEX_API_KEY",
      "id": "yandex-api-key",
      "password": true,
      "type": "promptString"
    }
  ],
  "servers": {
    "yandex-metrika-mcp-server": {
      "args": [
        "-y",
        "--package=yandex-metrika-mcp-server@3.3.1",
        "yandex-metrika-mcp"
      ],
      "command": "npx",
      "env": {
        "YANDEX_API_KEY": "${input:yandex-api-key}"
      },
      "type": "stdio"
    }
  }
}
Add to ~/.codex/config.toml
[mcp_servers.yandex-metrika-mcp-server]
command = "npx"
args = ["-y", "--package=yandex-metrika-mcp-server@3.3.1", "yandex-metrika-mcp"]
env = { "YANDEX_API_KEY" = "<YANDEX_API_KEY>" }

For AI agents

  1. Ask the user for: YANDEX_API_KEY. Never invent or guess these values; secrets go into the client config, not into chat logs.
  2. Pick the user's MCP client and apply the matching config from the first install method (it is the one verified by the smoke test when available).
  3. Restart or reload the client so it starts the server.
  4. Verify: the server should expose these tools: metrika_counter_get, metrika_counter_list, metrika_goal_list, metrika_segment_list, metrika_stat_bytime, metrika_stat_comparison, metrika_stat_comparison_drilldown, metrika_stat_data, ….
  5. If it fails, check that the required runtime is installed (Node.js 18+) and that the values above are set.

Machine-readable: install.md · manifest.json