How to Connect Meta and Google Ads with Claude AI

Reading Time: 7 minutes
X ()

What is MCP?

MCP (Model Context Protocol) is an open standard created by Anthropic that allows Claude to connect to external data sources and tools in real time. Think of it as a USB port – it lets Claude plug into your ad accounts, databases, spreadsheets, and APIs so it can read live data and provide instant, accurate insights without you manually copying and pasting anything.

Overview: The Free Architecture

There are two completely free paths to connect Claude to your Google Ads and Meta Ads data. This guide covers both in detail:

Prerequisites – Install These First (All Free)

1. Claude Desktop App

Download from: claude.ai/download – Available for Mac & Windows. Sign in with your free Anthropic account.

Important MCP connections only work in Claude Desktop (the downloadable app). They do NOT work in the Claude.ai browser version. Make sure you download the desktop app.

2. Node.js (Free Runtime)

Node.js is required to run MCP servers. Download the LTS version from nodejs.org.

# After installing Node.js, verify it works — open Terminal or Command Prompt:
node --version

# You should see something like: v20.11.0
npm --version# You should see something like: 10.2.4

3. Python 3 (Free – usually pre-installed)

Python is needed for the Meta Ads data sync script. Most computers already have it.

# Check if Python is installed:

python3 --version
# Should show: Python 3.x.x

# If not installed, download from: python.org/downloads

Google Sheets MCP (Recommended for Beginners)

This method syncs your Google Ads and Meta Ads data to a Google Sheet using free built-in tools, then connects Claude to that sheet via MCP. Once set up, Claude can read your live ad data any time you ask.

PART A1 – Sync Google Ads Data to Google Sheets (Free)

Google Ads has a built-in free feature called ‘Google Ads Scripts’ that can automatically export your campaign data to a Google Sheet on a schedule.

Create a new Google Sheet: Go to sheets.google.com → Click ‘+ New Spreadsheet’ → Name it ‘Claude Ad Data’

Open Google Ads Scripts: In Google Ads: click the wrench icon (Tools) → Bulk Actions → Scripts → Click the blue ‘+’ button

Paste the free sync script: Delete the default code and paste the script below

// Google Ads Script — Paste this in Google Ads Scripts editor (free):

// STEP 1: Replace this URL with YOUR Google Sheet URL
var SPREADSHEET_URL = "https://docs.google.com/spreadsheets/d/YOUR_SHEET_ID/edit";

function main() {
  var spreadsheet = SpreadsheetApp.openByUrl(SPREADSHEET_URL);
  var sheet = spreadsheet.getSheetByName('GoogleAds') ||
              spreadsheet.insertSheet('GoogleAds');
  sheet.clearContents();

  // Headers
  sheet.appendRow([
    'Date','Campaign','Status','Budget','Impressions',
    'Clicks','CTR','Avg CPC','Cost','Conversions','CPA','ROAS'
  ]);

  // Pull last 30 days of campaign data
  var report = AdsApp.report(
    'SELECT CampaignName, CampaignStatus, Amount, Impressions, ' +
    'Clicks, Ctr, AverageCpc, Cost, Conversions, CostPerConversion ' +
    'FROM CAMPAIGN_PERFORMANCE_REPORT ' +
    'DURING LAST_30_DAYS'
  );

  var rows = report.rows();
  while (rows.hasNext()) {
    var row = rows.next();
    var roas = row['Cost'] > 0
      ? (row['ConversionValue'] / row['Cost']).toFixed(2) : '0';
    sheet.appendRow([
      new Date().toLocaleDateString(),
      row['CampaignName'],
      row['CampaignStatus'],
      row['Amount'],
      row['Impressions'],
      row['Clicks'],
      row['Ctr'],
      row['AverageCpc'],
      row['Cost'],
      row['Conversions'],
      row['CostPerConversion'],
      roas
    ]);
  }
  Logger.log('Google Ads data synced to sheet successfully!');
}

Authorize and run the scriptClick ‘Authorize’ when prompted → Click the Run (▶) button → Check your Google Sheet – data should appear

Schedule automatic daily syncIn Scripts editor → Click the clock icon → Set frequency to ‘Daily’ at 7:00 AM → Save

