yandex-mcp
Enables AI assistants to work with Yandex Webmaster, Direct, and Metrika data through natural language, including managing sites, sitemaps, recrawls, ad campaigns with write-safety guards, and pulling traffic, conversion, and ad statistics.
README
yandex-mcp
An MCP server that exposes the Yandex Webmaster, Yandex Direct and Yandex Metrika APIs as tools for AI assistants (Claude Desktop, Claude Code, Cursor, etc.).
It lets an assistant work with your Yandex SEO, advertising and analytics data in natural language — inspect search queries, manage indexing and sitemaps, request recrawls, run diagnostics, manage Direct campaigns with write-safety guards, and pull traffic/conversion/ad statistics — without you logging into the Yandex web UI.
- 125 tools total: 52 for Webmaster, 46 for Direct, 25 for Metrika, 2 for project management.
- 6 MCP prompts — ready-made workflows (campaign audit, weekly report, campaign launch, budget scaling, SEO audit, learning check) built on the autostrategies playbook, which is also exposed as the
yandex://playbookMCP resource. - Single server, multi-project: several Yandex accounts/tokens in one stdio process.
- TypeScript / Node ≥ 22, built on
@modelcontextprotocol/sdkandzod.
How it works
src/index.ts boots one McpServer and registers every tool group from src/webmaster/ and src/direct/. All requests go through src/client.ts, a per-project HTTP client that:
- attaches the
Authorization: OAuth <token>header (Bearerfor Direct), - routes Webmaster calls to
api.webmaster.yandex.netand Direct calls toapi.direct.yandex.com/json/v5(or the Direct Sandbox whendirect.sandboxis enabled), - resolves and caches the Webmaster
user_idand injectshost_idinto paths, - retries on network errors /
429with exponential backoff and handles204 No Content, - surfaces Direct in-body
{"error": {...}}responses and tracks theUnitsquota header.
Prerequisites
- Node.js ≥ 22.
- A Yandex OAuth token with access to the Webmaster and/or Metrika APIs.
Getting an OAuth token
- Register an application in the Yandex OAuth console and grant it the Webmaster (
webmaster:hostinfo,webmaster:verify) and/or Metrika (metrika:read/metrika:write) scopes. - Obtain a token for your account via the OAuth flow.
Notes:
- Direct requires its own application scope and an approved access request (заявка) submitted from the Direct account after registering the app — existing Webmaster/Metrika tokens will not work for Direct without re-issuing. Until access is approved, use the Direct Sandbox (
direct.sandbox: truein the project config). - Webmaster OAuth tokens expire after 6 months and must be re-issued.
Setup
npm install
cp .env.example .env # then put your token in .env
npm run build
.env:
YANDEX_OAUTH_TOKEN=your_oauth_token_here
Run
npm start # runs dist/index.js (requires build)
npm run dev # tsx watch mode against src/index.ts
The server speaks MCP over stdio, so it's normally launched by an MCP client rather than by hand.
Multi-project configuration
The server can serve several projects, each with its own Yandex login/token.
Copy projects.example.json to projects.json (gitignored) and fill it in, or
point YANDEX_PROJECTS_CONFIG at another path. If no config file exists but
YANDEX_OAUTH_TOKEN is set, a single project default is used.
Switch the active project with yandex_set_active_project, inspect with
yandex_projects_list, or pass project to any Direct or Metrika tool.
Metrika tools also honor the project's default_counter.
Per-project Direct settings: sandbox (route to the Direct Sandbox),
client_login (agency accounts), and limits — maximum allowed budget/bid
change in percent, enforced by the write tools.
Connecting to an MCP client
The token is read from the YANDEX_OAUTH_TOKEN environment variable.
Claude Desktop / Cursor
Add to the MCP servers config (claude_desktop_config.json or equivalent):
{
"mcpServers": {
"yandex": {
"command": "node",
"args": ["/absolute/path/to/yandex/dist/index.js"],
"env": {
"YANDEX_OAUTH_TOKEN": "your_oauth_token_here"
}
}
}
}
Claude Code
claude mcp add yandex --env YANDEX_OAUTH_TOKEN=your_token -- node /absolute/path/to/yandex/dist/index.js
Tools
Webmaster (52)
| Group | Tools |
|---|---|
| User | user_get |
| Hosts | hosts_list, hosts_get, hosts_add, hosts_delete |
| Verification | verification_start, verification_status, verification_owners |
| Summary | summary_get, summary_sqi_history |
| Search queries | search_queries_popular, search_queries_all_history, search_queries_history, query_analytics |
| Indexing | indexing_history, indexing_samples, indexing_archive_create, indexing_archive_status |
| URLs in search | search_urls_in_search_history, search_urls_in_search_samples, search_urls_events_history, search_urls_events_samples |
| Important URLs | important_urls_list, important_urls_history |
| Sitemaps | sitemaps_list, sitemaps_get, sitemaps_user_list, sitemaps_user_get, sitemaps_add, sitemaps_delete |
| Recrawl | recrawl_submit, recrawl_status, recrawl_list, recrawl_quota, recrawl_sitemap_quota, recrawl_sitemap_submit |
| Diagnostics | diagnostics_get |
| Links | links_external_samples, links_external_history, links_internal_samples, links_internal_history |
| Pro export | pro_regions, pro_limits, pro_dates, pro_export_start, pro_export_status |
| Feeds | feeds_add, feeds_add_status, feeds_batch_add, feeds_list, feeds_batch_delete, feeds_change_regions |
All names are prefixed yandex_webmaster_.
Direct (43)
| Group | Tools |
|---|---|
| Read | campaigns_get, adgroups_get, ads_get, keywords_get, bids_get, bidmodifiers_get, sitelinks_get, adextensions_get, adimages_get, retargetinglists_get, audiencetargets_get, feeds_get, creatives_get, smartadtargets_get, dynamictextadtargets_get, negativekeywordsharedsets_get, vcards_get, leads_get, turbopages_get, businesses_get, agencyclients_get, advideos_get, dictionaries_get (24h cache), clients_get, changes_check, units |
| Write (guarded) | campaigns_manage, adgroups_manage, ads_manage, keywords_manage, bids_set, bidmodifiers_manage, sitelinks_manage, adextensions_manage, adimages_manage, retargetinglists_manage, audiencetargets_manage, feeds_manage, smartadtargets_manage, dynamictextadtargets_manage, negativekeywordsharedsets_manage, vcards_manage, advideos_manage, clients_manage |
| Research | keywords_research |
| Reports | report |
All names are prefixed yandex_direct_. Write tools preview a diff unless
confirm: true, and enforce per-project budget/bid change limits (override with
force: true). Set direct.sandbox: true in the project to route calls to the
Direct Sandbox. Write results include a per-item summary — Direct reports
partial failures inside a successful HTTP response, so check partial_failure.
Project management (2)
yandex_projects_list, yandex_set_active_project — see
Multi-project configuration.
Metrika (22)
| Group | Tools |
|---|---|
| Management | counters_list, counter_get, goals_list, segments_list, filters_list |
| Goals (guarded write) | goal_add, goal_update, goal_delete |
| Offline conversions | offline_conversions_upload (guarded), offline_conversions_uploadings |
| Expenses import | expenses_upload (guarded; non-Yandex ad costs), expenses_uploadings |
| CRM import | crm_orders_upload (guarded; orders/revenue via CDP), calls_upload (guarded), calls_uploadings |
| Logs API (raw data) | logs_evaluate, logs_request_create, logs_requests, logs_download (truncated TSV), logs_clean |
| Reporting (Stat) | stat_data, stat_bytime, stat_drilldown, stat_comparison, stat_comparison_drilldown |
All names are prefixed yandex_metrika_. The stat tools accept direct_client_logins for advertising reports (ym:ad: metrics — Direct costs joined with on-site behavior) and extra_params for any other query parameter.
The reporting tools mirror the Metrika Reporting API. Metrics and dimensions use the ym:s: (visits) / ym:pv: (pageviews) namespaces — e.g. metrics: "ym:s:visits,ym:s:users,ym:s:bounceRate", dimensions: "ym:s:date,ym:s:lastTrafficSource". Dates accept YYYY-MM-DD or relative keywords (today, yesterday, 7daysAgo). Counter-scoped tools default to the project's default_counter when counter_id/ids is omitted.
Project layout
src/
index.ts # entry point: boots the MCP server, registers all tools
client.ts # per-project HTTP client (auth schemes, base URLs, retries, Direct transport)
projects.ts # project registry: per-project tokens, Direct config, limits
server-tools.ts # project management tools (list / set active)
webmaster/ # 14 modules, 51 Webmaster tools
metrika/ # management + Reporting API — 10 Metrika tools
direct/ # read, guarded write, reports — 14 Direct tools
Scripts
| Command | Description |
|---|---|
npm run build |
Compile TypeScript to dist/ |
npm run dev |
Run from source with tsx watch |
npm test |
Run the unit test suite (tsx --test) |
npm start |
Run the built server |
npm run clean |
Remove dist/ |
License
MIT © Minas Sarkisyan
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。