bing-ads-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., "@bing-ads-mcplist my campaigns"
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.
bing-ads-mcp
An MCP (Model Context Protocol) server that lets AI assistants manage your Microsoft Advertising (Bing Ads) campaigns. Built with Bun and the MCP TypeScript SDK.
Works with Claude Code, Claude Desktop, Cursor, and any MCP-compatible client.
Why
The Microsoft Advertising web interface is painful for bulk operations. This MCP server gives AI assistants direct access to your Bing Ads account through clean, typed tools -- so you can manage campaigns, ad groups, keywords, and extensions conversationally.
Related MCP server: Meta Ads MCP Server
Features
24 tools covering campaigns, ad groups, ads, keywords, negative keywords, and ad extensions
OAuth2 with auto-refresh -- built-in browser-based setup flow, tokens auto-refresh
Auto-discovers Customer ID -- no need to hunt for it in the UI
Streamable HTTP transport -- works as a remote MCP server
Zero config -- just add credentials and go
Quick Start
Prerequisites
Bun v1.0+
A Microsoft Advertising account
An Azure App Registration (setup guide below)
Install & Run
git clone https://github.com/user/bing-ads-mcp.git
cd bing-ads-mcp
bun installCreate a .env file with your credentials:
BING_CLIENT_ID=your-azure-app-client-id
BING_CLIENT_SECRET=your-azure-app-client-secret
BING_DEVELOPER_TOKEN=your-developer-token
BING_ACCOUNT_ID=your-account-idAuthenticate via OAuth (opens browser):
bun run setupStart the server:
bun run startThe MCP server runs at http://localhost:3100/mcp.
Connect to Your AI Client
Claude Code -- add to ~/.claude.json or project .mcp.json:
{
"mcpServers": {
"bing-ads": {
"url": "http://localhost:3100/mcp"
}
}
}Claude Desktop -- add to your MCP settings:
{
"mcpServers": {
"bing-ads": {
"url": "http://localhost:3100/mcp"
}
}
}Available Tools
Campaigns
Tool | Description |
| List all campaigns, optionally filter by type |
| Get detailed campaign info by IDs |
| Create campaigns with name, budget, type, status |
| Update campaign name, status, budget |
| Delete campaigns by ID |
Ad Groups
Tool | Description |
| List ad groups in a campaign |
| Create ad groups with CPC bid, network targeting |
| Update ad group name, status, bid |
| Delete ad groups by ID |
Ads
Tool | Description |
| List ads in an ad group |
| Create RSAs with headlines, descriptions, URLs |
| Update ad content, status, URLs |
| Delete ads by ID |
Keywords
Tool | Description |
| List keywords in an ad group |
| Add keywords with match type and bid |
| Update keyword text, bid, match type, status |
| Delete keywords by ID |
Negative Keywords
Tool | Description |
| List negatives for a campaign or ad group |
| Add negative keywords (Exact or Phrase match) |
| Delete negative keywords by ID |
Ad Extensions
Tool | Description |
| List extensions by type |
| Get extension details by IDs |
| Create sitelink extensions |
| Create callout extensions |
| Create structured snippets |
| Link extensions to campaigns or ad groups |
| Delete extensions by ID |
Setup Guide
You need 4 values for your .env file. Here's how to get each one step by step.
Step 1: Create an Azure App Registration (BING_CLIENT_ID + BING_CLIENT_SECRET)
This creates the OAuth app that lets the MCP server authenticate with Microsoft on your behalf.
Go to Azure Portal > App registrations
Sign in with the same Microsoft account you use for Microsoft Advertising
Click + New registration at the top
Fill in the form:
Name:
Bing Ads MCP(or anything you like)Supported account types: Select "Accounts in any organizational directory (Any Microsoft Entra ID tenant - Multitenant) and personal Microsoft accounts (e.g. Skype, Xbox)"
Redirect URI: Select Web from the dropdown, then enter:
http://localhost:3456/callback
Click Register
You'll land on the app's Overview page. Copy the Application (client) ID -- this is your
BING_CLIENT_IDIn the left sidebar, click Certificates & secrets
Click + New client secret
Description:
MCP server(or anything)Expires: Pick an expiry (e.g. 24 months)
Click Add
Copy the Value column immediately (it won't be shown again) -- this is your
BING_CLIENT_SECRET
Important: You do NOT need to add any API permissions in the Azure Portal. The
msads.managescope is requested automatically at runtime during the OAuth consent flow.
Step 2: Get Your Developer Token (BING_DEVELOPER_TOKEN)
The developer token authorizes your app to use the Bing Ads API.
Go to Microsoft Advertising and sign in
Navigate to Tools > Developer Portal (or go directly to developers.ads.microsoft.com)
If you don't have a developer token yet, request one -- for personal use it's typically approved instantly
Go to the Account tab
Copy your Developer Token -- this is your
BING_DEVELOPER_TOKEN
Note: For sandbox/testing, you can use the universal sandbox token
BBD37VB98.
Step 3: Get Your Account ID (BING_ACCOUNT_ID)
Go to Microsoft Advertising and sign in
Click Settings (gear icon) in the left sidebar
Click Account settings
Find Account ID (a numeric value like
138954571) -- this is yourBING_ACCOUNT_IDThis is NOT the "Account number" (which looks like
F107MTKS) -- you need the numeric ID
Step 4: Create Your .env File
Create a .env file in the project root with your 4 values:
BING_CLIENT_ID=your-client-id-from-step-1
BING_CLIENT_SECRET=your-client-secret-from-step-1
BING_DEVELOPER_TOKEN=your-developer-token-from-step-2
BING_ACCOUNT_ID=your-account-id-from-step-3You can leave BING_CUSTOMER_ID and BING_REFRESH_TOKEN empty -- both are filled automatically:
Customer ID is auto-discovered via the API on first request
Refresh Token is saved when you run
bun run setup
Step 5: Authenticate
Run the OAuth setup to get your refresh token:
bun run setupThis opens your browser to Microsoft's login page. Sign in, grant consent, and the refresh token is automatically saved to your .env file. You'll see "Setup complete!" in the terminal when done.
Step 6: Verify
Test that everything works:
bun run test-apiThis will authenticate, auto-discover your Customer ID, and list your campaigns. If you see your campaigns printed, you're all set.
Commands
Command | Description |
| Start the MCP server on port 3100 |
| Run OAuth flow (opens browser for consent) |
| Re-authenticate when token expires |
| Test API connectivity by listing campaigns |
| Open MCP Inspector for interactive testing |
Architecture
index.ts Entry point -- MCP server + Streamable HTTP via Bun.serve()
setup.ts OAuth setup CLI -- opens browser, saves tokens to .env
test-api.ts API connection test script
src/
auth.ts OAuth2 token management (auto-refresh, caching, persistence)
client.ts Bing Ads REST API client (auto-discovers Customer ID)
types.ts TypeScript types for API objects
tools/
campaigns.ts Campaign CRUD
adgroups.ts Ad Group CRUD
ads.ts Ad CRUD (Responsive Search Ads)
keywords.ts Keyword CRUD
negative-keywords.ts Negative keyword management
extensions.ts Ad extensions (sitelinks, callouts, snippets, associations)How It Works
Auth: OAuth2 authorization code flow with Microsoft identity platform. Refresh tokens are stored in
.envand auto-refreshed on expiry.API: Thin wrapper over the Bing Ads REST API v13 using native
fetch().Transport: Streamable HTTP transport via
Bun.serve()-- each MCP client session gets its own server instance with full state isolation.Customer ID: Automatically discovered via the
GetUserAPI on first request and cached to.env.
Troubleshooting
Problem | Solution |
"No refresh token available" | Run |
Token expired / 401 errors | Run |
Port 3100 in use |
|
Customer ID errors | Auto-discovered on first call. Check Microsoft Advertising Settings if issues persist |
API errors with TrackingId | Use the TrackingId when contacting Microsoft support |
Tech Stack
Bun -- runtime, HTTP server, env loading, file I/O
MCP TypeScript SDK -- Model Context Protocol server
Zod -- tool parameter validation
Microsoft Advertising REST API v13 -- campaign management
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.
Latest Blog Posts
- 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/xar/bing-ads-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server