Google Ads Sync CompleteYour Google Ads campaign data will now automatically sync to your Google Sheet every day at 7 AM — completely free.

PART A2 – Sync Meta Ads Data to Google Sheets (Free)

Meta does not have a built-in script tool like Google Ads, but you can use the free Meta Marketing API with a simple Python script to push data to your sheet.

Step 1: Get Your Free Meta API Credentials

  1. Go to developers.facebook.com and log in with your Facebook account
  2. Click ‘My Apps’ → ‘Create App’ → Choose ‘Business’ type
  3. Go to your App Dashboard → Settings → Basic
  4. Copy your App ID and App Secret (keep these safe)
  5. Go to Tools → Graph API Explorer → Generate a long-lived access token with these permissions: ads_read, ads_management, business_management
  6. Copy the Access Token — it’s valid for 60 days (you’ll refresh it periodically)
  7. Find your Ad Account ID: In Meta Ads Manager, look at the URL — it shows act_XXXXXXXXXX. Copy the number part.

Step 2: Install Required Free Python Libraries

# Run this in Terminal / Command Prompt:
pip install facebook-business google-auth google-auth-oauthlib
pip install google-api-python-client gspread

# Verify installation:
python3 -c "import facebook_business; print('Meta SDK ready')"
python3 -c "import gspread; print('Google Sheets SDK ready')"

Step 3: Create Google Sheets API

# Save this as meta_sync.py on your Desktop:
import json, gspread
from datetime import datetime, timedelta
from google.oauth2.service_account import Credentials
from facebook_business.api import FacebookAdsApi
from facebook_business.adobjects.adaccount import AdAccount

# CONFIG — Fill these in
ACCESS_TOKEN  = "YOUR_META_ACCESS_TOKEN"
AD_ACCOUNT_ID = "act_YOUR_AD_ACCOUNT_ID"
CREDENTIALS_FILE = "/Users/yourname/Desktop/google_credentials.json"
SPREADSHEET_NAME = "Claude Ad Data"

def sync_meta_to_sheets():
    # Connect to Meta API
    FacebookAdsApi.init(access_token=ACCESS_TOKEN)
    account = AdAccount(AD_ACCOUNT_ID)

    # Date range: last 30 days
    end   = datetime.now().strftime('%Y-%m-%d')
    start = (datetime.now()-timedelta(days=30)).strftime('%Y-%m-%d')

    # Pull campaign data
    campaigns = account.get_insights(
        params={
            'level': 'campaign',
            'time_range': {'since': start, 'until': end},
            'fields': [
                'campaign_name','reach','impressions','frequency',
                'clicks','ctr','cpm','cpc','spend',
                'actions','cost_per_action_type','purchase_roas'
            ]
        }
    )

    # Connect to Google Sheets
    scopes=['https://spreadsheets.google.com/feeds',
            'https://www.googleapis.com/auth/drive']
    creds  = Credentials.from_service_account_file(CREDENTIALS_FILE, scopes=scopes)
    client = gspread.authorize(creds)
    sh     = client.open(SPREADSHEET_NAME)

    # Write to 'MetaAds' tab
    try:
        ws = sh.worksheet('MetaAds')
        ws.clear()
    except:
        ws = sh.add_worksheet(title='MetaAds', rows=500, cols=20)

    # Headers
    ws.append_row(['Date','Campaign','Reach','Impressions','Frequency',
                  'Clicks','CTR','CPM','CPC','Spend','Conversions',
                  'CPA','ROAS'])

    # Data rows
    for c in campaigns:
        conversions = next(
            (a['value'] for a in c.get('actions',[]) if a['action_type']=='purchase'),'0')
        cpa = next(
            (a['value'] for a in c.get('cost_per_action_type',[]) if a['action_type']=='purchase'),'0')
        roas = c.get('purchase_roas',[{}])[0].get('value','0')
        ws.append_row([
            datetime.now().strftime('%Y-%m-%d'),
            c.get('campaign_name',''),
            c.get('reach','0'),
            c.get('impressions','0'),
            c.get('frequency','0'),
            c.get('clicks','0'),
            c.get('ctr','0'),
            c.get('cpm','0'),
            c.get('cpc','0'),
            c.get('spend','0'),
            conversions, cpa, roas
        ])

    print('Meta Ads data synced to Google Sheets!')

