SuperAPI AI Directory

yandex-metrika-mcp

Yandex Metrika Stat, Management and Logs APIs, one tool per method, generated from Yandex's documentation. Writes are disabled by default.

Open website

About this tool

Purpose

yandex-metrika-mcp is an MCP server for the Yandex Metrika API, covering all 108 methods of the Stat, Management, and Logs interfaces. The tools are not written by hand but are automatically generated from specifications compiled based on Yandex's official documentation. It is a fork of atomkraft/yandex-metrika-mcp (upstream author Vadim Bezymianyi, MIT license), and starting from version 2.0.0 it switched to a specification-generation approach.

Main capabilities

Tools are named according to the rule metrika_<resource>_<action>, with resource names taken directly from the API URL without renaming. For example, metrika_goal_list corresponds to GET /management/v1/counter/{id}/goals and its documentation page.

The server design follows four principles, each covered by tests:

  • No silent substitutions: whatever is requested is what is sent, and the server does not add dimensions, periods, or filters on its own.
  • Anything the server adds itself is reflected in the response: the response format is {"_meta": {...}, "data": {...}}, where _meta.applied_by_server lists what the server added, and _meta.notes lists decisions made on behalf of the caller.
  • Failure is failure: API errors are returned with isError: true and the Metrika response body; retries are based on status codes (429/500/502/503/504 and network failures), not text substrings; 429 respects Retry-After, capped at 30 seconds; the number of retries is visible in _meta.retries.
  • Truncation is visible: _meta includes rows_returned, rows_total, and truncated; if the server truncates on its own due to a length limit, this is declared separately in _meta.truncated_by_server along with the number of discarded rows.

secrets do not appear in responses: the token parameter of metrika_measurement_delete is shown as REDACTED in _meta.request_url, and OAuth tokens are sent only via request headers.

Stat API reports apply the built-in bot flag filter by default, which can be seen in the tool schema, disabled via human_traffic_only: false, and listed in _meta.applied_by_server. If the request contains ym:ad: or ym:ev: metrics, this filter is not applied (Metrika returns 400 for this), and this situation is recorded in _meta.notes. Custom filter conditions are set via the environment variable METRIKA_TRAFFIC_FILTER.

The period dates of metrika_stat_comparison and metrika_stat_comparison_drilldown are optional; if not provided, Metrika uses its own window (last week) and returns a comparison of the period with itself. The server does not reject this, but notes it in _meta.notes.

Usage

Tokens use a Yandex OAuth token (the same as Direct and Webmaster). stdio transport is used by default; stateless Streamable HTTP can be enabled for a local process with multiple MCP client connections, with the endpoint http://127.0.0.1:13404/mcp,loopback Binding also verifies the Host to prevent DNS rebinding.

Supports MCPB single-file installation (suitable for clients that support MCP bundles, such as Claude Desktop); the .mcpb file is located in releases; writing cannot be enabled within the bundle.

Scenarios that do not use MCP are also supported: the same server can be started via the command line, and a skill can be attached to it (installation is a one-line command). The CLI does not initiate any requests of its own; it only parses arguments and calls executeMethod, using the same function as the MCP tools, thus ensuring consistency. The method manual in the skill is generated from spec/metrika-api.json, and that specification is updated daily from the Yandex documentation.

Default tool set

Of the 108 methods, ten are declared by default (six Stat reports for statistics plus metrika_counter_list, metrika_counter_get, metrika_goal_list, metrika_segment_list). Counter and goal management, permissions, and the Logs API are enabled via the METRIKA_PROFILE variable. The metrika_catalog_list tool is declared under any profile and lists what is declared, what is hidden, and how to enable them.

Writing is disabled by default: change tools are not declared at all. Among the methods there are fourteen DELETE and five deletion-type POST. The model cannot call anything that does not appear in tools/list. All tools carry annotations (readOnlyHint, destructiveHint, idempotentHint, openWorldHint).

Report responses are untrusted data (they may contain visitor-entered search terms, page titles, referer and UTM values); all tools carry openWorldHint: true, and reports include a reminder that this is data and not instructions.

Limitations and notes

  • There is no public openapi.json; the specification is generated by scanning documentation pages line by line by CSS class, and is tied to the generator version (Diplodoc Platform v5.57.3).
  • Tests do not include tool-selection evaluation (eval); this is an intentional omission.
  • No user data is collected, stored, or transmitted; the only networkThe target is https://api-metrika.yandex.net;令牌读入进程内存,不写入任何地方;报告数据不缓存到磁盘。用户请求的数据由 Yandex as the Metrika operator.

The above content is organized based on repository materials; details not provided (such as specific pricing and platform support scope) are not yet available.