Skip to main content
Glama
Google Ads MCP Server

Google Ads MCP Server

Google Ads Model Context Protocol (MCP) Server

This is a Model Context Protocol (MCP) server that enables AI assistants (such as Gemini, ChatGPT, Claude, and Cursor) to manage, report, and analyze Google Ads campaigns securely.

It features an encrypted database storage for managing multiple client accounts, real-time Google Ads API integrations, and robust audit trail logging.


Features

  • Campaign Reporting: Query campaigns, budgets, keywords, search terms, ads, conversions, audience, and device performance metrics.

  • Campaign Mutations: Create campaigns, update budgets (with dry-run support), pause/resume campaigns, and add keywords or negative keywords.

  • Account Diagnostics: Automated account analysis to identify issues like budget constraints and list actionable optimization recommendations.

  • Cross-Client Performance Comparison: Compare metrics (Clicks, Cost, Conversions, CPA, ROAS) across all client accounts connected to the agency.

  • Encrypted Multi-Client Credentials: Securely store and encrypt OAuth refresh tokens in Supabase using AES-256-GCM.

  • Dual Transport Mode: Supports local command-line execution (stdio) and cloud-ready hosting (Streamable HTTP / SSE).

  • Comprehensive Audit Trails: Automatically logs every tool execution (reads and writes) to Supabase for enterprise compliance.


Related MCP server: Ads MCP

Setup & Local Development

1. Installation

Clone the repository and install dependencies:

npm install

2. Configure Environment Variables

Copy .env.example to a new file named .env and fill in your keys:

MOCK_MODE=false

# Supabase Configurations
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_KEY=your-supabase-service-role-key
ENCRYPTION_KEY=your-32-character-encryption-key-here

# Google Ads API Credentials (from Google Cloud Console & Ads Manager Account)
GOOGLE_CLIENT_ID=your-google-oauth-client-id
GOOGLE_CLIENT_SECRET=your-google-oauth-client-secret
GOOGLE_DEVELOPER_TOKEN=your-google-ads-developer-token

Note: Set MOCK_MODE=true to test the server with simulated in-memory data without requiring Google Ads API credentials.

3. Generate OAuth Refresh Token

To allow the server to access a client's Google Ads account, run the OAuth helper script:

npx tsx src/utils/authHelper.ts
  1. Click the generated link to open the browser.

  2. Sign in with the client's Google account and grant Google Ads permissions.

  3. The script will output a Refresh Token in your terminal.

4. Register a Client

Save and encrypt the client's details in your Supabase database:

npx tsx src/utils/registerClient.ts <google_customer_id> "<client_name>" "<refresh_token>"

Example:

npx tsx src/utils/registerClient.ts 181-756-0637 "nexusdatabase" "1//0gL0Srx..."

Running the Server

Stdio Mode (Default Local)

To run the server locally on your machine (for Cursor, Claude Desktop, or Gemini CLI):

# Build TypeScript
npm run build

# Start server
npm start

Remote / Cloud Mode (Streamable HTTP / SSE)

Whenever a PORT environment variable is defined, the server will automatically start as a web server listening on /mcp.

$env:PORT="8080"
npm start

The server will now be accessible at http://0.0.0.0:8080/mcp.


Testing

Run the automated mock test suite to verify that all reporting, mutation, diagnostics, and database functions are working correctly:

npm test

Cloud Deployment