sync_meta_to_sheets()

Credentials (Free)

  1. Go to console.cloud.google.com
  2. Create a new project → Name it ‘Claude MCP’
  3. Go to APIs & Services → Enable APIs → Enable ‘Google Sheets API’ and ‘Google Drive API’
  4. Go to APIs & Services → Credentials → Create Credentials → Service Account
  5. Name it ‘claude-mcp’ → Click Done → Click on the service account → Keys tab → Add Key → JSON
  6. Download the JSON file → Save it as ‘google_credentials.json’ on your Desktop
  7. Open your Google Sheet → Share it with the service account email (found in the JSON file)

Step 4: Create the Free Meta → Google Sheets Sync Script

Step 5: Run the Sync Script

# Run this command in Terminal:
python3 ~/Desktop/meta_sync.py

# Expected output:
# Meta Ads data synced to Google Sheets!

# To auto-run daily on Mac (cron job):
crontab -e

# Add this line: (runs every day at 7:05 AM)
5 7 * * * python3 /Users/yourname/Desktop/meta_sync.py

# To auto-run daily on Windows (Task Scheduler):
# Search 'Task Scheduler' → Create Basic Task → Daily → 7:05 AM
# Program: python3   Arguments: C:\Users\yourname\Desktop\meta_sync.py

PART A3 – Install & Configure Google Sheets MCP Server

Now we connect Claude Desktop to the Google Sheet that contains your ad data.

Step 1: Install the MCP Server

# Run in Terminal / Command Prompt:
npm install -g @modelcontextprotocol/server-gdrive

# Verify installation:
npx @modelcontextprotocol/server-gdrive --version

Step 2: Create OAuth Credentials for MCP

  1. Go to console.cloud.google.com (same project you created earlier)
  2. APIs & Services → Credentials → Create Credentials → OAuth 2.0 Client ID
  3. Application type: Desktop App → Name it ‘Claude MCP Desktop’
  4. Click Create → Download the JSON file
  5. Rename it to ‘mcp_oauth_credentials.json’ → Save to your Desktop

Step 3: Configure Claude Desktop

Find and open the Claude Desktop configuration file:

# File location:
# Mac:     ~/Library/Application Support/Claude/claude_desktop_config.json
# Windows: C:\Users\YourName\AppData\Roaming\Claude\claude_desktop_config.json

# Open it with any text editor (VS Code, Notepad, TextEdit)

# If the file doesn't exist, create it at that path

Step 4: Add MCP Configuration

Replace the entire contents of claude_desktop_config.json with this (update the file path):

// claude_desktop_config.json — paste this entire block:
{
  "mcpServers": {
    "gdrive": {
      "command": "npx",
      "args": ["@modelcontextprotocol/server-gdrive"],
      "env": {
        "GDRIVE_OAUTH_CREDENTIALS": "/Users/yourname/Desktop/mcp_oauth_credentials.json"
        // Windows: "C:\\Users\\yourname\\Desktop\\mcp_oauth_credentials.json"
      }
    }
  }
}

Step 5: Authorize Google Access

  1. Save the config file and fully quit Claude Desktop (Cmd+Q on Mac / Alt+F4 on Windows)
  2. Reopen Claude Desktop
  3. You should see a small plug icon or ‘Tools’ indicator in the interface
  4. Type any message asking Claude to access Google Drive — a browser window will open
  5. Sign in with your Google account → Click Allow
  6. Return to Claude — the connection is now active

Complete!

Claude Desktop can now read your Google Sheet with live Google Ads and Meta Ads data. The data refreshes daily via the scripts you set up in Parts A1 and A2.

Conclusion

MCP (Model Context Protocol) makes it incredibly easy to connect Claude AI with your Google Ads and Meta Ads data – without any cost or complex infrastructure. By setting up either the Google Sheets method or the SQLite database approach, you eliminate manual reporting and give Claude direct access to your live marketing data.

The result is simple but powerful: faster insights, better decision-making, and a more efficient workflow. Instead of exporting data and building reports, you can just ask Claude questions and get instant, data-backed answers.

Optimize your meta and google ads with EasyInsights AI agents – Book a demo now