MCP server for managing Yandex Direct ad campaigns via AI assistants (Claude Code, Claude Desktop, ChatGPT, etc.).
Pure Ruby, no external dependencies. 30 tools for a complete advertising workflow: creating campaigns, writing ads, selecting keywords, analytics.
| Service | Tools | Description |
|---|---|---|
| Campaigns | 6 | Create, edit, suspend, resume, delete campaigns |
| Ad Groups | 4 | Ad groups with geo-targeting and negative keywords |
| Ads | 7 | Text & image ads, moderation |
| Keywords | 6 | Keywords, bids, suspend/resume |
| Reports | 3 | Reports on campaigns, ads, search queries |
| Dictionaries | 4 | Dictionaries for regions, currencies, audience interests |
- Go to oauth.yandex.ru and create a new application
- Platform type: Web services
- Redirect URI:
https://oauth.yandex.ru/verification_code - Permissions: Yandex.Direct — Use Yandex.Direct API
After creating the OAuth application, you need to submit a request for full access to the Yandex Direct API:
- Sign in to Yandex Direct
- Go to Tools → API (or use the direct link:
https://direct.yandex.ru/registered/main.pl?cmd=apiSettings) - Open the "My requests" tab → "New request"
- Fill out the form:
- Application: select your OAuth application from the list
- Contact: your email
- Type of work: "Direct advertiser automating management of own campaigns"
- Programming language: Ruby
- Protocol: JSON
- Logins: your Yandex Direct login
- Submit the request — the API starts working immediately after submission (status "new")
Without this step, the API will return an "Incomplete registration" error (code 58).
Open the following URL in your browser (replace with your Client ID):
https://oauth.yandex.ru/authorize?response_type=token&client_id=YOUR_CLIENT_ID
Sign in and copy the token from the address bar.
Add the following to your project's .mcp.json:
{
"mcpServers": {
"yandex-direct": {
"command": "ruby",
"args": ["/path/to/yandex-direct-mcp/bin/server"],
"env": {
"YANDEX_DIRECT_TOKEN": "your_oauth_token"
}
}
}
}Or add it to the global config ~/.claude.json (under the mcpServers section) to make the server available across all projects.
For Claude Desktop — add the same configuration to ~/Library/Application Support/Claude/claude_desktop_config.json.
Once connected, the AI assistant will have access to all 30 tools and will be able to manage your campaigns via chat:
- "Show my campaigns"
- "Create a campaign to promote a book with a budget of 500 RUB/day"
- "Add keywords: read online, new books 2026"
- "Show statistics for the last week"
- "What search queries are bringing customers?"
- "Pause the campaign"
- "Update the ad text"
Note: The budget currency is determined by the Yandex Direct account (rubles, tenge, etc.). The
daily_budgetparameter specifies the amount in the account's primary currency.
- SMB campaigns (created via the simplified Yandex Direct wizard) are not visible through the API — only TEXT_CAMPAIGN type campaigns
- Callouts can be created via the API, but can only be linked to an ad through the web interface
- Images can only be uploaded via URL or base64 — local files must first be hosted or encoded
- Yandex requires a landscape image (minimum 1080x607) for text & image ads
For testing without real expenses, add the YANDEX_DIRECT_SANDBOX environment variable:
{
"mcpServers": {
"yandex-direct": {
"command": "ruby",
"args": ["/path/to/yandex-direct-mcp/bin/server"],
"env": {
"YANDEX_DIRECT_TOKEN": "your_token",
"YANDEX_DIRECT_SANDBOX": "true"
}
}
}
}Sandbox uses the Yandex Direct test API — all operations are performed on fictitious data.
| Tool | Description |
|---|---|
yandex_direct_campaigns_get |
Get a list of campaigns with filtering by ID, state, type |
yandex_direct_campaigns_add |
Create a campaign with name, start date, budget, negative keywords |
yandex_direct_campaigns_update |
Update campaign parameters |
yandex_direct_campaigns_delete |
Delete (archive) campaigns |
yandex_direct_campaigns_suspend |
Suspend impressions |
yandex_direct_campaigns_resume |
Resume impressions |
| Tool | Description |
|---|---|
yandex_direct_adgroups_get |
Get groups by campaign ID or group ID |
yandex_direct_adgroups_add |
Create a group with name, regions, and negative keywords |
yandex_direct_adgroups_update |
Update a group |
yandex_direct_adgroups_delete |
Delete groups |
| Tool | Description |
|---|---|
yandex_direct_ads_get |
Get ads with filtering |
yandex_direct_ads_add |
Create a text & image ad (title, text, link) |
yandex_direct_ads_update |
Update an ad |
yandex_direct_ads_delete |
Delete ads |
yandex_direct_ads_suspend |
Suspend ad impressions |
yandex_direct_ads_resume |
Resume impressions |
yandex_direct_ads_moderate |
Submit for moderation |
| Tool | Description |
|---|---|
yandex_direct_keywords_get |
Get keywords by campaign or group |
yandex_direct_keywords_add |
Add keywords to ad groups |
yandex_direct_keywords_update |
Update keyword text |
yandex_direct_keywords_delete |
Delete keywords |
yandex_direct_keywords_suspend |
Suspend impressions for keywords |
yandex_direct_keywords_resume |
Resume impressions |
| Tool | Description |
|---|---|
yandex_direct_report_campaign |
Campaign statistics: impressions, clicks, cost, CTR, CPC |
yandex_direct_report_ad |
Statistics by ad |
yandex_direct_report_search_queries |
User search queries (for finding negative keywords) |
| Tool | Description |
|---|---|
yandex_direct_dictionaries_regions |
Regions for geo-targeting (ID, name, type) |
yandex_direct_dictionaries_currencies |
Currencies and bid limits |
yandex_direct_dictionaries_interests |
Audience interests for targeting |
yandex_direct_dictionaries_all |
All dictionaries at once |
yandex-direct-mcp/
├── bin/server # MCP server entry point
├── lib/
│ ├── yandex_direct_mcp.rb # Module loader
│ └── yandex_direct_mcp/
│ ├── client.rb # HTTP client for Yandex Direct API v5
│ ├── server.rb # MCP JSON-RPC protocol (stdio)
│ ├── tool_registry.rb # Tool registry
│ └── tools/
│ ├── campaigns.rb # Campaign management
│ ├── ad_groups.rb # Ad groups
│ ├── ads.rb # Ads
│ ├── keywords.rb # Keywords
│ ├── reports.rb # Analytics and reports
│ └── dictionaries.rb # Dictionaries
├── Gemfile
├── LICENSE
└── .gitignore
- Ruby >= 3.1
- Yandex Direct API OAuth token (free)
MIT