MCP Google Ads Server
# MCP Google Ads Server
[](LICENSE)
[](https://www.python.org)
[](https://modelcontextprotocol.io)
An MCP (Model Context Protocol) server that lets AI models query Google Ads data, manage keywords, adjust budgets, and audit accounts — directly from Claude, GPT, or any MCP-compatible client.
Ships with a **demo mode** that returns realistic mock data, so you can explore the full API without any Google Ads credentials.
## Architecture
```mermaid
graph LR
A[AI Client<br>Claude / GPT] -->|MCP Protocol| B[MCP Server]
B --> C{Mode?}
C -->|Demo| D[Mock Data<br>Realistic fixtures]
C -->|Live| E[Google Ads API<br>GAQL queries]
B --> F[Resources<br>accounts, doctrines, health]
B --> G[Tools<br>8 operations]
```
## Tools
| Tool | Description |
|------|-------------|
| `get_campaign_metrics` | Campaign performance: impressions, clicks, cost, conversions, CPA, ROAS |
| `get_search_terms` | Search term report with wasted spend detection |
| `get_keyword_metrics` | Keyword-level data with quality scores and bid info |
| `get_geo_performance` | Geographic breakdown by city/region |
| `add_negative_keyword` | Add negatives to campaigns or shared lists |
| `set_campaign_budget` | Adjust daily budgets |
| `adjust_keyword_bid` | Change CPC bids on individual keywords |
| `run_account_audit` | Comprehensive audit: wasted spend, low QS, high CPA, doctrine compliance |
## Resources
| URI | Description |
|-----|-------------|
| `ads://accounts` | List of managed accounts with IDs and labels |
| `ads://doctrines` | Operational rules engine (10 doctrines) |
| `ads://accounts/{id}/health` | Health score, alerts, and recommendations |
| `ads://status` | Server mode and connection info |
## Quick Start
### 1. Install
```bash
pip install -e .
```
### 2. Run in Demo Mode
```bash
mcp-google-ads
```
No configuration needed — demo mode is the default. The server returns realistic mock data modeled on home-service advertising (TV mounting, handyman services).
### 3. Connect to Claude Desktop
Add to your `claude_desktop_config.json`:
```json
{
"mcpServers": {
"google-ads": {
"command": "mcp-google-ads"
}
}
}
```
### 4. Connect to Claude Code
Add to your project's `.mcp.json`:
```json
{
"mcpServers": {
"google-ads": {
"type": "stdio",
"command": "mcp-google-ads"
}
}
}
```
## Live Mode
> **Note:** Live mode requires a [Google Ads API developer token](https://developers.google.com/google-ads/api/docs/get-started/dev-token) and OAuth2 credentials. Out of the box the server runs in demo mode — no credentials needed.
To query real Google Ads data, set credentials in `.env`:
```bash
cp .env.example .env
# Fill in your Google Ads API credentials
```
Then start with demo mode disabled:
```bash
MCP_DEMO_MODE=0 mcp-google-ads
```
Required credentials:
- `GOOGLE_ADS_DEVELOPER_TOKEN` — from your Google Ads API Center
- `GOOGLE_ADS_CLIENT_ID` / `CLIENT_SECRET` — OAuth2 app credentials
- `GOOGLE_ADS_REFRESH_TOKEN` — generated via OAuth2 flow
- `GOOGLE_ADS_LOGIN_CUSTOMER_ID` — your MCC account ID
- `GOOGLE_ADS_CUSTOMER_IDS` — comma-separated managed account IDs
## Example Session
```
You: What are my top campaigns by ROAS?
Claude: I'll check your campaign metrics.
> get_campaign_metrics(date_range="LAST_30_DAYS")
Here are your campaigns ranked by ROAS:
1. Brand - Exact Match — 11.5x ROAS, $1,247 spend, 48 conversions
2. Emergency - Phrase Match — 5.4x ROAS, $892 spend, 12 conversions
3. Local - City Targeting — 3.1x ROAS, $2,100 spend, 22 conversions
4. Services - Broad Modified — 2.7x ROAS, $3,456 spend, 31 conversions
5. Competitor Conquest — 0.3x ROAS, $1,890 spend, 2 conversions ⚠️
The Competitor Conquest campaign is bleeding money at $945/conversion.
I'd recommend pausing it or adding tighter negative keywords.
```
## Tests
```bash
pip install -e ".[dev]"
pytest -v
```
23 tests cover all 8 tools and 4 resources in demo mode, plus data integrity checks.
## Project Structure
```
src/mcp_google_ads/
├── __init__.py # Package metadata
├── server.py # MCP server — tools, resources, entry point
└── demo_data.py # Realistic mock data fixtures
tests/
└── test_demo_mode.py # 23 tests — tools, resources, data integrity
```
## Author
**Ruslan Danelian** — [ruslandanelian.com/premium/](https://ruslandanelian.com/premium/)
I build MCP servers, Google Ads API automation, and AI agent systems for production use. This project is a sanitized example of the tooling I operate daily across 8 live ad accounts.
## License
MIT — see [LICENSE](LICENSE).
TDQS
Scored across 8 tools
Each tool targets a distinct resource or dimension: campaign-level metrics, keyword-level metrics, search terms, and geo performance are clearly separated by resource granularity. The only mild overlap is run_account_audit, which is a superset of the individual reads, but its 'comprehensive audit' framing distinguishes it from the targeted get_* tools.
All eight tools follow a consistent snake_case verb_noun pattern (get_campaign_metrics, add_negative_keyword, set_campaign_budget, etc.). Verb choices (run/get/add/set/adjust) map sensibly to action types without breaking the pattern.
Eight tools is well-scoped for a Google Ads audit-and-optimize server, covering reads plus targeted writes without redundancy. Each tool earns its place with a distinct analytical or mutation role.
The core loop of audit → inspect metrics/search terms/geo → negate keywords, adjust budgets and bids is fully covered. Gaps exist for ad copy edits and campaign/ad group creation or pause/enable, which the audit references but cannot act on, though agents can work around these for the stated optimization purpose.