The Business Problem
Managing large Google Ads and multi-channel marketing budgets across thousands of product SKUs typically involves either:
- Endless manual reporting inside bulky agency dashboards that lag reality by 24–48 hours.
- Generic AI chatbots that hallucinate metrics because they lack direct, authenticated, schema-validated access to live database APIs.
Marketing teams were frequently missing negative keyword bleed, unstocked items continuing to consume high ad spend, and sudden shifts in conversion efficiency until thousands of pounds were wasted.
The goal: Give LLMs actual tools and secure context to query the live marketing infrastructure and execute validated recommendations.
The Architectural Solution
Using the newly established Model Context Protocol (MCP) standard, I built a modular Python-based MCP server that safely exposes Google Ads API endpoints, warehouse inventory feeds, and attribution datasets as standardized tool calls for LLMs.
ANTHROPIC CLAUDE MCP PROTOCOL
JSON-RPC / TOOLS GOOGLE ADS API
LIVE TELEMETRY GUARDRAILS
AUDIT & PERMISSIONS
1. Strict Schema Validation & Structured Tools
Exposed deterministic tools such as query_campaign_spend, audit_search_terms, detect_out_of_stock_ad_waste, and calculate_margin_roas. The LLM does not generate loose SQL; it executes strongly-typed tools with parameterized boundaries.
2. Real-Time Stock & Margin Cross-Referencing
The MCP server joins ad performance with internal warehouse stock levels. If a product SKU's inventory drops below safety thresholds or unit gross margin is squeezed by supplier price increases, the model flags the campaign immediately.
3. Human-in-the-Loop Guardrails
While read queries execute autonomously, state-mutating actions (e.g., pausing an ad group, adjusting negative keywords, or modifying target ROAS) generate structured proposal diffs requiring explicit human authorization.
The Business Outcomes
- Immediate Waste Elimination: Uncovered and eliminated recurring ad spend directed at low-stock or discontinued items within the first 48 hours of deployment.
- Natural Language Intelligence: Commercial directors can now ask: "Which product categories saw a drop in ROAS yesterday despite rising clicks?" and receive verified, source-linked tables and diagnosis in seconds.
- Future-Proof Agentic Foundation: Positioned the enterprise stack to leverage evolving agentic models without rewriting backend business logic.