◇ Case study / 03 · 2026
Marketing Analytics MCP
Model Context Protocol server
◇ The problem
What we were trying to solve
Weekly + monthly Meta Ads + GA4 reports for leadership were manual — log in to each dashboard, screenshot the right cards, paste into a deck, send. Hours of work, error-prone, never on time. The natural Claude question — 'how did our top-of-funnel campaigns do last week vs prior?' — couldn't be answered without that manual loop.
◇ The solution
How it shipped
Built a custom Python Model Context Protocol (MCP) server that exposes Meta Marketing API + GA4 Data API as six tools Claude can call directly: list accounts, list campaigns, campaign insights (with breakdowns), GA4 run-report, GA4 realtime, and combined Meta+GA4 ROAS summary. Plus a scheduled PDF reporting pipeline (`report_generator.py`) that runs every Monday 08:00 and 1st of each month 08:00, generates a branded multi-page PDF, and emails it to leadership via Gmail SMTP.
◇ Decisions
Engineering choices worth flagging
MCP server vs raw API integration
MCP lets the same server work across Claude Desktop, Claude Code, and any future MCP-aware client. It's reusable across multiple sites/accounts (every tool takes account_id/property_id as parameters). Building this as an MCP is dramatically more future-proof than baking the API calls into one application.
GA4 via ADC instead of service account JSON
Application Default Credentials means no JSON keys to manage, rotate, or accidentally commit. One `gcloud auth application-default login` and the server reads any GA4 property the authenticated user has Viewer access to.
Scheduled tasks instead of cron / external scheduler
Windows Task Scheduler with 'start when available' enabled — if the PC is off at 08:00, the task runs as soon as it's next on. No cloud cron service needed for v1. Cheap, reliable, easy to inspect with schtasks /Query.
◇ Results
What shipped
◇ Stack
Tools used
◇ Keep exploring