You can host this server on any cloud platform supporting Node.js (e.g., Render, Railway, or Heroku).

  1. Connect this repository to your hosting provider.

  2. Configure the following deployment commands:

    • Build Command: npm install && npm run build

    • Start Command: npm start

  3. Add your environment variables (from .env) in your cloud provider's dashboard.

  4. Connect your AI client (like Cursor or ChatGPT) directly using the hosted URL (e.g. https://your-app-name.render.com/mcp).

Available Tools

17 tools
add_keywordsB

Add new keywords to a campaign (adds to first active Ad Group). Match types default to PHRASE.

Inputs: dry_run (required), keywords (required), campaign_id (required), google_customer_id (required).

add_negative_keywordsB

Add campaign-level negative keywords to exclude unwanted search queries.

Inputs: dry_run (required), keywords (required), campaign_id (required), google_customer_id (required).

analyze_accountA

Perform a comprehensive diagnostics analysis on a Google Ads account (identifying wasted spend, device split CPA gaps, keyword efficiency, and budget limits).

Inputs: google_customer_id (required).

compare_clients_performanceB

Compare performance across all client accounts connected to the agency (ranked by ROAS, CPA, and spend).

Inputs: agency_id.

create_campaignB

Create a new Google Ads search campaign. Creates in a paused state for safety.

Inputs: name (required), dry_run (required), budget_amount (required), google_customer_id (required), +3 more.

get_ads_reportC

Retrieve Responsive Search Ads Headlines, Descriptions, and performance metrics.

Inputs: google_customer_id (required), limit_days.

get_audience_reportC

Retrieve demographics and behavioral audience split performance metrics.

Inputs: google_customer_id (required), limit_days.

get_budget_reportB

Check daily budget health for campaigns, including spend today and remaining budget.

Inputs: google_customer_id (required).

get_campaign_reportB

Fetch performance metrics for campaigns (clicks, cost, conversions, CTR, CPA, status) over the last N days.

Inputs: google_customer_id (required), limit_days.

get_conversion_reportC

Get a breakdown of conversion actions, their counts, categories, and values.

Inputs: google_customer_id (required), limit_days.

get_device_reportA

Analyze performance split by device (Mobile, Desktop, Tablet) to spot CPC/CPA gaps.

Inputs: google_customer_id (required), limit_days.

get_keyword_reportB

Fetch performance metrics grouped by keyword (match type, clicks, cost, CTR, conversions) over the last N days.

Inputs: google_customer_id (required), limit_days.

get_optimization_recommendationsA

Generate a prioritized list of optimization actions (pausing keywords, adding negative keywords, adjusting budgets) with exact parameters for execution tools.

Inputs: google_customer_id (required).

get_search_terms_reportB

Fetch the actual search queries triggering ads along with clicks, cost, and conversion stats.

Inputs: google_customer_id (required), limit_days.

pause_campaignA

Pause a Google Ads campaign. Requires confirmation (dry_run=false).

Inputs: dry_run (required), campaign_id (required), google_customer_id (required).

resume_campaignA

Resume a paused Google Ads campaign. Requires confirmation (dry_run=false).

Inputs: dry_run (required), campaign_id (required), google_customer_id (required).

update_budgetA

Update the daily budget of a campaign. Requires explicit confirmation (dry_run=false).

Inputs: dry_run (required), campaign_id (required), budget_amount (required), google_customer_id (required).

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 17 tools

    Disambiguation4/5

    Each report tool is scoped to a distinct dimension (keyword, campaign, budget, search terms, conversion, ads, audience, device), so misselection risk is low. The only soft overlap is analyze_account vs get_optimization_recommendations, but the descriptions distinguish diagnostics from actionable recommendations.

    Naming Consistency5/5

    All names follow a clean snake_case verb_noun pattern: get_*_report for reads, add_*, pause_*, resume_*, update_*, create_* for writes. Report tools uniformly use the _report suffix, making read vs write intent instantly recognizable.

    Tool Count4/5

    17 tools is slightly on the heavy side but well justified for the breadth of a Google Ads surface (multiple report dimensions plus a safe write/optimization loop). No tool appears redundant or filler.

    Completeness3/5

    Read/analytics coverage is strong and the create/pause/budget/keyword write path exists, but there are dead ends: get_optimization_recommendations explicitly suggests pausing keywords and adjusting budgets, yet no pause_keyword or remove_keyword tool exists, and campaigns can be paused but not deleted or have settings edited. Ad group level reporting and negative keyword removal are also absent.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      F
      maintenance
      Enables managing Google Ads campaigns through an AI assistant with read-only reporting, recommendations, and gated write operations for bids, budgets, and statuses, all backed by preview and audit logging.
      31
      1
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI assistants to create, analyze, and optimize ad campaigns across Google Ads, Meta Ads, TikTok Ads, LinkedIn Ads, Amazon Ads, and ChatGPT Ads through natural language using 400+ tools.
      108
      MIT
    • A
      license
      Not graded
      quality
      F
      maintenance
      Enables AI to securely access and query Google Ads account data without Google Cloud setup, using GAQL.app as a backend.
      35 npm
      50
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Lets AI agents query Google Ads freely while routing every write through a passkey-approved, rule-checked, audited change workflow. It issues per-agent keys, validates proposals against configurable guardrails, and applies approved changes atomically.
      Apache 2.0