# Yandex Metrika MCP

An MCP server that hands your coding agent the Yandex Metrika API: traffic, sources, geography, search phrases and custom reports. Useful when you want site stats without leaving the chat.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 19
- Author: stufently
- License: MIT · policy=link-only · description only; the file stays with the author
- Source: https://github.com/stufently/yandex-mcp/tree/HEAD/packages/yandex-metrika-mcp
- Updated: 2026-10-24
- HTML: https://affpapa.org/en/nevibecode/mcp/yandex-metrika-mcp

## What it does

Twelve tools ship with the server. Five cover counter management: listing sites, counter details, goals, creating a counter and deleting one. Six handle reporting — visits summary, traffic sources, geography, devices, popular pages and search phrases. The twelfth, `get-report`, takes arbitrary Metrika metrics and dimensions.

You need an OAuth token in `YANDEX_METRIKA_TOKEN`. Reading works with `metrika:read`, while `create-counter` and `delete-counter` return 403 without `metrika:write` — and that rejection shows up when you call the tool, not during setup. To get a token interactively, run `node packages/yandex-metrika-mcp/src/index.mjs auth`; it opens a browser and prints the token. Read-only access is possible by setting `YANDEX_METRIKA_SCOPE="metrika:read"`.

Deleting a counter cannot be undone, so `delete-counter` insists on `confirm: true`. Leave it out and the tool returns an error without touching the API. Only the literal `true` passes — `"true"`, `1` and `"yes"` are turned down. Install the scoped package `@stufently/yandex-metrika-mcp`: the unscoped name belongs to a different publisher. Reporting defaults to the last 30 days.

## Requirements
- Needs: Node.js (commands run via npx)
- Environment variables: `YANDEX_METRIKA_TOKEN` — keys and tokens: ask the human for the values, never commit them or put them in shared files.

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add yandex-metrika-mcp -e YANDEX_METRIKA_TOKEN=<YANDEX_METRIKA_TOKEN> -- npx -y @stufently/yandex-metrika-mcp
```
Replace <…> with your own values

### Codex

**Platform CLI**
```bash
codex mcp add yandex-metrika-mcp --env YANDEX_METRIKA_TOKEN=<YANDEX_METRIKA_TOKEN> -- npx -y @stufently/yandex-metrika-mcp
```
Replace <…> with your own values

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "yandex-metrika-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "@stufently/yandex-metrika-mcp"
            ],
            "env": {
                "YANDEX_METRIKA_TOKEN": "<YANDEX_METRIKA_TOKEN>"
            }
        }
    }
}
```
Replace <…> with your own values

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "yandex-metrika-mcp": {
            "type": "stdio",
            "command": "npx",
            "args": [
                "-y",
                "@stufently/yandex-metrika-mcp"
            ],
            "env": {
                "YANDEX_METRIKA_TOKEN": "<YANDEX_METRIKA_TOKEN>"
            }
        }
    }
}
```
Replace <…> with your own values

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add -e YANDEX_METRIKA_TOKEN=<YANDEX_METRIKA_TOKEN> yandex-metrika-mcp npx -y @stufently/yandex-metrika-mcp
```
Replace <…> with your own values

## When to use it
- ask the agent how many visits a site got this month
- break down traffic sources and spot channels that dropped
- check which cities visitors come from
- pull top search phrases without opening the web dashboard
- build a custom report from Metrika metrics and dimensions

## Example prompts
- Show me the traffic summary for counter 12345 over the last 30 days
- Which sources brought the most visits last week?
- Run `get-report` for counter 12345 with metric `ym:s:visits` and dimension `ym:s:trafficSource`

## Similar
- [labelhead-artist-momentum](https://affpapa.org/en/nevibecode/mcp/labelhead-artist-momentum.md) — MCP server · ★ 107423
- [openshorts](https://affpapa.org/en/nevibecode/mcp/openshorts.md) — MCP server · ★ 7049
- [OpenScreen](https://affpapa.org/en/nevibecode/mcp/openscreen.md) — MCP server · ★ 4863
- [Usertour MCP Server](https://affpapa.org/en/nevibecode/mcp/usertour-mcp-server.md) — MCP server · ★ 2326
- [Appllama](https://affpapa.org/en/nevibecode/mcp/appllama.md) — MCP server · ★ 3046
- [obsei](https://affpapa.org/en/nevibecode/mcp/obsei.md) — MCP server · ★ 1441

From the same set: [stufently/yandex-mcp](https://affpapa.org/en/nevibecode/by/stufently/yandex-mcp.md) — 2 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
