What it does
Полное покрытие API Яндекс Метрики: Stat, Management и Logs — 108 методов, 108 инструментов
- Connects Runs on your computer
- Account or key Needs YANDEX_API_KEY
- Category Developer tools
Use together with
Skills that teach the AI this kind of work; they work alongside this one
andrej-karpathy-skills
A single CLAUDE.md file to improve Claude Code behavior, derived from Andrej Karpathy's observations on LLM coding pitfalls.
Why it ranks here
Lists are ordered by a usage score (out of 100) built from these parts
| Popularity | 6/80 | GitHub stars or weekly downloads: the larger counts 60, the smaller 20 |
|---|---|---|
| Freshness | 12/12 | Full marks for a release or code change within 30 days |
| Still answering | 0/8 | The cloud endpoint answered at the last check |
| Usage score | 18/100 |
Quality: Passed 2/3 basic checks (shown, not used for ordering) · Momentum: No data yet (Used only on the Trending tab)
Install
Pick the AI app you use, then copy the settings.
Let your AI install it with one sentence
Please install Yandex Metrika MCP Server. Follow https://mcp.popnx.com/i/artgas1-yandex-metrika-mcp-server.md, show me the commands and wait for my OK before running them.Paste it into an AI that can work on your computer (such as Claude Code or Cursor). It reads our steps, shows you the commands and waits for your OK. No key, no sign-up. · See the full text your AI reads
Passed 2/3 checks · Runs on your computer · ✓ Commands checked Nov 14, 2026
First: which AI do you use?
Pick your app and the steps appear below.
Let AI install it
Copy this message into a Claude chat. The AI checks your computer, tells you which file it will change, and waits for your OK every time.
Please install the MCP server Yandex Metrika MCP Server for Claude on this computer, in this order: 1) Check Node.js with node -v. If it is missing, tell me to install it from https://nodejs.org/en/download; do not install it yourself. 2) Use only this config (already checked by PopNx MCP): { "mcpServers": { "yandex-metrika": { "command": "npx", "args": [ "-y", "yandex-metrika-mcp-server" ], "env": { "YANDEX_API_KEY": "your-value" } } } } 3) Tell me the full path of the file you will change, or the command you will run, and wait for my OK. 4) For YANDEX_API_KEY, leave "your-value" in place and tell me to paste the real value myself into the file or the app’s field. Never ask me to type a key in chat. 5) Do what we agreed, then check that the Yandex Metrika MCP Server tools really show up.This message has no key in it. If a key is needed, the AI will ask you to paste it yourself into the file or the app’s field.
Install Node.js (if you don’t have it)
Already installed? Check first · Open Terminal, type this command and press Enter
node -v- A version number such as v26.13.1 = installed, skip this step
- "command not found" (on Windows: "is not recognized") = not installed yet, or installed but Terminal needs to be closed and reopened
How to open Terminal
Mac: press ⌘ + Space, type Terminal, press Enter
Windows: open Start, type Windows PowerShell, then Open
Not installed: Open the official download page, pick the LTS version and the click-through installer: .pkg on Mac · .msi on Windows. Double-click and follow it to the end. No curl command needed
Open the Node.js download page ↗
When it’s done, close Terminal, open it again and run the same command. You should see a version number:
node -vInstall once; it works for everything that needs Node.js
Sign up and create a Yandex Metrika MCP Server key
Open the maker’s site, sign up and create an API key for the next step. Check the maker’s site for pricing and free plans.
How to get a key is in the maker’s README below
Open the Claude desktop app’s settings file
SettingsDeveloperEdit Config
Paste these settings and save the file
{ "mcpServers": { "yandex-metrika": { "command": "npx", "args": [ "-y", "yandex-metrika-mcp-server" ], "env": { "YANDEX_API_KEY": "your-value" } } } }Paste the key only into the app’s field, never into a chat or to anyone
Quit Claude and open it again
Try it
Use Yandex Metrika MCP Server and tell me what you can do for me, then show me one thing✓ If Claude says it is using Yandex Metrika MCP Server or shows a Yandex Metrika MCP Server tool in the answer, you are connected
5 optional setting(s) (works without them)
The command above works without these. Add them only if you want to change something, following the maker’s description.
METRIKA_PROFILEКакая часть каталога объявляется: core (10 инструментов, умолчание), read (51 читающий), all (все 108).METRIKA_ALLOW_WRITES1 разрешает и объявляет 57 инструментов, меняющих данные. Пока не задана — их нет в tools/list вовсе.METRIKA_TOOLSСвоя выборка инструментов через запятую: раздел (stat, logs, management), префикс имени или точное имя. Задана — побеждает METRIKA_PROFILE.METRIKA_TRAFFIC_FILTERУсловие сегментации, которое добавляется к отчётам Stat. По умолчанию ym:s:isRobot=='no'.METRIKA_MAX_OUTPUT_CHARSПотолок длины ответа одного вызова в символах. По умолчанию 120000.
Descriptions are as written by the maker.
Menu names checked against Anthropic’s help page on Nov 11, 2026 · your screen may differ slightly by app version
ChatGPT cannot connect Yandex Metrika MCP Server yet
Yandex Metrika MCP Server runs on your computer, but ChatGPT can only connect servers that run on the web
What you can do instead
A · Use an app that can connect Yandex Metrika MCP Server
- You need a Yandex Metrika MCP Server key (create it on the maker’s site) · Install Node.js on your computer first (one time) · Only the Claude desktop app (Windows or Mac), not the web or phone
- You need a Yandex Metrika MCP Server key (create it on the maker’s site) · Install Node.js on your computer first (one time)
- You need a Yandex Metrika MCP Server key (create it on the maker’s site) · Install Node.js on your computer first (one time)
- You need a Yandex Metrika MCP Server key (create it on the maker’s site) · Install Node.js on your computer first (one time)
B · Others in Developer tools that work with ChatGPT
Picked from the most used in the same category, only ones that connect by address with no key
- Sentry✓ ChatGPT
- Compiler Explorer✓ ChatGPT
- GitDiagram✓ ChatGPT
Works with Claude Code, with some setup first
You need a Yandex Metrika MCP Server key (create it on the maker’s site) · Install Node.js on your computer first (one time)
Let AI install it
Copy this message into a Claude Code chat. The AI checks your computer, tells you which file it will change, and waits for your OK every time.
Please install the MCP server Yandex Metrika MCP Server for Claude Code on this computer, in this order: 1) Check Node.js with node -v. If it is missing, tell me to install it from https://nodejs.org/en/download; do not install it yourself. 2) Use only this config (already checked by PopNx MCP): claude mcp add --scope user yandex-metrika --env YANDEX_API_KEY=your-value -- npx -y yandex-metrika-mcp-server 3) Tell me the full path of the file you will change, or the command you will run, and wait for my OK. 4) For YANDEX_API_KEY, leave "your-value" in place and tell me to paste the real value myself into the file or the app’s field. Never ask me to type a key in chat. 5) Do what we agreed, then check that the Yandex Metrika MCP Server tools really show up.This message has no key in it. If a key is needed, the AI will ask you to paste it yourself into the file or the app’s field.
Install Node.js (if you don’t have it)
Already installed? Check first · Open Terminal, type this command and press Enter
node -v- A version number such as v26.13.1 = installed, skip this step
- "command not found" (on Windows: "is not recognized") = not installed yet, or installed but Terminal needs to be closed and reopened
How to open Terminal
Mac: press ⌘ + Space, type Terminal, press Enter
Windows: open Start, type Windows PowerShell, then Open
Not installed: Open the official download page, pick the LTS version and the click-through installer: .pkg on Mac · .msi on Windows. Double-click and follow it to the end. No curl command needed
Open the Node.js download page ↗
When it’s done, close Terminal, open it again and run the same command. You should see a version number:
node -vInstall once; it works for everything that needs Node.js
Sign up and create a Yandex Metrika MCP Server key
Open the maker’s site, sign up and create an API key for the next step. Check the maker’s site for pricing and free plans.
How to get a key is in the maker’s README below
Open Terminal
Mac: press Command+Space and type Terminal · Windows: open PowerShell
Paste this command and press Enter
claude mcp add --scope user yandex-metrika --env YANDEX_API_KEY=your-value -- npx -y yandex-metrika-mcp-serverReplace “your-value” with your key before pressing Enter
Paste the key only into the app’s field, never into a chat or to anyone
Type /mcp in Claude Code
You should see Yandex Metrika MCP Server listed as connected
Try it
Use Yandex Metrika MCP Server and tell me what you can do for me, then show me one thing✓ If Claude Code says it is using Yandex Metrika MCP Server or shows a Yandex Metrika MCP Server tool in the answer, you are connected
5 optional setting(s) (works without them)
The command above works without these. Add them only if you want to change something, following the maker’s description.
METRIKA_PROFILEКакая часть каталога объявляется: core (10 инструментов, умолчание), read (51 читающий), all (все 108).METRIKA_ALLOW_WRITES1 разрешает и объявляет 57 инструментов, меняющих данные. Пока не задана — их нет в tools/list вовсе.METRIKA_TOOLSСвоя выборка инструментов через запятую: раздел (stat, logs, management), префикс имени или точное имя. Задана — побеждает METRIKA_PROFILE.METRIKA_TRAFFIC_FILTERУсловие сегментации, которое добавляется к отчётам Stat. По умолчанию ym:s:isRobot=='no'.METRIKA_MAX_OUTPUT_CHARSПотолок длины ответа одного вызова в символах. По умолчанию 120000.
Descriptions are as written by the maker.
Menu names checked against Anthropic’s help page on Nov 11, 2026 · your screen may differ slightly by app version
Works with Cursor, with some setup first
You need a Yandex Metrika MCP Server key (create it on the maker’s site) · Install Node.js on your computer first (one time)
Let AI install it
Copy this message into a Cursor chat. The AI checks your computer, tells you which file it will change, and waits for your OK every time.
Please install the MCP server Yandex Metrika MCP Server for Cursor on this computer, in this order: 1) Check Node.js with node -v. If it is missing, tell me to install it from https://nodejs.org/en/download; do not install it yourself. 2) Use only this config (already checked by PopNx MCP): { "mcpServers": { "yandex-metrika": { "command": "npx", "args": [ "-y", "yandex-metrika-mcp-server" ], "env": { "YANDEX_API_KEY": "your-value" } } } } 3) Tell me the full path of the file you will change, or the command you will run, and wait for my OK. 4) For YANDEX_API_KEY, leave "your-value" in place and tell me to paste the real value myself into the file or the app’s field. Never ask me to type a key in chat. 5) Do what we agreed, then check that the Yandex Metrika MCP Server tools really show up.This message has no key in it. If a key is needed, the AI will ask you to paste it yourself into the file or the app’s field.
Install Node.js (if you don’t have it)
Already installed? Check first · Open Terminal, type this command and press Enter
node -v- A version number such as v26.13.1 = installed, skip this step
- "command not found" (on Windows: "is not recognized") = not installed yet, or installed but Terminal needs to be closed and reopened
How to open Terminal
Mac: press ⌘ + Space, type Terminal, press Enter
Windows: open Start, type Windows PowerShell, then Open
Not installed: Open the official download page, pick the LTS version and the click-through installer: .pkg on Mac · .msi on Windows. Double-click and follow it to the end. No curl command needed
Open the Node.js download page ↗
When it’s done, close Terminal, open it again and run the same command. You should see a version number:
node -vInstall once; it works for everything that needs Node.js
Sign up and create a Yandex Metrika MCP Server key
Open the maker’s site, sign up and create an API key for the next step. Check the maker’s site for pricing and free plans.
How to get a key is in the maker’s README below
Fill in your key
In the Yandex Metrika MCP Server settings, YANDEX_API_KEY is empty; add your key and save
Paste the key only into the app’s field, never into a chat or to anyone
Open the AI chat in Cursor in Agent mode
Try it
Use Yandex Metrika MCP Server and tell me what you can do for me, then show me one thing✓ If Cursor says it is using Yandex Metrika MCP Server or shows a Yandex Metrika MCP Server tool in the answer, you are connected
5 optional setting(s) (works without them)
The command above works without these. Add them only if you want to change something, following the maker’s description.
METRIKA_PROFILEКакая часть каталога объявляется: core (10 инструментов, умолчание), read (51 читающий), all (все 108).METRIKA_ALLOW_WRITES1 разрешает и объявляет 57 инструментов, меняющих данные. Пока не задана — их нет в tools/list вовсе.METRIKA_TOOLSСвоя выборка инструментов через запятую: раздел (stat, logs, management), префикс имени или точное имя. Задана — побеждает METRIKA_PROFILE.METRIKA_TRAFFIC_FILTERУсловие сегментации, которое добавляется к отчётам Stat. По умолчанию ym:s:isRobot=='no'.METRIKA_MAX_OUTPUT_CHARSПотолок длины ответа одного вызова в символах. По умолчанию 120000.
Descriptions are as written by the maker.
Menu names checked against Cursor’s help page on Nov 11, 2026 · your screen may differ slightly by app version
Works with VS Code, with some setup first
You need a Yandex Metrika MCP Server key (create it on the maker’s site) · Install Node.js on your computer first (one time)
Let AI install it
Copy this message into a VS Code chat. The AI checks your computer, tells you which file it will change, and waits for your OK every time.
Please install the MCP server Yandex Metrika MCP Server for VS Code on this computer, in this order: 1) Check Node.js with node -v. If it is missing, tell me to install it from https://nodejs.org/en/download; do not install it yourself. 2) Use only this config (already checked by PopNx MCP): { "servers": { "yandex-metrika": { "type": "stdio", "command": "npx", "args": [ "-y", "yandex-metrika-mcp-server" ], "env": { "YANDEX_API_KEY": "your-value" } } } } 3) Tell me the full path of the file you will change, or the command you will run, and wait for my OK. 4) For YANDEX_API_KEY, leave "your-value" in place and tell me to paste the real value myself into the file or the app’s field. Never ask me to type a key in chat. 5) Do what we agreed, then check that the Yandex Metrika MCP Server tools really show up.This message has no key in it. If a key is needed, the AI will ask you to paste it yourself into the file or the app’s field.
Install Node.js (if you don’t have it)
Already installed? Check first · Open Terminal, type this command and press Enter
node -v- A version number such as v26.13.1 = installed, skip this step
- "command not found" (on Windows: "is not recognized") = not installed yet, or installed but Terminal needs to be closed and reopened
How to open Terminal
Mac: press ⌘ + Space, type Terminal, press Enter
Windows: open Start, type Windows PowerShell, then Open
Not installed: Open the official download page, pick the LTS version and the click-through installer: .pkg on Mac · .msi on Windows. Double-click and follow it to the end. No curl command needed
Open the Node.js download page ↗
When it’s done, close Terminal, open it again and run the same command. You should see a version number:
node -vInstall once; it works for everything that needs Node.js
Sign up and create a Yandex Metrika MCP Server key
Open the maker’s site, sign up and create an API key for the next step. Check the maker’s site for pricing and free plans.
How to get a key is in the maker’s README below
Fill in your key
In the Yandex Metrika MCP Server settings, YANDEX_API_KEY is empty; add your key and save
Paste the key only into the app’s field, never into a chat or to anyone
Open the AI chat in VS Code in Agent mode
Try it
Use Yandex Metrika MCP Server and tell me what you can do for me, then show me one thing✓ If VS Code says it is using Yandex Metrika MCP Server or shows a Yandex Metrika MCP Server tool in the answer, you are connected
5 optional setting(s) (works without them)
The command above works without these. Add them only if you want to change something, following the maker’s description.
METRIKA_PROFILEКакая часть каталога объявляется: core (10 инструментов, умолчание), read (51 читающий), all (все 108).METRIKA_ALLOW_WRITES1 разрешает и объявляет 57 инструментов, меняющих данные. Пока не задана — их нет в tools/list вовсе.METRIKA_TOOLSСвоя выборка инструментов через запятую: раздел (stat, logs, management), префикс имени или точное имя. Задана — побеждает METRIKA_PROFILE.METRIKA_TRAFFIC_FILTERУсловие сегментации, которое добавляется к отчётам Stat. По умолчанию ym:s:isRobot=='no'.METRIKA_MAX_OUTPUT_CHARSПотолок длины ответа одного вызова в символах. По умолчанию 120000.
Descriptions are as written by the maker.
Menu names checked against VS Code’s help page on Nov 11, 2026 · your screen may differ slightly by app version
Other apps that use MCP, such as Windsurf, Zed or Gemini CLI, each add servers differently. See how in the app list.
JSON settings are under “For developers” below
For developers: Terminal commands and JSON settings
Installed on your computer
Claude Code
claude mcp add --scope user yandex-metrika --env YANDEX_API_KEY=your-value -- npx -y yandex-metrika-mcp-serverClaude Desktop (claude_desktop_config.json)
{
"mcpServers": {
"yandex-metrika": {
"command": "npx",
"args": [
"-y",
"yandex-metrika-mcp-server"
],
"env": {
"YANDEX_API_KEY": "your-value"
}
}
}
}Cursor (~/.cursor/mcp.json)
{
"mcpServers": {
"yandex-metrika": {
"command": "npx",
"args": [
"-y",
"yandex-metrika-mcp-server"
],
"env": {
"YANDEX_API_KEY": "your-value"
}
}
}
}VS Code (mcp.json)
{
"servers": {
"yandex-metrika": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"yandex-metrika-mcp-server"
],
"env": {
"YANDEX_API_KEY": "your-value"
}
}
}
}Values you fill in
YANDEX_API_KEYsecret required envOAuth-токен Яндекса с доступом к Метрике. Без него сервер не стартует.METRIKA_PROFILEenvКакая часть каталога объявляется: core (10 инструментов, умолчание), read (51 читающий), all (все 108).METRIKA_ALLOW_WRITESenv1 разрешает и объявляет 57 инструментов, меняющих данные. Пока не задана — их нет в tools/list вовсе.METRIKA_TOOLSenvСвоя выборка инструментов через запятую: раздел (stat, logs, management), префикс имени или точное имя. Задана — побеждает METRIKA_PROFILE.METRIKA_TRAFFIC_FILTERenvУсловие сегментации, которое добавляется к отчётам Stat. По умолчанию ym:s:isRobot=='no'.METRIKA_MAX_OUTPUT_CHARSenvПотолок длины ответа одного вызова в символах. По умолчанию 120000.
Descriptions are as written by the maker.
These settings are generated from the maker’s registry entry. If the README says otherwise, follow the README.
At a glance
Which apps can use it
Based on how this server connects and on each app’s own docs, checked Nov 10, 2026.
Run on your computer in
ClaudeGooseLM StudioMsty StudioCherry StudioCursorVS Code + GitHub CopilotVisual StudioWindsurf (Devin Desktop)ZedKiroClineContinueJetBrains AI AssistantClaude CodeCodex CLIGemini CLIOpenCodenodecodeWarpLibreChatRaycast
Related guides
What it can do
Runs on your computer; the tool list appears in your AI app after you install it.
Basic checksi
We check information anyone can see; we have not read the code. Checks that do not apply are left out of the count. · Checked Nov 20, 2026
- ✓ Pass
Maker matches the repo
The registry name was verified with the GitHub account artgas1, which owns the repo
- ✓ Pass
Still maintained
Code last changed 13 days ago
- ! Caution
Has a licence
GitHub could not identify the licence type; open the file to check
- – Not applicable
Endpoint responds
This one runs on your computer; there is no internet endpoint
- – Not applicable
Sign-in with OAuth
Runs on your computer and uses local settings instead
- … Not checked yet
No hidden instructions in tool descriptions
Runs on your computer; we can only read tool lists from internet endpoints
Published vulnerabilities (OSV.dev)
No entries on OSV.dev for yandex-metrika-mcp-server@3.3.1
Checks only this package version, not every dependency · checked Nov 15, 2026
Makers: ask for a re-check or report wrong info
For makers: add a badge to your README
If you made this, paste this code into your README. The badge links back to this page.
[](https://mcp.popnx.com/en/servers/artgas1-yandex-metrika-mcp-server)Discussion
Ask, share a tip or report that it does not work. Sorted by what people marked helpful.
No posts yet. Be the first to ask or share.
Posts here are written by users, not the PopNx team.
User reviews
No reviews yet
Compared with others in Developer toolsi
- More stars than 78% of the other 6202 servers in this category
- Published to the registry more recently than 32% of the other 6202 servers in this category
- Basic checks equal to or better than 45% of the other 6202 servers in this category
Compared with every active server in this category in the registry. Stars count only when the publisher owns the repo.
Common questions
Is Yandex Metrika MCP Server safe?
It passed 2 of 3 applicable basic checks. We have not read the code. Before adding a key or token, see what access the server asks for and use a key with only the permissions you need.
What keys or codes does it need?
You need to fill in: YANDEX_API_KEY
Does it run on my computer or in the cloud?
It runs on your computer. Your AI app starts it when needed, and data does not pass through the maker’s servers (unless it calls an online service itself).
Is it still maintained?
The GitHub repo last changed 13 days ago, and the latest version (3.3.1) reached the registry 2 months ago.
Which apps can use it?
Apps that support MCP, such as Claude Desktop, Claude Code, Cursor and VS Code. You also need Node.js on your computer.
What can I use instead?
In the same category: GitDiagram, Appllama, Cloudflare MCP, Omnara, Repowise
Similar alternatives
Same category, other makers, commands already checked. Official ones first, then by stars.
Reading a card:↓ Downloads per weeki★ GitHub starsiThree pillars: reviews · checks · usageiUpdated = latest version published to the registryi
GitDiagram
Architecture diagrams, explanations and Mermaid source for public GitHub repositories.
Appllama
Study screens, flows and paywalls from top-earning iOS apps, then build from what wins.
Cloudflare MCP
Cloudflare MCP servers
Omnara
Deploy durable AI agents with Omnara, an open-source managed-agent platform.
Repowise
Codebase intelligence for AI coding agents: graph, git history, docs, decisions, code health.
| This one Yandex Metrika MCP Server | GitDiagram | Appllama | Cloudflare MCP | Omnara | Repowise | |
|---|---|---|---|---|---|---|
| Runs where | Installs on your computer | Runs in the cloud, nothing to install | Runs in the cloud, nothing to install | Runs in the cloud, nothing to install | Runs in the cloud, nothing to install | Cloud or install on your computer |
| Needs a key | Yes | No | No | No | No | No |
| Add with + in Claude | No | No | No | Yes | No | No |
| Basic checks | 2/3 | 4/4 | 4/4 | 4/4 | 4/4 | 5/5 |
| License | NOASSERTION | MIT | MIT | Apache-2.0 | Apache-2.0 | AGPL-3.0 |
| Price | No cost listed in the registry | No cost listed in the registry | No cost listed in the registry | No cost listed in the registry | No cost listed in the registry | No cost listed in the registry |
README from the maker
Open the README
Copied from the maker’s repo as written. PopNx MCP has not reviewed or endorsed it. HTML, images and scripts are removed. Links lead off this site.
Yandex Metrika MCP Server
MCP-сервер к API Яндекс Метрики. Покрыты все 108 методов; по умолчанию объявляются десять — те, которыми считают. Остальное включается одной переменной.
mcp-name: io.github.artgas1/yandex-metrika-mcp-server
*English*
npx -y yandex-metrika-mcp-server
Форк atomkraft/yandex-metrika-mcp (апстрим — Vadim Bezymianyi, MIT). С версии 2.0.0 инструменты не пишутся руками, а порождаются из спеки, собранной по официальной документации.
Покрытие
| API | методов | из них в профиле core | примеры инструментов |
|---|---|---|---|
| Management | 95 (21 ресурс) | 4 | metrika_counter_list, metrika_goal_create, metrika_segment_update |
| Logs | 7 | — | metrika_logs_create, metrika_logs_get, metrika_logs_download |
| Stat | 6 | 6 | metrika_stat_data, metrika_stat_bytime, metrika_stat_pivot |
Имя инструмента — metrika_<ресурс>_<действие>, где ресурс взят из URL самого API без переименований. Поэтому metrika_goal_list однозначно отображается в GET /management/v1/counter/{id}/goals и в свою страницу документации.
Контракт
Сервер переписан из-за двух наблюдавшихся отказов: он отдавал не то, что просили, и молча подмешивал фильтр. Отсюда четыре правила, каждое закрыто тестом.
- Никакой молчаливой подмены. Что попросили — то и уходит в API. Сервер не досочиняет ни измерений, ни периода, ни фильтров.
- Всё, что сервер добавил от себя, видно в ответе. Ответ приходит как
{"_meta": {...}, "data": {...}}, где_meta.applied_by_serverперечисляет добавленное, а_meta.notes— принятые за вызывающего решения. - Отказ остаётся отказом. Ошибка API возвращается с
isError: trueи телом ответа Метрики. Повтор делается по статусу (429/500/502/503/504 и сетевые сбои), а не по подстроке в тексте; у 429 соблюдаетсяRetry-Afterс потолком 30 секунд. Число повторов всегда видно в_meta.retries. - Обрезание выдачи видно. В
_metaедутrows_returned,rows_totalиtruncated— Метрика режет ответ по умолчанию, и молчать об этом нельзя. Если сервер сам урезал ответ по потолку длины, это отдельно объявлено в_meta.truncated_by_serverс числом выброшенных строк. - Секреты не уезжают в ответ. У
metrika_measurement_deleteесть параметрtoken; в показанном_meta.request_urlего значение заменено наREDACTED. Сам OAuth-токен уходит только заголовком и в ответе не появляется никогда.
Фильтр роботов
В отчётах Stat API по умолчанию применяется собственный флаг робота Метрики, и только он:
ym:s:isRobot=='no'
Он объявлен: виден в схеме инструмента, отключается параметром human_traffic_only: false и всегда перечислен в _meta.applied_by_server. Если в запросе есть метрики ym:ad: или ym:ev:, фильтр не применяется (Метрика отвечает на такое сочетание 400) — и это попадает в _meta.notes, а не остаётся молчаливым исключением.
Своё условие задаётся переменной METRIKA_TRAFFIC_FILTER — целиком, включая isRobot, если он нужен:
METRIKA_TRAFFIC_FILTER="ym:s:isRobot=='no' AND ym:s:browserName!='HeadlessChrome'"
Это образец формы, а не рекомендация. Какой рез верен — зависит от того, какие боты ходят именно к вам: отсечка по стране, по заголовку браузера или по подсети осмысленна только на своих данных. Копировать чужой список бессмысленно и опасно: он вырежет живой трафик.
Заданное своё условие сервер называет в stderr при старте — оно меняет числа в каждом отчёте, и молчать об этом нельзя.
Сравнение периодов: ответ, который выглядит валидным
У metrika_stat_comparison и metrika_stat_comparison_drilldown даты периодов необязательны, и Метрика на их отсутствие не ругается. Она подставляет собственное окно (последняя неделя) в оба набора и возвращает сравнение периода с самим собой:
metrika_stat_comparison(ids, metrics) → totals a == b
query date1_a == date1_b
Отказывать сервер не будет — запрос ушёл ровно тем, каким его собрали. Но такой ответ приходит с пометкой в _meta.notes: и когда даты не заданы, и когда периоды совпали явно.
Как устроена спека
Публичного openapi.json у Метрики нет, но каждая страница метода сгенерирована из OpenAPI движком Diplodoc и отдаётся как text/markdown. Семантика (тип, required, комбинатор, ассертация) лежит в CSS-классах вида {.json-schema-property}, поэтому спека собирается построчным сканером по классам, а не markdown-парсером.
npm run spec:fetch # скачать llms.txt и 108 страниц в .cache/docs/
npm run spec:build # разобрать их в spec/metrika-api.json npm test # тесты спеки и схем инструментов npm run smoke # живые вызовы к API (нужен YANDEX_API_KEY)
spec/metrika-api.json коммитится — это состав API на момент сборки. Тест на дрейф сверяет его с llms.txt: Яндекс добавил или удалил метод — тест краснеет.
Разбор привязан к версии генератора (Diplodoc Platform v5.57.3): вся семантика висит на его классах, поэтому расхождение версии останавливает сборку спеки, а не молча портит её.
Запуск
По умолчанию объявляются десять инструментов из 108 — те, которыми считают. Управление
счётчиками и целями, доступы и Logs API включаются переменной
METRIKA_PROFILE; подробности
ниже, в разделе «Почему по умолчанию не всё».
Спросить у самого сервера тоже можно: инструмент
metrika_catalog_listперечисляет, что
объявлено, что скрыто и как это включить.
npm install
npm run build YANDEX_API_KEY= npm start
Токен — OAuth Яндекса, тот же, что используется для Директа и Вебмастера.
По умолчанию сервер сохраняет stdio-режим. Для одного локального процесса, к которому подключаются несколько MCP-клиентов, включите stateless Streamable HTTP:
YANDEX_API_KEY=<OAuth-токен> \
MCP_TRANSPORT=http MCP_HOST=127.0.0.1 MCP_PORT=13404 \ npm start
Endpoint — http://127.0.0.1:13404/mcp. При loopback-привязке сервер также проверяет Host, чтобы локальный endpoint нельзя было вызвать через DNS rebinding.
Подключение к клиенту
{
"mcpServers": { "yandex-metrika-mcp": { "command": "npx", "args": ["-y", "yandex-metrika-mcp-server@3"], "env": { "YANDEX_API_KEY": "..." } } } }
Из локальной сборки — то же самое, но "command": "node" и путь до build/index.js.
Мажор в строке запуска закреплён намеренно: смена мажорной версии меняет набор инструментов по умолчанию, и получать это молча при старте агента не нужно.
Переменные окружения
| Переменная | По умолчанию | Что делает |
|---|---|---|
YANDEX_API_KEY | — | OAuth-токен. Без него сервер не стартует. |
MCP_TRANSPORT | stdio | Транспорт: stdio или stateless Streamable http. |
MCP_HOST | 127.0.0.1 | Адрес HTTP listener. Используется только при MCP_TRANSPORT=http. |
MCP_PORT | 3000 | Порт HTTP listener, целое число от 1 до 65535. |
METRIKA_PROFILE | core | Какая часть каталога объявляется: core (10 инструментов), read (все 51 читающих), all (все 108). Неизвестное значение роняет старт. |
METRIKA_ALLOW_WRITES | не задана | 1 разрешает и объявляет 57 инструментов, меняющих данные. Пока не задана — их нет в tools/list вовсе. |
METRIKA_TOOLS | пусто | Своя выборка через запятую: раздел (stat, logs, management), префикс имени (metrika_goal) или точное имя. Задана — побеждает профиль. |
METRIKA_TRAFFIC_FILTER | ym:s:isRobot=='no' | Условие сегментации, добавляемое к отчётам Stat. Задаётся целиком. |
METRIKA_MAX_OUTPUT_CHARS | 120000 | Потолок длины ответа одного вызова. Выгрузка Logs API в него обычно не помещается — сутки визитов это сотни тысяч символов; урезание объявляется в _meta.truncated_by_server. |
METRIKA_API_BASE | пусто | Подмена адреса API (прокси, заглушка в тестах). Факт подмены печатается в stderr. |
Как узнать, что скрыто, не открывая README
Инструмент `metrika_catalog_list` объявлен в любом профиле и отвечает из спеки, лежащей в пакете, — ни токена, ни сети ему не нужно:
{
"profile": "METRIKA_PROFILE=core", "api_methods_total": 108, "api_methods_declared": 10, "api_methods_hidden": 98, "writes_enabled": false, "declared_tools": { "Stat API — отчёты": ["metrika_stat_data", "…"] }, "hidden_tools": { "Management API — …": ["metrika_goal_create", "…"] }, "how_to_widen": ["METRIKA_PROFILE=read — …", "METRIKA_PROFILE=all вместе с METRIKA_ALLOW_WRITES=1 — …"] }
Он существует по простой причине: сервер, который что-то скрыл, обязан уметь сказать, что именно и как это включить. instructions видит модель, но не человек — в интерфейс клиента они не показываются; стартовую строку в stderr в обычной работе тоже никто не открывает. Без этого инструмента узнать про остальные 98 можно было только придя сюда.
Список инструментов в ответе строится из того же отбора, по которому они регистрируются, — разойтись с реальностью ему негде, и это проверено тестом.
Почему по умолчанию не всё
Описания объявленных инструментов лежат в контексте модели, когда клиент их загрузил. Это цена сервера, которую платят за сам факт подключения, а не за вызовы. Замер tools/list (09.09.2026):
| Профиль | Инструментов | tools/list | токенов |
|---|---|---|---|
core (по умолчанию) | 10 + каталог | 32 181 Б | 14,8 тыс. |
read | 51 + каталог | 68 074 Б | ~31 тыс. — оценка |
all + METRIKA_ALLOW_WRITES=1 | 108 + каталог | 158 301 Б | ~73 тыс. — оценка |
Замер core — 14,5 тысячи до появления каталога и 14,8 после: сам инструмент стоит около 670 байт схемы, примерно 2% набора. Его ответ не входит в эту цену — он платится только при вызове.
Байты точные, их воспроизведёт любой: сериализуй ответ tools/list и посчитай длину. С токенами сложнее, и здесь стоит сказать прямо.
⚠️ Замер честный только у `core` — его дал /context клиента, который считает собственным токенизатором. Две другие строки пересчитаны из байтов по калибровке 2,17 байта на токен, снятой с той же строки core.
Ходовая эвристика «4 символа на токен» здесь врёт почти вдвое: она выведена на английском тексте, а описания у этого сервера русские, и кириллица в BPE токенизируется примерно вдвое хуже латиницы. Первая редакция этой таблицы была построена именно на ней и называла для core 7,9k вместо 14,5k. Если считаешь бюджет контекста для сервера с не-английскими описаниями — считай токенизатором, а не делением на четыре.
Состав core выведен из замера реального использования, а не из вкуса: шесть отчётов Stat плюс справочники, без которых отчёт не собрать (metrika_counter_list, metrika_counter_get, metrika_goal_list, metrika_segment_list). Порог веса стоит тестом — манифест не может подорожать молча. Порог в тесте стоит на байтах: они не зависят ни от токенизатора, ни от языка описаний.
Безопасность
- **За