Shinas AR
000%
Back to workShinas · AR

◇ Case study / 03 · 2026

Marketing Analytics MCP

Model Context Protocol server

Role
Sole engineer · Wall Street Jr Investments
Duration
Apr 2026 — ongoing
Status
Live
Stack
Python · FastMCP · Meta Marketing API · GA4 Data API

◇ 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

01 · Decision

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.

02 · Decision

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.

03 · Decision

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

6
Tools exposed
5
Reports / month
4 weekly + 1 monthly
100%
Manual work eliminated
MIT
Public on GitHub

◇ Stack

Tools used

PythonFastMCPMeta Marketing APIGA4 Data APIReportLab

◇ Keep exploring

Other case studies.