yandex-metrica-mcp
MCP server for Yandex Metrica — query your web analytics in plain language from Claude, Cursor, and other AI agents. Secretless one-command login (PKCE), read-only, TypeScript.
README
yandex-metrica-mcp
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.
Demo
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:

Quickstart
1. Add the server to your MCP client (e.g. Claude Desktop) — no token required up front; you log in interactively in step 2:
{
"mcpServers": {
"yandex-metrica": {
"command": "npx",
"args": ["-y", "yandex-metrica-mcp"],
"env": { "YANDEX_METRIKA_COUNTER_ID": "12345678" }
}
}
}
2. Log in once — one command, no app registration, no secret stored:
npx yandex-metrica-mcp auth
Approve the Yandex consent page and paste the code back. 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.
Or install as a Claude Code plugin
The repo doubles as a plugin marketplace, so you can install the server through Claude Code's plugin system instead of the config above:
/plugin marketplace add BoxLab-Ltd/yandex-metrica-mcp
/plugin install yandex-metrica-mcp@boxlab
Then run npx yandex-metrica-mcp auth once to log in.
Why
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.
Features (v0.1)
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 available counters, goals, and common dimensions/metrics so the model queries with real field names.- Built-in context control: field selection on by default, low default row limits, and sampling/quota surfaced back to the model.
Planned for later: Logs API (raw row-level export → local SQL), Streamable HTTP transport, write tools (behind an explicit flag).
Requirements
- Node.js >= 18
- Yandex Metrica credentials with the
metrika:readscope (see Authentication). Whoever the credentials belong to must have access to the counters you query.
Authentication
Recommended: interactive login. No app registration needed — the server ships a built-in public OAuth client. Run once:
yandex-metrica-mcp auth # or, in dev: bun run auth
It opens a Yandex consent page; after you approve, Yandex shows a code that you
paste back into the terminal. 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.
Alternative: static token. 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.
Configuration
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.
Examples
Once connected, an agent can answer questions like:
- “How many visits and users did counter 12345678 get last week, split by traffic
source?” →
run_reportwithmetrics: ["ym:s:visits","ym:s:users"],dimensions: ["ym:s:lastsignTrafficSource"]. - “Compare this week's organic conversions to last week's.” →
run_comparison(server returns A, B, and the deltas). - “Which operating systems do my visitors use? Let me drill into Windows
versions.” →
run_drilldown, then again withparentId. - “What counters and goals can I query?” →
get_metadata.
Development
This project is Bun-first:
bun install
bun run dev # run from source with hot reload
bun run typecheck # tsc --noEmit
bun run lint # eslint
bun test # bun's test runner
bun run build # emit dist/ with tsc (Node-compatible)
License
MIT © boxlab
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。