SuperAPIAI Directory

mcp-yandex-metrica

github.com · AI marketing

Read-only Yandex Metrica web analytics: list counters and goals, and pull traffic and conversion statistics.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)

About this tool

Purpose

mcp-yandex-metrica is an MCP (Model Context Protocol) server for connecting Yandex Metrica website analytics data to AI clients. It lets AI applications such as Claude, Cursor, and Codex ask about website traffic, sources, behavior, and goal conversions in natural language, with the assistant retrieving data from a specified counter and explaining the results.

Main capabilities

The server provides eight tools covering counters, goals, and Metrica reports, as well as connecting and disconnecting access, plus a generic API request tool.

For reports and conversions, it supports querying visits, users, pageviews, bounce rate, visit duration, traffic sources, devices, and goal completions for a specified period.

Connecting happens in the conversation: Yandex opens a login page, the one-time code is valid for 10 minutes, and the server immediately checks access to the counter after connecting.

Normal queries are read-only: the dedicated tools do not modify counters, goals, or Metrica data.

Reports are not silently truncated: totals and sampling flags are shown in the results; when the output is large, the server indicates whether a limit was reached.

How to use

Node.js 20 or higher is required. The server is started via npx, with no separate package installation needed.

After adding the server to an AI application, request "connect Yandex Metrica" in the conversation, and the assistant will guide you through the Yandex login and immediately check whether it can see your counters. You can then ask questions such as "which sources brought the most visits last month?"

When adding through the application interface, open Settings → Plugins → MCP servers, click Add server, and add the startup command npx -y mcp-yandex-metrica@latest.

After adding via the command line, you can check the connection, then request connecting Metrica in the Codex chat.

In Claude Code, open Settings → Developer → Edit Config, add the server to claude_desktop_config.json, save, then open a new conversation and request connecting.

In Cursor, create ~/.cursor/mcp.jsonfor all projects, or create .cursor/mcp.jsononly for the current project; the server will appear among the available tools in the Cursor chat, so request connecting and complete the Yandex login.

In VS Code, open the command palette and run MCP: Open User Configuration, add the configuration in mcp.json , check startup via MCP: List Servers , then open the chat and request connecting.

Suitable scenarios

Understanding website status: query visits, users, and pageviews for the last week; view visit dynamics by day; compare bounce rates across different devices.

Analyzing traffic sources and quality: view monthly traffic sources sorted by visits; compare users and bounce rate for organic search versus ads; find the sources that brought the most clicks this week.

Analyzing conversions: view which goals are configured in the counter; query the conversion rate for the "order" goal over 30 days; find the sources that brought the most goal completions.

Checking access and data accuracy: view accessible counters; view the connection status with Metrica; confirm whether report data is exact or whether Metrica used sampling.

Limitations

Sampling: over longer periods or for complex reports, the API may return approximate data. You can view the sampled and sample_share fields; for more precision, narrow the period or use accuracy: "full".

Report size: a single request returns at most 10,000 rows. Automatic pagination stops at a maximum of 100 pages, 100,000 rows, or about 1 MB of data, and uses _truncated Field marks an incomplete response.

Request retries: a single request times out after 60 seconds. The server retries up to three times on temporary errors: GET is retried on network errors, 429, and 5xx; POST and DELETE are retried only on 429 to avoid repeatedly executing modifying operations. The delay takes Retry-After into account and does not exceed 30 seconds.

Production data: Metrica has no sandbox environment. Dedicated tools read data, but POST and DELETE through generic requests modify real objects.

No background monitoring: the server runs only when the AI application calls it and does not continuously monitor metrics on its own. If the application supports scheduled tasks, periodic report requests can be configured there.

Connection and security

Regular use does not require creating a token in advance: in the chat, request a connection to Yandex Metrica, open the Yandex OAuth link and sign in with an account that has access to the required counters, and after confirming access send the code to the assistant. The code is valid for 10 minutes and is exchanged for a token only inside the running server.

The server uses PKCE: the code in the chat cannot itself be exchanged for a token. The obtained token is stored locally in ~/.config/mcp-yandex-metrica/credentials.json, and only the owner has permission. After the refresh token is saved, access is extended automatically.

For CI and non-standard installations, it can be configured via environment variables. If you use your own OAuth app, you need to request the "Get statistics, read parameters of own and trusted counters" permission (metrika:read).

Data and telemetry

By default, the server sends anonymous technical telemetry: a random installation identifier, event or tool name, server version, Node.js version, operating system, and information about the connected AI client. It does not contain tokens, counter data, tool parameters, your messages, or environment variable values.

To disable telemetry for the Ask Ads MCP server, you can set an environment variable.

Up/Down to navigate · Enter to open · ESC to closeBrowse all tools