Sponsored by Deepsite.site

Meta-ads-analyzer to Marketing section

Created By
shibanshu1220 days ago
Performance marketing diagnostics MCP server for Meta Ads. 15 tools for spend leak detection, creative fatigue analysis, audience decay monitoring, benchmarking, and custom SQL queries. Read-only SQLite security by default.
Overview

📊 Meta Ads Analyzer

Ask Claude about your ad campaigns the way you'd ask a senior media buyer.

An MCP server that turns your Meta Ads data into a conversational analytics layer. Unlike other Meta Ads MCP tools that wrap the live API, this one stores your historical data locally and lets you query it with natural language.

Why this exists

Ads Manager gives you charts. But try answering:

  • "Which creatives are fatigued right now?"
  • "Where am I leaking spend below 1.5x ROAS?"
  • "Is my audience decaying or is it a creative problem?"

You can't — not without exporting CSVs and building dashboards. This tool gives Claude direct access to your campaign data with built-in marketing intelligence, so you just ask.

Built-in intelligence

ToolWhat it detects
Creative fatigueFrequency > 3 + declining CTR = fatigued creative
Audience decayFrequency < 2 + dropping CVR = exhausted audience
Spend leaks>40% budget at <1.5x ROAS = wasted money
Retargeting cannibalizationRetargeting > 25% of spend = cannibalizing prospecting
Placement optimizationWhich placements (Feed, Stories, Reels) deliver best ROI
Hourly patternsBest/worst hours for your campaigns

Plus: campaign rankings, daily trends, demographic breakdowns, country-level ROI, device performance, and custom SQL.

Requirements

  • Python 3.10+ on your machine
  • Claude Pro or Max subscription — MCP servers only work with Claude Desktop, Claude Code, or Claude.ai (not ChatGPT, Gemini, or free Claude)
  • Meta Ads account — to pull your own data (or try with included sample data, no account needed)

Works with any MCP-compatible client: Claude Desktop (Mac/Windows), Claude Code (terminal), Claude.ai (web), Cursor, Windsurf.

Quick start

Install

pip install meta-ads-analyzer

Add to Claude Desktop

Open your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json) and add:

{
  "mcpServers": {
    "meta-ads-analyzer": {
      "command": "python3",
      "args": ["-m", "meta_ads_analyzer"],
      "env": {
        "META_ADS_DB_PATH": "~/meta_ads_data.db"
      }
    }
  }
}

Restart Claude Desktop. Done.

Try with sample data (no Meta account needed)

git clone https://github.com/shibanshu12/meta-ads-analyzer.git
cd meta-ads-analyzer
pip install .
META_ADS_DB_PATH=./examples/sample_data.db python -m meta_ads_analyzer

Use with your own Meta Ads data

Step 1: Get your Meta API credentials

  1. Go to Meta for Developers → create an app
  2. Open Tools → Graph API Explorer
  3. Generate an access token with ads_read permission
  4. Find your ad account ID in Ads Manager URL — looks like act_123456789

Step 2: Pull your data

# Clone the repo
git clone https://github.com/shibanshu12/meta-ads-analyzer.git
cd meta-ads-analyzer

# Set your credentials
export META_ACCESS_TOKEN="paste-your-token-here"
export META_AD_ACCOUNT_ID="act_123456789"

# Pull last 90 days of data (first time)
python pipeline/meta_ads_puller.py --days 90

# This creates ~/meta_ads_data.db on your machine

Step 3: Install and connect to Claude

pip install meta-ads-analyzer

Add to Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "meta-ads-analyzer": {
      "command": "python3",
      "args": ["-m", "meta_ads_analyzer"],
      "env": {
        "META_ADS_DB_PATH": "~/meta_ads_data.db"
      }
    }
  }
}

Restart Claude Desktop. Ask: "Check my data health"

Step 4 (optional): Automate daily pulls

Fork this repo and set up GitHub Actions to pull fresh data every day — even when your laptop is off. See pipeline docs for setup.


Example queries

Once connected, just ask Claude:

