yandex-metrika-mcp
Click on "Install 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-mcpshow 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: Google Analytics MCP Server
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:
{
"mcpServers": {
"yandex-metrika": {
"command": "npx",
"args": ["-y", "@rezlazy/yandex-metrika-mcp"],
"env": {
"METRIKA_TOKEN": "<your-oauth-token>"
}
}
}
}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_tokenRunning the MCP server
The server uses stdio (stdin/stdout), not HTTP. You do not start it like a web server — your MCP client (e.g. Cursor) spawns it as a child process.
Requirements: Node.js 20+, METRIKA_TOKEN, and a built dist/index.js (for local dev).
In Cursor (recommended)
Configure MCP in
.cursor/mcp.jsonor Cursor MCP settings (see examples above).Settings → MCP → Refresh, or restart Cursor.
Cursor runs node dist/index.js (local) or npx @rezlazy/yandex-metrika-mcp (npm) automatically when tools are used. Check Output → MCP Logs if something fails.
From GitHub (without npm publish)
{
"mcpServers": {
"yandex-metrika": {
"command": "npx",
"args": ["-y", "github:Rezlazy/yandex-metrika-mcp"],
"env": {
"METRIKA_TOKEN": "<your-oauth-token>"
}
}
}
}For git installs, dist/ must exist in the repo or build on install (e.g. via a prepare script).
Manual run (debugging only)
npm run build
export METRIKA_TOKEN=your_oauth_token
node dist/index.jsThe process waits silently for JSON-RPC on stdin — that is expected. Without METRIKA_TOKEN, it exits with an error.
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.
Environment variables
Variable | Required | Description |
| yes | OAuth token ( |
| no | API base URL (default: |
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 buildPublishing to npm
Publishing is automated via GitHub Actions when a GitHub Release is published.
One-time setup:
Create npm organization/scope
@rezlazyon npmjs.com.Generate an npm Automation token.
Add
NPM_TOKENsecret to the GitHub repository.Create a release with tag
v0.1.0— the workflow publishes@rezlazy/yandex-metrika-mcp.
License
MIT
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
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
- AlicenseNot gradedqualityDmaintenanceEnables interaction with Google Analytics APIs to fetch reports, manage properties, data streams, conversion events, and custom dimensions/metrics through OAuth2 authentication.1606MIT
- AlicenseAqualityAmaintenanceEnables managing Yandex Direct PPC campaigns, ad groups, ads, and keywords, plus pulling performance statistics via the Yandex Direct API v5.445701MIT
- 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
Related MCP Connectors
Read-only Yandex Metrika MCP. Query visits, sources, geo, devices and more in plain language.
MCP for Yandex Direct: manage ad campaigns & analytics from Claude or ChatGPT
Read-only NuMetric.work accounting & ERP data: statements, KPIs, reports, invoices, documents.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Rezlazy/yandex-metrika-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server