Query Yandex Metrica web analytics β reports, trends and metadata β via an AI agent.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
π‘ Paste into ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows)
Ask your Yandex Metrica analytics in plain language β from Claude, Cursor, or any MCP client.
A Model Context Protocol (MCP) server for Yandex Metrica. It lets an AI agent query your web-analytics data β traffic, sources, landing pages, conversions, geography, devices and trends β through a small set of flexible, read-only tools.
Read-only by design, no secrets stored in the package: interactive login uses a built-in public OAuth client with PKCE, and the server talks only to Yandex.
Status: early development (v0.1, work in progress). General-purpose: SEO is one of many use cases, not the focus.
Point an AI agent at your counter and ask about your traffic β the server queries
Yandex Metrica and hands back real, read-only data, no dashboards. Here the
run_report tool answers a βtraffic sources, last 7 daysβ question against a live
counter:

1. Add the server to your MCP client (e.g. Claude Desktop) β no token required up front; you log in interactively in step 2:
2. Log in once β one command, no app registration, no secret stored:
Approve access in the browser and you're done β the code is handed back automatically over a local redirect, no copy-paste. The login uses authorization-code + PKCE, so no client secret ever touches your machine; the token is cached (mode 0600) and valid for ~1 year.
3. Ask your agent about traffic, sources, conversions, geography, devices, or trends β see Examples for prompts.
Prefer a static token (CI / non-interactive) or your own OAuth app? See Authentication.
The repo doubles as a plugin marketplace, so you can install the server through Claude Code's plugin system instead of the config above:
Then run npx yandex-metrica-mcp auth once to log in.
For a one-click install with no JSON, download the .mcpb from the
latest release
and open it with Claude Desktop (or drag it into Settings β Extensions). It asks
for an optional default counter id; then sign in from the chat with the login
tool (or run npx yandex-metrica-mcp auth).
There is no official Yandex Metrica MCP server, and existing community ones are mostly thin, unmaintained, or dump raw data straight into the model's context. This server aims to be the well-engineered, well-maintained, open option: flexible report tools, strict token/context discipline, read-only by default.
run_report β flexible wrapper over the Reporting API (/stat/v1/data).run_comparison β compare two periods with absolute and percentage deltas.run_drilldown β drill down through a dimension tree.run_timeseries β metrics split into a time series (/bytime) for trends.get_metadata β discover the counters on your account and a catalog of common
dimensions/metrics (and Logs API fields) so the model queries with real names.describe_counter β read one counter's configuration (goals, segments,
filters, operations, access grants) via an include selector. The goals
section gives the goal ids needed for conversion metrics in run_report.logs_request / logs_status / logs_download / logs_clean β Logs API:
export raw, un-sampled session (visits) or hit (hits) rows. Async lifecycle
(request β poll β download β clean); logs_download returns a bounded sample
inline by default, or streams the full export to a file β never dumping raw
rows into the model's context.login / submit_code β sign in to Yandex Metrica from your MCP client, no
terminal needed: login opens the browser and captures the code over a local
redirect, or hands back a URL and takes the pasted code via submit_code.Planned for later: Streamable HTTP transport, write tools (behind an explicit flag).
metrika:read scope (see
Authentication). Whoever the credentials belong to must have access to the
counters you query.Recommended: interactive login. No app registration needed β the server ships a built-in public OAuth client. Run once:
It opens the Yandex consent page in your browser; after you approve, the code is
returned automatically over a loopback redirect (http://127.0.0.1:53682) β no
copy-paste. If that port is taken, it falls back to showing a code you paste in
(force that flow with auth --oob, or change the port with
YANDEX_OAUTH_LOOPBACK_PORT). The token is cached at
~/.config/yandex-metrica-mcp/token.json (mode 0600) and is valid for ~1 year;
re-run auth when it expires. The login uses authorization-code + PKCE, so no
client secret is stored anywhere. A cached login takes precedence over
YANDEX_METRIKA_TOKEN.
From your MCP client (no terminal). Not signed in yet? The server still
starts β ask your agent to run the login tool and it does the same browser
flow in-process (or returns a URL and takes the code via submit_code). Handy
for GUI clients like Claude Desktop, where there is no terminal to run auth. Get a token for an app with the metrika:read
scope at https://oauth.yandex.ru and pass it as YANDEX_METRIKA_TOKEN β handy
for CI or non-interactive use.
Own OAuth app (optional). To use your own app instead of the built-in one,
set YANDEX_OAUTH_CLIENT_ID; add YANDEX_OAUTH_CLIENT_SECRET to also enable
automatic token refresh.
The Quickstart covers the happy path. For all options β static
token, your own OAuth app, default counter, request tuning, language β see
.env.example. The published package runs on Node (so
npx/MCP clients work out of the box); local development uses
Bun.
Once connected, an agent can answer questions like:
run_report with metrics: ["ym:s:visits","ym:s:users"],
dimensions: ["ym:s:lastsignTrafficSource"].run_comparison
(server returns A, B, and the deltas).run_drilldown, then again with parentId.get_metadata.describe_counter (include: ["goals"]) for the goal id, then
run_report with ym:s:goal<id>conversionRate.logs_request (source: "visits"), poll logs_status, then
logs_download (mode: "file"), then logs_clean to free the quota.This project is Bun-first:
MIT Β© boxlab
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/yandex-metrica-mcp)<a href="https://allmcps.com/mcp/yandex-metrica-mcp"><img src="https://allmcps.com/api/badge/yandex-metrica-mcp?style=directory" alt="Yandex Metrica Mcp on AllMCPs" /></a>