"Check my data health"
"Which campaigns have creative fatigue right now?"
"Show me my biggest spend leaks"
"ROAS by placement for the last 14 days"
"Which demographics convert best?"
"Compare this week vs last week"
"What's my retargeting cannibalization rate?"
"Show hourly performance patterns"
"Run a custom query: SELECT campaign_name, SUM(spend) FROM insights_daily GROUP BY campaign_name"

All 15 tools

Performance

ToolDescription
get_performance_summaryOverall account metrics — spend, ROAS, CPA, trends
get_campaign_performanceCampaign rankings sorted by spend, ROAS, or CPA
get_daily_trendDay-by-day spend and ROAS trend line
identify_spend_leaksCampaigns/adsets burning budget below ROAS threshold
run_custom_queryRun any SELECT query against the database

Creative

ToolDescription
detect_creative_fatigueAds with high frequency + declining CTR
detect_audience_decayAdsets with low frequency but dropping conversion rate
get_creative_performanceAll creatives ranked by ROAS

Audience

ToolDescription
get_demographic_performancePerformance by age × gender
get_country_performancePerformance by country
detect_retargeting_cannibalizationCheck if retargeting is eating prospecting budget

Placement & Device

ToolDescription
get_placement_performanceFeed vs Stories vs Reels vs Audience Network
get_device_performanceMobile vs desktop vs tablet
get_hourly_performancePerformance by hour (for dayparting)

Diagnostics

ToolDescription
check_data_healthDatabase tables, date ranges, row counts, freshness
get_table_schemaColumn definitions for any table
list_campaignsAll campaigns with IDs (for filtering other tools)

Automated data pipeline

This repo includes a GitHub Actions pipeline that pulls data from the Meta Marketing API daily — no local machine needed.

See pipeline setup docs for instructions.

How it compares

Featuremeta-ads-analyzerpipeboard (510⭐)gomarble (230⭐)
Campaign CRUD
Live API access
Historical analytics
Creative fatigue detection
Audience decay signals
Spend leak identification
Works offline
Automated data pipeline
Sample data for testing

This is not a replacement for pipeboard or gomarble. They handle campaign management. This handles campaign analysis. Use them together.

Database schema

The server expects a SQLite database with these tables:

TableDescription
insights_dailyDaily metrics per ad (no breakdown)
insights_demographicsMetrics broken down by age + gender
insights_placementMetrics by platform + position
insights_countryMetrics by country
insights_hourlyMetrics by hour of day (7 days only)
insights_deviceMetrics by device type

Each table contains: campaign_id, campaign_name, adset_id, adset_name, ad_id, ad_name, date, spend, impressions, clicks, reach, purchases, purchase_value + breakdown columns.

Contributing

Contributions welcome. See open issues for ideas.

git clone https://github.com/shibanshu12/meta-ads-analyzer.git
cd meta-ads-analyzer
pip install -e .

License

MIT — use it however you want.

Built by

Shibanshu Jha — 7+ years in performance marketing, managed $100M+ in Meta ad spend across India, US, UK, and Germany. Built this to solve problems I face daily as a growth marketing leader.

Server Config

{
  "mcpServers": {
    "meta-ads-analyzer": {
      "command": "uv",
      "args": [
        "run",
        "--with",
        "meta-ads-analyzer",
        "meta-ads-analyzer"
      ],
      "env": {
        "META_ADS_DB_PATH": "/path/to/your/meta_ads_data.db"
      }
    }
  }
}
Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
DeepChatYour AI Partner on Desktop
Serper MCP ServerA Serper MCP Server
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
Y GuiA web-based graphical interface for AI chat interactions with support for multiple AI models and MCP (Model Context Protocol) servers.
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Tavily Mcp
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
CursorThe AI Code Editor
Amap Maps高德地图官方 MCP Server
ChatWiseThe second fastest AI chatbot™
WindsurfThe new purpose-built IDE to harness magic
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
Playwright McpPlaywright MCP server
RedisA Model Context Protocol server that provides access to Redis databases. This server enables LLMs to interact with Redis key-value stores through a set of standardized tools.