CASE STUDY 02 / APPLIED AI & TOOLING

LET THE MODELS
AUDIT IT.

Building an enterprise Model Context Protocol (MCP) server that empowers modern LLMs (Claude, OpenAI, Gemini) to inspect live advertising spend, discover wasted budget, and suggest actionable optimizations with built-in guardrails.

ROLELead AI Engineer & Architect
DOMAINApplied AI · Marketing Intelligence · MCP Tooling
STACKModel Context Protocol (MCP) · Python · Google Ads API · Anthropic Claude
IMPACT85% Faster Anomaly Detection · Direct Action Execution

The Business Problem

Managing large Google Ads and multi-channel marketing budgets across thousands of product SKUs typically involves either:

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.

FROM CHATBOTS TO AGENTIC SYSTEMS

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.

USER / AGENT
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

← PREVIOUS: THE MARKETPLACE MACHINE NEXT CASE STUDY: SYNC EVOLVE →