Create custom MCP server for Google Ads - without code
Hoshang Mehta
Create custom MCP server for Google Ads - without code
Google Ads is where your advertising budget goes. It holds your campaign performance, keyword data, ad spend, and conversion metrics. But when you want to build an AI agent that can answer "What's our ROAS for the 'Product Launch' campaign?" or "Which keywords are burning budget without conversions?", you face complexity.
The Google Ads API is powerful but notoriously difficult. You need to handle OAuth, understand the query language (GAQL), and navigate deeply nested reports. Building a custom backend just to expose ad performance data to your agent is overkill.
Pylar makes it simple.
Pylar syncs your Google Ads data to a SQL-queryable warehouse and lets you build MCP (Model Context Protocol) tools with natural language prompts—no code, no GAQL.
Why Pylar for Google Ads?
- SQL Over GAQL: Query your ad data with standard SQL instead of learning Google's proprietary query language.
- Unified Marketing View: Join Google Ads spend with GA4 conversions or Stripe revenue to calculate true ROI.
- No API Limits: Query your synced data as much as you want without hitting Google's API quotas.
Step-by-Step Walkthrough
Step 1: Connect Google Ads to Pylar
- In Pylar, go to Connections -> Google Ads.
- Authenticate via OAuth (Google login) and select your Google Ads account.
- Pylar will begin syncing your Google Ads data (campaigns, ad groups, keywords, performance metrics, etc.).

You'll receive an email when the sync completes.
Step 2: Create a Sandboxed View
Let's say you want an agent to help your marketing team identify underperforming campaigns.
In Pylar's SQL IDE, create a view:
-- view: campaign_performance
SELECT
c.campaign_name,
c.campaign_status,
SUM(s.cost_micros) / 1000000 as total_spend_usd,
SUM(s.impressions) as total_impressions,
SUM(s.clicks) as total_clicks,
SUM(s.conversions) as total_conversions,
(SUM(s.clicks)::FLOAT / NULLIF(SUM(s.impressions), 0)) * 100 as ctr_percent,
(SUM(s.cost_micros) / 1000000) / NULLIF(SUM(s.conversions), 0) as cost_per_conversion
FROM google_ads.campaigns c
JOIN google_ads.campaign_stats s ON c.campaign_id = s.campaign_id
WHERE s.date > NOW() - INTERVAL '30 days'
GROUP BY c.campaign_name, c.campaign_status

This view gives the agent a clean summary of campaign performance with key metrics.
Step 3: Auto-Build the MCP Tool
- Select your view (
campaign_performance) in the right sidebar. - Click "Create MCP Tool" and choose "Create with AI".
- Type a prompt: "Create a tool that shows campaign performance metrics by campaign name."
- Pylar generates the tool configuration:
- Name:
get_campaign_performance - Description: "Returns spend, clicks, conversions, and CTR for a specific campaign."
- Parameters:
campaign_name(string)
- Name:

Step 4: Publish & Connect
- Click "Publish" in the right sidebar.
- Click "Generate Token".
- Copy your MCP HTTP Stream URL (
https://mcp.publish.pylar.ai/mcp) and Authorization Bearer Token.

Connect to Marketing Dashboard: You can now build a custom dashboard that lets your team query Google Ads data via natural language.
from langchain_mcp import MCPTool
google_ads_tool = MCPTool(
url="https://api.pylar.ai/mcp/v1/server/YOUR_SERVER_ID",
api_key="YOUR_API_KEY"
)
# Agent can now answer: "What's the ROAS for the 'Black Friday' campaign?"
Advanced Use Cases for Google Ads Agents
1. Budget Optimization Assistant
Goal: Identify campaigns that are overspending without delivering conversions.
- View: Filter campaigns by
cost_per_conversionthreshold. - Tool Prompt: "Create a tool that finds campaigns with cost per conversion above $50."
- User Query: "Which campaigns are wasting budget?"
2. Keyword Performance Analyzer
Goal: Help PPC managers identify high-performing keywords to scale.
- View: Aggregate keyword stats by
keyword_textand calculate ROAS. - Tool Prompt: "Create a tool that ranks keywords by conversion rate."
- User Query: "What are our top 10 converting keywords?"
Conclusion
Google Ads is the world's largest advertising platform, but giving AI agents access to campaign data has always required complex API integrations and constant worry about accidentally modifying campaigns or budgets. With Pylar, you can transform your Google Ads data into an AI-ready resource in under 2 minutes—no coding required.
By connecting Pylar to your Google Ads accounts (including multiple accounts for agencies), creating sandboxed views that aggregate performance metrics, and auto-generating MCP tools with natural language, you unlock the full potential of your advertising data for AI agents while maintaining complete security and preventing accidental budget changes.
Whether you're building a budget optimization assistant, a keyword performance analyzer, or any other Google Ads-powered AI application, Pylar gives you the governance layer you need. Your views act as security boundaries, and since Pylar is read-only by design, agents can analyze performance without risking accidental campaign modifications.
Turn your Google Ads data into an AI-ready resource. Start building advertising intelligence agents today.
Start building your Google Ads MCP server for free at pylar.ai.
