yandex-metrika-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@yandex-metrika-mcp show me the traffic report for the last 7 days"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
@rezlazy/yandex-metrika-mcp
MCP server for Yandex Metrika Reports API (/stat/v1/*) and Management API (/management/v1/*).
Exposes 68 tools: 6 report tools and 62 management tools (counters, goals, filters, grants, segments, labels, and more).
Requirements
Node.js 20+
OAuth token with
metrika:read(reports) and/ormetrika:write(create/update/delete)
Related MCP server: Yandex Direct MCP
Getting an OAuth token
Create a Yandex OAuth app — choose For API access or debugging.
Add permissions metrika:read (reports) and metrika:write (management changes).
Copy the app Client ID.
Open in browser:
https://oauth.yandex.ru/authorize?response_type=token&client_id=<CLIENT_ID>Copy the token from the redirect URL (
access_token=...).
See Yandex Metrika authorization docs.
Cursor configuration
Add to .cursor/mcp.json or Cursor MCP settings:
From GitHub (builds dist via prepare on install):
{
"mcpServers": {
"yandex-metrika": {
"command": "npx",
"args": ["-y", "github:Rezlazy/yandex-metrika-mcp"],
"env": {
"METRIKA_TOKEN": "<your-oauth-token>"
}
}
}
}The default branch includes prepare. Pin a release with github:Rezlazy/yandex-metrika-mcp#v0.2.2 (v0.2.0 does not build from git).
For local development (.cursor/mcp.json in this repo):
{
"mcpServers": {
"yandex-metrika": {
"type": "stdio",
"command": "node",
"args": ["${workspaceFolder}/dist/index.js"],
"envFile": "${workspaceFolder}/.env"
}
}
}Create .env in the project root:
METRIKA_TOKEN=your_oauth_tokenEnvironment variables
Variable | Required | Description |
| yes | OAuth token ( |
| no | API base URL (default: |
Multi-root workspace (*.code-workspace)
If you open mcp.code-workspace (several folders in one window), Cursor may not show project MCP servers from .cursor/mcp.json in Settings → MCP. This is a known Cursor limitation.
Workarounds:
Open this repo directly: File → Open Folder →
yandex-metrika-mcp(not the.code-workspacefile).Or add to global config
~/.cursor/mcp.json(works in multi-root):
"yandex-metrika": {
"type": "stdio",
"command": "node",
"args": ["/absolute/path/to/yandex-metrika-mcp/dist/index.js"],
"envFile": "/absolute/path/to/yandex-metrika-mcp/.env"
}After config changes: Refresh MCP in settings or restart Cursor. Check logs: Output panel → MCP Logs.
Tools
Reports (stat_*) — 6 tools
Tool | Description |
| Table report |
| Time series (charts, trends) |
| Tree / drill-down report |
| Compare two segments (A vs B) |
| Segment comparison with drill-down |
| Pivot table |
Management (mgmt_*) — 62 tools
Covers Management API: counters, goals, filters, operations, grants, access filters, segments, chart annotations, labels, accounts, delegates, clients, cloud exports.
Common management tools:
Tool | Description |
| List available counters |
| Get counter details |
| Create counter |
| List counter goals |
| Create goal |
| List access grants |
| List saved segments |
For POST/PUT methods pass JSON in the body parameter (see API formats). Example for creating a counter:
{
"body": {
"counter": {
"name": "My site",
"site": "example.com"
}
}
}Report parameters
ids — counter ID(s), comma-separated
metrics — e.g.
ym:s:visits,ym:s:users,ym:s:pageviewsdimensions — e.g.
ym:s:trafficSource,ym:s:operatingSystemdate1 / date2 — period (
7daysAgo,today, orYYYY-MM-DD)filters — segmentation expression
preset — report preset
format —
json(default) orcsv
Full list of metrics and dimensions: attrandmetr.
Example: visits by traffic source
Tool: stat_data
{
"ids": "44147844",
"metrics": "ym:s:visits,ym:s:users",
"dimensions": "ym:s:trafficSource",
"date1": "30daysAgo",
"date2": "today",
"sort": "-ym:s:visits",
"limit": "10"
}Example: daily visits trend
Tool: stat_bytime
{
"ids": "44147844",
"metrics": "ym:s:visits",
"date1": "30daysAgo",
"date2": "today",
"group": "day"
}Development
npm install
npm run typecheck
npm test
npm run buildChangelog
See CHANGELOG.md.
License
MIT
Available Tools
68 toolsmgmt_access_filter_createC
https://yandex.ru/dev/metrika/ru/management/ Create access filter. Body: {"access_filter": {...}}
Inputs: body (required), counterId (required), pretty.
mgmt_access_filter_deleteC
https://yandex.ru/dev/metrika/ru/management/ Delete access filter
Inputs: counterId (required), accessFilterId (required), pretty, delete_grants.
mgmt_access_filter_getC
https://yandex.ru/dev/metrika/ru/management/ Get access filter by ID
Inputs: counterId (required), accessFilterId (required), pretty.
mgmt_access_filters_listC
https://yandex.ru/dev/metrika/ru/management/ List access filters for counter
Inputs: counterId (required), pretty.
mgmt_access_filter_updateC
https://yandex.ru/dev/metrika/ru/management/ Update access filter. Body: {"access_filter": {...}}
Inputs: body (required), counterId (required), accessFilterId (required), pretty.
mgmt_account_deleteD
https://yandex.ru/dev/metrika/ru/management/ Delete linked account
Inputs: user_login (required), pretty.
mgmt_accounts_listC
https://yandex.ru/dev/metrika/ru/management/ List linked Yandex accounts
Inputs: pretty, callback.
mgmt_accounts_updateB
https://yandex.ru/dev/metrika/ru/management/ Update accounts list. Body: {"accounts": [{"user_login": "..."}]}
Inputs: body (required), pretty.
mgmt_chart_annotation_createC
https://yandex.ru/dev/metrika/ru/management/ Create chart annotation. Body: {"chart_annotation": {...}}
Inputs: body (required), counterId (required), pretty.
mgmt_chart_annotation_deleteC
https://yandex.ru/dev/metrika/ru/management/ Delete chart annotation
Inputs: id (required), counterId (required), pretty.
mgmt_chart_annotation_getC
https://yandex.ru/dev/metrika/ru/management/ Get chart annotation by ID
Inputs: id (required), counterId (required), pretty.
mgmt_chart_annotations_listC
https://yandex.ru/dev/metrika/ru/management/ List chart annotations
Inputs: counterId (required), pretty.
mgmt_chart_annotation_updateB
https://yandex.ru/dev/metrika/ru/management/ Update chart annotation. Body: {"chart_annotation": {...}}
Inputs: id (required), body (required), counterId (required), pretty.
mgmt_clients_listB
https://yandex.ru/dev/metrika/ru/management/ List available Direct clients
Inputs: pretty, counters.
mgmt_cloud_export_removeB
https://yandex.ru/dev/metrika/ru/management/ Disable cloud export on counter
Inputs: ceId (required), counterId (required), pretty.
mgmt_cloud_exports_listB
https://yandex.ru/dev/metrika/ru/management/ List Yandex Cloud export objects for counter
Inputs: counterId (required), pretty.
mgmt_counter_createB
https://yandex.ru/dev/metrika/ru/management/ Create counter. Body: {"counter": {"site": "example.com", "name": "..."}}
Inputs: body (required), ytm, field, pretty.
mgmt_counter_deleteC
https://yandex.ru/dev/metrika/ru/management/ Delete counter
Inputs: counterId (required), pretty.
mgmt_counter_getB
https://yandex.ru/dev/metrika/ru/management/ Get counter by ID
Inputs: counterId (required), field, pretty, callback.
mgmt_counter_label_setC
https://yandex.ru/dev/metrika/ru/management/ Attach counter to label
Inputs: labelId (required), counterId (required), pretty.
mgmt_counter_label_unsetC
https://yandex.ru/dev/metrika/ru/management/ Detach counter from label
Inputs: labelId (required), counterId (required), pretty.
mgmt_counters_listB
https://yandex.ru/dev/metrika/ru/management/ List available counters
Inputs: sort, type, field, offset, +11 more.
mgmt_counter_undeleteB
https://yandex.ru/dev/metrika/ru/management/ Restore deleted counter
Inputs: counterId (required), pretty.
mgmt_counter_updateC
https://yandex.ru/dev/metrika/ru/management/ Update counter. Body: {"counter": {...}}
Inputs: body (required), counterId (required), field, pretty.
mgmt_delegate_createB
https://yandex.ru/dev/metrika/ru/management/ Add delegate. Body: {"delegate": {"user_login": "..."}}
Inputs: body (required), pretty.
mgmt_delegate_deleteC
https://yandex.ru/dev/metrika/ru/management/ Remove delegate
Inputs: user_login (required), pretty.
mgmt_delegates_listB
https://yandex.ru/dev/metrika/ru/management/ List delegates
Inputs: pretty, callback.
mgmt_filter_createC
https://yandex.ru/dev/metrika/ru/management/ Create filter. Body: {"filter": {...}}
Inputs: body (required), counterId (required), pretty.
mgmt_filter_deleteC
https://yandex.ru/dev/metrika/ru/management/ Delete filter
Inputs: filterId (required), counterId (required), pretty.
mgmt_filter_getC
https://yandex.ru/dev/metrika/ru/management/ Get filter by ID
Inputs: filterId (required), counterId (required), pretty, callback.
mgmt_filters_listC
https://yandex.ru/dev/metrika/ru/management/ List counter filters
Inputs: counterId (required), pretty, callback.
mgmt_filter_updateC
https://yandex.ru/dev/metrika/ru/management/ Update filter. Body: {"filter": {...}}
Inputs: body (required), filterId (required), counterId (required), pretty.
mgmt_goal_createC
https://yandex.ru/dev/metrika/ru/management/ Create goal. Body: {"goal": {...}}
Inputs: body (required), counterId (required), pretty.
mgmt_goal_deleteC
https://yandex.ru/dev/metrika/ru/management/ Delete goal
Inputs: goalId (required), counterId (required), pretty.
mgmt_goal_getB
https://yandex.ru/dev/metrika/ru/management/ Get goal by ID
Inputs: goalId (required), counterId (required), pretty, callback.
mgmt_goals_listC
https://yandex.ru/dev/metrika/ru/management/ List counter goals
Inputs: counterId (required), pretty, callback, useDeleted.
mgmt_goal_updateC
https://yandex.ru/dev/metrika/ru/management/ Update goal. Body: {"goal": {...}}
Inputs: body (required), goalId (required), counterId (required), pretty.
mgmt_grant_createB
https://yandex.ru/dev/metrika/ru/management/ Create grant. Body: {"grant": {"user_login": "...", "perm": "view"}}
Inputs: body (required), counterId (required), pretty.
mgmt_grant_deleteD
https://yandex.ru/dev/metrika/ru/management/ Delete grant
Inputs: counterId (required), pretty, user_uid, user_login.
mgmt_grant_getC
https://yandex.ru/dev/metrika/ru/management/ Get grant for user
Inputs: counterId (required), user_login (required), pretty.
mgmt_grants_listC
https://yandex.ru/dev/metrika/ru/management/ List counter access grants
Inputs: counterId (required), pretty, callback.
mgmt_grant_updateB
https://yandex.ru/dev/metrika/ru/management/ Update grant. Body: {"grant": {...}}
Inputs: body (required), counterId (required), pretty.
mgmt_label_createB
https://yandex.ru/dev/metrika/ru/management/ Create label. Body: {"label": {"name": "..."}}
Inputs: body (required), pretty.
mgmt_label_deleteC
https://yandex.ru/dev/metrika/ru/management/ Delete label
Inputs: labelId (required), pretty.
mgmt_label_getC
https://yandex.ru/dev/metrika/ru/management/ Get label by ID
Inputs: labelId (required), pretty.
mgmt_labels_listC
https://yandex.ru/dev/metrika/ru/management/ List user labels
Inputs: pretty.
mgmt_label_updateB
https://yandex.ru/dev/metrika/ru/management/ Update label. Body: {"label": {"name": "..."}}
Inputs: body (required), labelId (required), pretty.
mgmt_messengers_listC
https://yandex.ru/dev/metrika/ru/management/ List messengers for messenger goal type
Inputs: pretty.
mgmt_my_grant_getC
https://yandex.ru/dev/metrika/ru/management/ Get current user grant for counter
Inputs: counterId (required), pretty.
mgmt_operation_createC
https://yandex.ru/dev/metrika/ru/management/ Create operation. Body: {"operation": {...}}
Inputs: body (required), counterId (required), pretty.
mgmt_operation_deleteC
https://yandex.ru/dev/metrika/ru/management/ Delete operation
Inputs: counterId (required), operationId (required), pretty.
mgmt_operation_getC
https://yandex.ru/dev/metrika/ru/management/ Get operation by ID
Inputs: counterId (required), operationId (required), pretty, callback.
mgmt_operations_listC
https://yandex.ru/dev/metrika/ru/management/ List counter operations
Inputs: counterId (required), pretty, callback.
mgmt_operation_updateB
https://yandex.ru/dev/metrika/ru/management/ Update operation. Body: {"operation": {...}}
Inputs: body (required), counterId (required), operationId (required), pretty.
mgmt_public_grant_createC
https://yandex.ru/dev/metrika/ru/management/ Create public grant (no body)
Inputs: counterId (required), pretty.
mgmt_public_grant_deleteC
https://yandex.ru/dev/metrika/ru/management/ Delete public grant
Inputs: counterId (required), pretty.
mgmt_segment_createC
https://yandex.ru/dev/metrika/ru/management/ Create segment. Body: {"segment": {...}}
Inputs: body (required), counterId (required), pretty.
mgmt_segment_deleteC
https://yandex.ru/dev/metrika/ru/management/ Delete segment
Inputs: counterId (required), segmentId (required), pretty.
mgmt_segment_getD
https://yandex.ru/dev/metrika/ru/management/ Get segment by ID
Inputs: counterId (required), segmentId (required), pretty.
mgmt_segments_listC
https://yandex.ru/dev/metrika/ru/management/ List counter segments
Inputs: counterId (required), pretty.
mgmt_segment_updateB
https://yandex.ru/dev/metrika/ru/management/ Update segment. Body: {"segment": {...}}
Inputs: body (required), counterId (required), segmentId (required), pretty.
mgmt_social_networks_listB
https://yandex.ru/dev/metrika/ru/management/ List social networks for social goal type
Inputs: pretty.
stat_bytimeB
Yandex Metrika Reports API. Docs: https://yandex.ru/dev/metrika/ru/stat/ Time series report — GET /stat/v1/data/bytime. Use for charts and trends.
Inputs: ids (required), metrics (required), lang, sort, +16 more.
stat_comparisonC
Yandex Metrika Reports API. Docs: https://yandex.ru/dev/metrika/ru/stat/ Segment comparison table — GET /stat/v1/data/comparison. Compare segments A and B with separate date ranges and filters.
Inputs: ids (required), metrics (required), lang, sort, +19 more.
stat_comparison_drilldownB
Yandex Metrika Reports API. Docs: https://yandex.ru/dev/metrika/ru/stat/ Segment comparison drill-down — GET /stat/v1/data/comparison/drilldown. Tree report comparing segments A and B.
Inputs: ids (required), metrics (required), lang, sort, +21 more.
stat_dataC
Yandex Metrika Reports API. Docs: https://yandex.ru/dev/metrika/ru/stat/ Table report — GET /stat/v1/data. Returns rows with dimensions and metrics.
Inputs: ids (required), metrics (required), lang, sort, +13 more.
stat_drilldownC
Yandex Metrika Reports API. Docs: https://yandex.ru/dev/metrika/ru/stat/ Drill-down tree report — GET /stat/v1/data/drilldown. One tree level per request; use parent_id for nested levels.
Inputs: ids (required), metrics (required), lang, sort, +15 more.
stat_pivotB
Yandex Metrika Reports API. Docs: https://yandex.ru/dev/metrika/ru/stat/ Pivot table — GET /stat/v1/data/pivot. Rows by dimensions, columns by pivot_dimensions.
Inputs: ids (required), metrics (required), lang, sort, +16 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 68 tools
The tools are mostly distinguishable by resource/action naming (counters, goals, filters, segments, etc.), and the stat_* report variants target distinct report types. However, with 68 tools, an agent may hesitate between similar pairs such as stat_data vs stat_bytime or filter vs access_filter, so it is not a perfect 5.
The mgmt_<resource>_<action> pattern is used consistently across the management tools, and stat_* prefixes all report endpoints. Minor deviations like mgmt_counter_undelete, mgmt_cloud_export_remove, mgmt_accounts_update, and stat_data (noun-only) keep it from being fully uniform.
68 tools is far beyond the recommended 3-15 range and will make tool selection difficult for an agent, even though the underlying Yandex Metrika API is broad. This is too many for a coherent MCP surface.
The set covers the six main report variants and provides full CRUD-style coverage for most management resources, including counters, goals, filters, operations, grants, segments, and annotations. Minor gaps exist (e.g., no create/update for public grants or cloud exports, and no Logs API tools), but the main workflows are supported.
Maintenance
Related MCP Connectors
Read-only Yandex Metrika MCP. Query visits, sources, geo, devices and more in plain language.
Analyze Yandex Metrica traffic and conversions in ChatGPT with read-only access.
Read and manage OnyxMetric web analytics: traffic, errors, funnels, goals, sites and segments.
MCP servers for Yandex APIs: Wordstat, Search, Webmaster, Metrika, Direct. Open source, by Seyka AI.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceA Model Context Protocol (MCP) server that provides access to Yandex Metrika analytics data through various tools and functions. This server allows AI assistants and applications to retrieve comprehensive analytics data from Yandex Metrika accounts.1-
- AlicenseAqualityBmaintenanceEnables managing Yandex Direct PPC campaigns, ad groups, ads, and keywords, plus pulling performance statistics via the Yandex Direct API v5.46920 npm4MIT
- AlicenseNot gradedqualityBmaintenanceEnables interaction with Yandex advertising and analytics APIs (Direct, Metrika, Audience, Webmaster, AdMetrica) through MCP tools, resources, and prompts for campaign management and data retrieval.MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to retrieve comprehensive analytics data from Yandex Metrika accounts, including traffic, content, e-commerce, and user demographics.128 npm1MIT