Skip to main content
Glama
Google Ads MCP

Google Ads MCP

by gabogabucho

google-ads-mcp

Servidor MCP (Model Context Protocol) para gestionar Google Ads y Google Analytics 4 directamente desde Claude Code y Claude Desktop.

Escrito por Gabriel Urrutia. Inspirado en AdLoop por kLOsk — reimplementación independiente optimizada para Claude con soporte nativo en Windows, macOS y Linux.


¿Qué hace?

  • Analizar rendimiento de campañas, anuncios y keywords

  • Consultar términos de búsqueda y proponer negativos

  • Pausar / activar campañas, grupos y anuncios

  • Crear anuncios de búsqueda responsivos (RSA)

  • Agregar negative keywords

  • Ejecutar queries GAQL personalizadas

  • Consultar reportes y usuarios en tiempo real de GA4

Todo con un sistema de seguridad preview → confirm: ningún cambio se aplica sin aprobación explícita.


Related MCP server: Google Ads MCP

Requisitos

  • Python 3.11+

  • uv (gestor de paquetes)

  • Cuenta de Google Ads con acceso a la API

  • Google Cloud Project con las APIs habilitadas


Instalación

Windows (PowerShell)

git clone https://github.com/gabogabucho/google-ads-mcp.git
cd google-ads-mcp
powershell -ExecutionPolicy Bypass -File install.ps1

macOS / Linux (bash)

git clone https://github.com/gabogabucho/google-ads-mcp.git
cd google-ads-mcp
bash install.sh

Los instaladores:

  1. Verifican Python, uv y git

  2. Crean el virtualenv e instalan dependencias

  3. Crean ~/.google-ads-mcp/config.yaml desde el ejemplo

  4. Copian las Skills a ~/.claude/skills/

  5. Muestran el snippet exacto para configurar Claude Desktop


Configuración de Google

1. Google Cloud Project

  1. Ve a console.cloud.google.com → crea un proyecto

  2. Habilita estas APIs:

    • Google Ads API

    • Google Analytics Data API

    • Google Analytics Admin API

2. Credenciales OAuth 2.0

  1. APIs & Services → Credentials → Create → OAuth 2.0 Client ID

  2. Application type: Desktop app

  3. Descarga el JSON → guárdalo como ~/.google-ads-mcp/credentials.json

3. Developer Token de Google Ads

  • En Google Ads: herramienta (llave inglesa) → API Center → copia el token

  • El token de nivel TEST solo funciona con cuentas de prueba

4. Editar config.yaml

# macOS/Linux
$EDITOR ~/.google-ads-mcp/config.yaml

# Windows
notepad %USERPROFILE%\.google-ads-mcp\config.yaml

Ver config/config.yaml.example para todos los campos.

5. Primera autenticación

El primer python -m google_ads_mcp abre el navegador para autenticar con Google. El token se guarda en ~/.google-ads-mcp/token.json y se renueva automáticamente.


Configurar en Claude Desktop

Edita claude_desktop_config.json:

  • Windows: %APPDATA%\Claude\claude_desktop_config.json

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

  • Linux: ~/.config/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "google-ads": {
      "command": "RUTA_AL_PYTHON_DEL_VENV",
      "args": ["-m", "google_ads_mcp"],
      "env": {
        "GOOGLE_ADS_MCP_CONFIG": "RUTA_A_CONFIG_YAML"
      }
    }
  }
}

El instalador muestra las rutas exactas para tu sistema al terminar.


Configurar en Claude Code

# Añadir globalmente
claude mcp add google-ads \
  --env GOOGLE_ADS_MCP_CONFIG=$HOME/.google-ads-mcp/config.yaml \
  -- python -m google_ads_mcp

O crea .mcp.json en la raíz del proyecto (ver config/mcp.json.example).


Skills disponibles

Después de instalar, usa estos comandos en Claude Code:

Comando

Descripción

/google-ads-setup

Diagnóstico de configuración y guía de setup

/google-ads-analyze

Analizar campañas, keywords y search terms

/google-ads-manage

