Bing Ads MCP Server
Production-grade MCP server for Microsoft Advertising (Bing Ads) API. Enables Claude to manage Bing/Microsoft Ads accounts with full campaign, ad group, keyword, and performance analysis capabilities.
README
Bing Ads MCP Server
Production-grade MCP server for Microsoft Advertising (Bing Ads) API. Enables Claude to manage Bing/Microsoft Ads accounts with full campaign, ad group, keyword, and performance analysis capabilities.
Features:
- 10 tools -- production-tested
- Campaign, ad group, and keyword management
- Keyword performance analysis with quality scores
- Search term reporting & bid automation
- Budget & bid strategy optimization
- Campaign-level budget updates
- Negative keyword management (shared + campaign-level)
Note: ⚠️ First open-source Bing Ads MCP with comprehensive tooling
- No serious alternatives exist in the ecosystem
- Battle-tested across multiple accounts
Installation
npm install mcp-bing-ads
Configuration
Security: Never share your .mcp.json file or commit it to git -- it may contain API credentials. Add .mcp.json to your .gitignore.
-
Get OAuth credentials:
- Go to Microsoft Azure Portal
- Create an Azure AD app registration
- Grant API permissions:
Microsoft Advertising API - Scopes:
https://ads.microsoft.com/msads.manage offline_access
-
Create
config.json:cp config.example.json config.json -
Fill in your credentials:
{ "oauth": { "client_id": "YOUR_AZURE_CLIENT_ID", "client_secret": "YOUR_AZURE_CLIENT_SECRET" }, "clients": { "default": { "customer_id": "YOUR_CUSTOMER_ID", "account_id": "YOUR_ACCOUNT_ID", "name": "My Account" } } } -
Set environment variables (recommended):
export BING_ADS_DEVELOPER_TOKEN="your_developer_token" export BING_ADS_CLIENT_ID="your_client_id" export BING_ADS_REFRESH_TOKEN="your_refresh_token" # Optional: export BING_ADS_CLIENT_SECRET="your_client_secret" # Optional: opt into mutating tools (read-only by default) export BING_ADS_MCP_WRITE="true"
Environment Variables
| Variable | Required | Default | Description |
|---|---|---|---|
BING_ADS_DEVELOPER_TOKEN |
yes | -- | Microsoft Advertising developer token |
BING_ADS_CLIENT_ID |
yes | -- | Azure AD app client ID |
BING_ADS_REFRESH_TOKEN |
yes | -- | OAuth refresh token |
BING_ADS_CLIENT_SECRET |
no | -- | Azure AD app client secret (if confidential client) |
BING_ADS_MCP_WRITE |
no | false |
Set to true, 1, or yes to expose mutating tools (pause/update/add). Any other value -- or unset -- keeps the server read-only. |
Read-only by default
Mutating tools (bing_ads_pause_keywords, bing_ads_update_campaign_budget, bing_ads_add_shared_negatives) are hidden from the tool list and refused at call time unless BING_ADS_MCP_WRITE=true is set in the server environment. This is a safety gate against casual write actions -- for example, pausing a keyword or editing a budget based on a throwaway chat message. To make write changes, set the env var explicitly in your .mcp.json or shell profile for the session that needs it, then unset it afterwards. Read tools (list/report/performance) are always available.
Usage
Start the server
npm start
Use with Claude Code
Add to ~/.claude.json:
{
"mcpServers": {
"bing-ads": {
"type": "http",
"url": "http://localhost:3002"
}
}
}
Claude Desktop: Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows).
Example API Calls
// Get client context
bing_ads_get_client_context({ working_directory: "/path/to/project" })
// List campaigns
bing_ads_list_campaigns()
// Get campaign performance
bing_ads_get_campaign_performance({
start_date: "2026-01-01",
end_date: "2026-03-01"
})
// Get keyword performance
bing_ads_keyword_performance({
start_date: "2026-02-01",
end_date: "2026-03-01"
})
// Create negative keywords
bing_ads_add_shared_negatives({
shared_list_id: "list_123",
keywords: [
{ text: "cheap", match_type: "Phrase" },
{ text: "discount", match_type: "Exact" }
]
})
API Reference
Context
bing_ads_get_client_context(working_directory)-- Detect account from working directory
Campaigns
bing_ads_list_campaigns()-- List all campaignsbing_ads_get_campaign_performance(start_date, end_date)-- Campaign metricsbing_ads_update_campaign_budget(campaign_id, daily_budget)-- Update daily spend
Ad Groups
bing_ads_list_ad_groups(campaign_id)-- List ad groups in campaign
Keywords
bing_ads_keyword_performance(start_date, end_date, [campaign_ids])-- Keyword metrics & QSbing_ads_search_term_report(start_date, end_date)-- Search terms that triggered adsbing_ads_pause_keywords(ad_group_id, keyword_ids)-- Pause keywords
Negative Keywords
bing_ads_list_shared_entities([type])-- List shared negative listsbing_ads_add_shared_negatives(list_id, keywords)-- Add to shared list
Performance Reports
- Campaign performance (ROI, conversions, CTR, CPC)
- Keyword performance (QS, expected CTR, ad relevance, landing page experience)
- Search term insights (which queries are converting)
Key Metrics & Definitions
Quality Score (QS): 1-10 rating of keyword quality
- 1-3: Poor
- 4-6: Average
- 7-10: Excellent
Expected CTR: 1-9 rating of expected click-through rate Ad Relevance: 1-9 rating of relevance to search query Landing Page Experience: 1-9 rating of landing page quality
CLI Tools
npm run dev # Run in dev mode (tsx)
npm run build # Compile TypeScript
npm test # Run contract tests
Architecture
Files:
src/index.ts— MCP server, OAuth flow, tool handlerssrc/tools.ts— Tool schema definitionssrc/errors.ts— Error handling & classificationconfig.json— Credentials & client mapping
Error Classification:
- Authentication errors (token expired)
- Rate limit errors (retry with backoff)
- Service errors (API temporarily unavailable)
- Validation errors (bad input)
Development
Adding a New Tool
- Define schema in
src/tools.ts - Add handler in
src/index.tstool dispatch - Add contract test in
.contract.test.ts - Test with
npm test
Testing
npm test -- --run # Single run
npm test -- --watch # Watch mode
Troubleshooting
Config file not found
cp config.example.json config.json
# Fill in your Azure credentials and Bing Ads IDs
Missing required credentials
Check that:
BING_ADS_DEVELOPER_TOKEN,BING_ADS_CLIENT_ID, andBING_ADS_REFRESH_TOKENare setBING_ADS_CLIENT_SECRETis set (if using a confidential app)- OAuth token is valid (expires, may need refresh)
Rate limit exceeded
Bing Ads applies rate limits. The server handles common retries automatically. If you hit limits frequently:
- Batch operations when possible
- Reduce query frequency
- Wait before retrying
Quality Score is 0
QS = 0 means keyword hasn't been shown enough times yet. Increase impressions or wait for more data.
License
MIT
Contributing
Contributions welcome! Please:
- Add tests for new features
- Update README
- Follow existing code style
- Tag releases
Support
- Issues: GitHub issues for bugs/feature requests
- Docs: See
docs/folder for detailed API reference - Community: GitHub Discussions
Built By
Mark Harnett — Demand generation leader and paid media practitioner building AI-powered ad management tools. This is the first comprehensive open-source Bing Ads MCP server — born from managing real campaigns across multiple accounts and wanting Claude to do the heavy lifting.
Built with production workloads in mind: resilient API calls (circuit breakers, retry with backoff, response truncation), full Quality Score diagnostics, and negative keyword management at scale.
Also by Mark: mcp-linkedin-ads -- LinkedIn Ads MCP server with 7 tools.
Last Updated: 2026-03-13
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。