Yandex Metrika MCP
Query and manage Yandex.Metrica data through 15 MCP tools for counters, goals, logs, reports, and traffic analysis.
Manage counters: list, get, create, update, delete.
Manage goals: list, create, delete (URL, number, step, action types).
Export raw visit/hit logs via Logs API.
Run flexible reports with custom metrics, dimensions, filters, and sorting.
Compare two date periods (A vs B).
Drill down hierarchically into report dimensions.
Get traffic summary (visits, pageviews, users, bounce rate, avg duration).
Get traffic sources breakdown by channel.
Get top pages by pageviews with performance metrics.
Authenticate with YANDEX_METRIKA_TOKEN OAuth Bearer token.
Run locally via stdio (Claude Desktop/Code) or remotely via Streamable HTTP.
Publishes the MCP server as the npm package @theyahia/yandex-metrika-mcp, allowing it to be installed and run via npx.
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 List all my counters"
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.
@theyahia/yandex-metrika-mcp
MCP server for Yandex.Metrica API — counters, goals, reports, logs, traffic sources, top pages. 15 tools, OAuth Bearer token auth.
Part of the Russian API MCP series by @theYahia.
Getting a Token
Go to oauth.yandex.ru
Create an app (or use an existing one)
Under Platforms, select "Web services"
Under Access, add:
Yandex.Metrica->Read statistics and counter parametersGet the OAuth token:
https://oauth.yandex.ru/authorize?response_type=token&client_id=YOUR_CLIENT_IDCopy the token from the redirect URL (
access_token=...)
Related MCP server: ya-metrics-mcp
Installation
Claude Desktop
Add to claude_desktop_config.json:
{
"mcpServers": {
"yandex-metrika": {
"command": "npx",
"args": ["-y", "@theyahia/yandex-metrika-mcp"],
"env": {
"YANDEX_METRIKA_TOKEN": "your_token"
}
}
}
}Claude Code
claude mcp add yandex-metrika -e YANDEX_METRIKA_TOKEN=your_token -- npx -y @theyahia/yandex-metrika-mcpStreamable HTTP (remote / multi-client)
YANDEX_METRIKA_TOKEN=your_token npx @theyahia/yandex-metrika-mcp --http --port=3000Endpoint: POST http://localhost:3000/mcp
Health check: GET http://localhost:3000/health
Smithery
Use smithery.yaml from the repository. Requires YANDEX_METRIKA_TOKEN.
Environment Variables
Variable | Required | Description |
| Yes | OAuth 2.0 Bearer token from Yandex OAuth |
Tools (15)
Management — Counters
Tool | Description |
| List all counters. Filter by name/URL with |
| Get full details of a single counter by ID. |
| Create a new counter for a website. |
| Update counter name or site URL. |
| Permanently delete a counter (irreversible). |
Management — Goals
Tool | Description |
| List all goals for a counter. |
| Create a goal (url, number, step, action types). |
| Delete a goal from a counter. |
Management — Logs
Tool | Description |
| Export raw visit/hit logs via the Logs API. |
Reporting API
Tool | Description |
| Flexible reporting — any metrics + dimensions + filters + sort. |
| Compare two date periods (A vs B). |
| Hierarchical drill-down into report dimensions. |
Convenience Wrappers
Tool | Description |
| Quick overview: visits, pageviews, users, bounce rate, avg duration. |
| Traffic sources breakdown by channel. |
| Top pages by pageviews with performance metrics. |
Demo Prompts
Show me all my Yandex.Metrica countersCompare last week's traffic to the previous week for counter 12345678What are the top 10 pages on my site this month, sorted by pageviews?Development
npm install
npm run build
npm test
npm run dev # stdio mode
npm run start:http # HTTP mode on port 3000API Reference
License
MIT
Available Tools
15 toolscreate_counterA
Create a new Yandex.Metrica counter for a website. Returns the new counter ID and tracking code. You need to install the tracking code on the site afterwards.
Inputs: name (required), site (required), mirrors.
create_goalB
Create a new conversion goal for a counter. Supports types: 'url' (page visit), 'number' (page count threshold), 'step' (multi-step funnel), 'action' (JavaScript event).
Inputs: name (required), type (required), counter_id (required), conditions.
delete_counterA
Permanently delete a Yandex.Metrica counter. This action is irreversible — all historical data for this counter will be lost.
Inputs: counter_id (required).
delete_goalA
Delete a conversion goal from a counter. Historical goal data in reports is preserved.
Inputs: goal_id (required), counter_id (required).
export_logsA
Export raw visit or hit logs via the Logs API. Creates a log request and evaluates feasibility. Use source='visits' for session data, source='hits' for pageview data.
Inputs: date1 (required), date2 (required), counter_id (required), fields, +1 more.
get_counterA
Get full details of a single Yandex.Metrica counter by ID, including configuration, code snippet status, and goals count.
Inputs: counter_id (required).
get_reportB
Flexible Yandex.Metrica reporting endpoint. Query any combination of metrics (ym:s:visits, ym:s:pageviews, ym:s:bounceRate, ym:s:avgVisitDurationSeconds, ym:s:users, ym:s:newUsers, etc.) with dimensions (ym:s:trafficSource, ym:s:searchEngine, ym:s:country, ym:s:browser, ym:s:deviceCategory, ym:s:date, etc.) over a date range. Supports filters and sorting.
Inputs: date1 (required), date2 (required), metrics (required), counter_id (required), +4 more.
get_report_comparisonA
Compare metrics between two date periods (A vs B). Useful for week-over-week, month-over-month, or campaign before/after analysis.
Inputs: date1_a (required), date1_b (required), date2_a (required), date2_b (required), +3 more.
get_report_drilldownA
Drill down into report data hierarchically. Start at top level, then pass parent_id to explore sub-dimensions (e.g., country -> city, traffic source -> campaign).
Inputs: date1 (required), date2 (required), metrics (required), counter_id (required), +2 more.
get_top_pagesA
Top pages by pageviews for a counter. Returns URL, visits, pageviews, bounce rate, and avg duration for each page. Useful for content performance analysis.
Inputs: date1 (required), date2 (required), counter_id (required), limit.
get_traffic_sourcesB
Traffic sources breakdown — visits and users by source channel (organic search, direct, social, referral, ad). Quick way to see where traffic comes from.
Inputs: date1 (required), date2 (required), counter_id (required).
get_traffic_summaryA
Quick traffic overview for a counter over a date range. Returns visits, pageviews, unique users, bounce rate, and average visit duration in one call.
Inputs: date1 (required), date2 (required), counter_id (required).
list_countersA
List all Yandex.Metrica counters available to the authenticated user. Returns counter ID, name, site URL, and status. Supports search filtering.
Inputs: field, per_page, search_string.
list_goalsA
List all goals configured for a Yandex.Metrica counter. Goals track conversions like page visits, button clicks, or multi-step funnels.
Inputs: counter_id (required).
update_counterA
Update an existing Yandex.Metrica counter — change its name or site URL.
Inputs: counter_id (required), name, site.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 15 tools
Counter and goal tools are clearly separated by resource and action, and the specialized reporting tools have distinct intents. However, get_report is a flexible catch-all that overlaps with get_traffic_summary, get_traffic_sources, get_top_pages, get_report_comparison, and get_report_drilldown, which could cause misselection.
Tool names consistently follow a verb_noun pattern: list_/create_/update_/delete_ for resource collections, and get_ for single entities or report views. The naming makes both resource type and action predictable across the whole toolset.
15 tools is at the upper end of the ideal range, but the count is justified by the breadth of Yandex Metrika functionality: counter CRUD, goal management, log export, and multiple reporting variations. The reporting shortcuts add some redundancy but still map to concrete user needs.
Counter lifecycle is fully covered with create/read/update/delete, and reporting has broad query options with comparison, drilldown, and traffic summaries. The main gap is the missing update_goal operation, and export_logs only initiates/evaluates a log request without covering the full retrieval flow.
Related MCP Connectors
Hosted MCP connector for Yandex Metrika and Webmaster. One endpoint, OAuth sign-in, zero setup.
- Yandex Tools MCPDeprecatedio.github.ruslan-mm18
MCP servers for Yandex APIs: Wordstat, Search, Webmaster, Metrika, Direct. Open source, by Seyka AI.
Read-only Yandex Metrika MCP. Query visits, sources, geo, devices and more in plain language.
Cookie-free web analytics MCP server: read stats, create UTM links, goals and ad costs.
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-
- AlicenseCqualityDmaintenanceMCP server for Yandex Metrika analytics, enabling AI assistants to access traffic, content, demographics, conversion, e-commerce, and drill-down reports.319 PyPI2MIT
- AlicenseAqualityCmaintenanceMCP server for interacting with Yandex.Webmaster API to manage sites, retrieve search queries, and check indexing status. Requires an OAuth token.1379 npm6MIT
- AlicenseNot gradedqualityDmaintenanceMCP server for Yandex Direct, Metrika, Wordstat, and Webmaster APIs, providing 132 tools to manage advertising campaigns, analytics, keyword research, and reporting through any MCP-compatible client.60MIT