Gestionar campañas con safety checks

/google-ads-ga4

Reportes y tiempo real de GA4


Herramientas MCP

Lectura — Google Ads

Tool

Descripción

list_google_ads_accounts

Todas las cuentas accesibles

get_campaign_performance

Métricas de campañas

get_ad_performance

Métricas de anuncios

get_keyword_performance

Keywords con Quality Score

get_search_terms

Términos de búsqueda reales

run_gaql_query

Query GAQL personalizada

Lectura — GA4

Tool

Descripción

list_ga4_properties

Cuentas y propiedades GA4

run_ga4_report

Reporte personalizado

get_realtime_users

Usuarios activos ahora

get_ga4_events

Eventos configurados (30 días)

Escritura (preview → confirm)

Tool

Descripción

preview_campaign_status_change

Vista previa: pausar/activar/eliminar campaña

preview_add_negative_keywords

Vista previa: agregar negative keywords

preview_responsive_search_ad

Vista previa: crear anuncio RSA

apply_change

Aplicar cambio por plan_id (dry_run=True por defecto)


Sistema de seguridad

Usuario pide cambio
    ↓
preview_*()  →  valida límites, genera plan con ID corto
    ↓
Claude muestra preview, pide confirmación
    ↓
apply_change(plan_id, dry_run=True)   ← simulación primero
    ↓
apply_change(plan_id, dry_run=False)  ← solo con OK explícito del usuario

Protecciones activas:

  • Cap de presupuesto diario máximo (configurable)

  • Límite de % de aumento de bids

  • Operaciones bloqueadas por lista

  • Log de auditoría en ~/.google-ads-mcp/audit.log

  • RSAs nuevos creados en estado PAUSED


Estructura del proyecto

google-ads-mcp/
├── src/google_ads_mcp/
│   ├── server.py       # FastMCP: definición de todas las tools
│   ├── ads.py          # Google Ads API (lectura y escritura)
│   ├── ga4.py          # Google Analytics 4 API (solo lectura)
│   ├── auth.py         # OAuth 2.0 con token caching
│   ├── config.py       # Carga de config.yaml
│   └── safety.py       # Guards, plan store, audit log
├── skills/
│   ├── google-ads-analyze/SKILL.md
│   ├── google-ads-manage/SKILL.md
│   ├── google-ads-ga4/SKILL.md
│   └── google-ads-setup/SKILL.md
├── config/
│   ├── config.yaml.example
│   ├── claude-desktop-config.json.example
│   └── mcp.json.example
├── docs/troubleshooting.md
├── install.sh          # macOS / Linux
├── install.ps1         # Windows PowerShell
├── pyproject.toml
└── LICENSE             # MIT

Créditos

MIT License — ver LICENSE.

Available Tools

14 tools
apply_changeApply Change

Execute a previously previewed change.

ALWAYS show the preview to the user and get explicit confirmation before calling this with dry_run=False. When dry_run=True (default), it simulates the change without modifying Google Ads.

Inputs: plan_id (required), dry_run. Returns: result

get_ad_performanceGet Ad Performance

Get performance metrics at the individual ad level for a Google Ads account.

Useful for identifying underperforming ads, comparing creative variations, and finding ads to pause or improve.

Inputs: end_date (required), start_date (required), customer_id (required). Returns: result

get_campaign_performanceGet Campaign Performance

Get performance metrics for all campaigns in a Google Ads account.

Returns impressions, clicks, cost (USD), conversions, CTR, and average CPC. Results are sorted by spend (highest first), limited to 100 campaigns.

Inputs: end_date (required), start_date (required), customer_id (required). Returns: result

get_ga4_eventsGet Ga4 Events

List all GA4 event names and their 30-day count.

Use this to verify that conversion events are firing, check which events are tracked, and cross-reference with Google Ads conversion actions.

Inputs: property_id (required). Returns: result

get_keyword_performanceGet Keyword Performance

Get performance metrics for all keywords in a Google Ads account.

Returns keyword text, match type, Quality Score, bid, clicks, cost, and conversions. Useful for identifying low-QS keywords, high-spend with no conversions, and keywords that are candidates for negative keyword lists.

Inputs: end_date (required), start_date (required), customer_id (required). Returns: result

get_realtime_usersGet Realtime Users

Get real-time active user count from Google Analytics 4.

Useful for verifying that a newly activated campaign is generating traffic, or monitoring live user activity.

Inputs: property_id (required), dimensions. Returns: result

get_search_termsGet Search Terms

Get actual search terms that triggered ads in a Google Ads account.

Essential for finding negative keyword opportunities and understanding real user intent. Returns the top terms by spend.

Inputs: end_date (required), start_date (required), customer_id (required), limit. Returns: result

list_ga4_propertiesList Ga4 Properties

List all Google Analytics 4 accounts and properties accessible with current credentials.

Use this when the user hasn't provided a GA4 property_id, or to discover which properties are available.

Inputs: no named parameters. Returns: result

list_google_ads_accountsList Google Ads Accounts

List all Google Ads accounts accessible with the current credentials.

Use this first when the user hasn't specified a customer_id, or to discover which accounts are available.

Inputs: no named parameters. Returns: result

preview_add_negative_keywordsPreview Add Negative Keywords

Preview adding negative keywords to a campaign or ad group.

ALWAYS call this before apply_change. Either campaign_id or ad_group_id is required.

Inputs: keywords (required), customer_id (required), match_type, ad_group_id, +1 more. Returns: result

preview_campaign_status_changePreview Campaign Status Change

Preview pausing, enabling, or removing a campaign. Returns a plan_id to use with apply_change.

ALWAYS call this before apply_change. Show the preview to the user and ask for explicit confirmation before proceeding.

Inputs: action (required), campaign_id (required), customer_id (required). Returns: result

preview_responsive_search_adPreview Responsive Search Ad

Preview creating a Responsive Search Ad. Returns a plan_id to use with apply_change.

Validates headline/description counts and character limits before previewing. New ads are always created in PAUSED status.

Inputs: final_url (required), headlines (required), ad_group_id (required), customer_id (required), +3 more. Returns: result

run_ga4_reportRun Ga4 Report

Run a custom Google Analytics 4 report.

Common dimensions: sessionDefaultChannelGroup, deviceCategory, country, city, landingPage, sessionCampaignName, sessionGoogleAdsKeyword, pagePath, date

Common metrics: sessions, totalUsers, newUsers, bounceRate, conversions, totalRevenue, engagementRate, screenPageViews, averageSessionDuration

Date range examples: "30daysAgo", "7daysAgo", "today", "yesterday", "2024-01-01"

Inputs: metrics (required), end_date (required), dimensions (required), start_date (required), +2 more. Returns: result

run_gaql_queryRun Gaql Query

Execute a custom Google Ads Query Language (GAQL) query.

Use this for advanced analysis not covered by the other tools. GAQL syntax: SELECT fields FROM resource WHERE conditions ORDER BY ... LIMIT n

Common resources: campaign, ad_group, keyword_view, search_term_view, ad_group_ad, campaign_criterion, ad_group_criterion

Inputs: query (required), customer_id (required). Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables natural language access to Google Ads campaigns, accounts, and performance metrics via Claude, with tools for managing ad groups, keywords, budgets, and visualizing data.
      1
      -
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables natural-language analysis and management of Google Ads accounts, campaigns, keywords, budgets, and performance metrics through Claude.
      MIT
    • A
      license
      B
      quality
      C
      maintenance
      Enables Claude and other MCP-capable assistants to monitor and manage Google Ads accounts by pulling performance reports, running GAQL queries, adjusting budgets, pausing or enabling campaigns, adding keywords and negative keywords, and creating campaigns and ads, with preview and read-only safety controls.
      31
      Apache 2.0
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables Claude and other models to read a Google Ads account and safely create, edit, pause, and budget campaigns, ad groups, ads, keywords, and bids. Every write is previewed through Google's validateOnly, approved by a person, and protected by server-side spending limits and an audit log.
      MIT