Skip to main content
Glama
meta-ad-library-mcp

meta-ad-library-mcp

README.md
# Meta Ad Library Intelligence MCP Server ๐Ÿ•ต๏ธโ€โ™‚๏ธ๐Ÿ“ˆ

[![Smithery Badge](https://smithery.ai/badge/meta-ad-library-mcp)](https://smithery.ai/server/meta-ad-library-mcp)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
[![Node: >=18](https://img.shields.io/badge/Node->=18-green.svg)](https://nodejs.org/)

A **Model Context Protocol (MCP)** server that connects **Claude Desktop**, **Cursor IDE**, and autonomous AI agents directly to the **Meta Ad Library** (Facebook & Instagram).

Empower your AI models to inspect live competitor ad creatives, identify winning ads running 30+ days, analyze video vs. image splits, extract marketing hooks, and conduct automated marketing research without ever leaving your chat or editor.

---

## โšก Features

* ๐Ÿ” **Live Meta Ad Search:** Search active Facebook and Instagram ads by brand, competitor name, or product keyword.
* ๐Ÿ† **Winning Ads Detector:** Filter by `minDaysActive` (e.g. 30, 60, 90+ days) to isolate proven, profitable ads that competitors keep spending budget on.
* ๐Ÿ“Š **Competitor Intelligence Report:** Instant breakdown of creative format split (Video, Image, Carousel), longest-running ad copy, and top CTA buttons.
* ๐Ÿ”— **Deep Snapshot Links:** Direct URLs to Meta Ad Library records for human verification and high-res video preview.
* ๐Ÿค– **Universal Compatibility:** Works seamlessly with **Claude Desktop**, **Cursor IDE**, **Windsurf**, and any MCP client.

---

## ๐Ÿ“ฆ Installation & Setup

### Option 1: One-Click Install via Smithery CLI
Run this in your terminal to automatically configure Claude Desktop:
```bash
npx -y @smithery/cli install meta-ad-library-mcp --client claude
```

### Option 2: Claude Desktop (Manual Config)
Add this block to your `claude_desktop_config.json`:

* **MacOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
* **Windows:** `%APPDATA%\Claude\claude_desktop_config.json`

```json
{
  "mcpServers": {
    "meta-ad-library": {
      "command": "npx",
      "args": ["-y", "meta-ad-library-mcp"],
      "env": {
        "META_ACCESS_TOKEN": "YOUR_OPTIONAL_META_TOKEN",
        "MCP_PRO_KEY": "YOUR_OPTIONAL_PRO_KEY"
      }
    }
  }
}
```

### Option 3: Cursor IDE
Add to your project's `.cursor/mcp.json`:
```json
{
  "mcpServers": {
    "meta-ad-library": {
      "command": "npx",
      "args": ["-y", "meta-ad-library-mcp"]
    }
  }
}
```

---

## ๐Ÿ› ๏ธ Available MCP Tools

### 1. `search_meta_ads`
Search active ads by keyword or brand name with multi-criteria filtering.
* **Arguments:**
  * `keyword` *(string, required)*: Brand or search term (e.g. `"Gymshark"`, `"Athletic Greens"`, `"running shoes"`).
  * `countryCode` *(string)*: Target country (e.g. `"US"`, `"GB"`, `"CA"`, `"AU"`, or `"ALL"`). Default: `"US"`.
  * `minDaysActive` *(number)*: Minimum active runtime in days (e.g. `30` to only find proven winning ads). Default: `0`.
  * `mediaType` *(string)*: Filter by `"ALL"`, `"IMAGE"`, or `"VIDEO"`. Default: `"ALL"`.
  * `maxAds` *(number)*: Number of results (up to 50). Default: `20`.

### 2. `analyze_competitor_ads`
Generates a structured marketing intelligence audit for a brand.
* **Arguments:**
  * `brandName` *(string, required)*: Exact brand name to analyze (e.g. `"Nike"`, `"Hims"`, `"Shopify"`).
  * `countryCode` *(string)*: Country code. Default: `"US"`.
  * `sampleSize` *(number)*: Sample size (up to 50). Default: `25`.

### 3. `get_ad_library_url`
Generates pre-filtered Meta Ad Library URLs for instant browser preview.

---

## ๐Ÿ’ก Example Prompts to Ask Claude / Cursor

* *"Analyze Nike's active ads in the US. What percentage are videos vs images, and what are their longest-running creatives?"*
* *"Find winning ads for 'collagen powder' running for more than 45 days in the US. Extract their main copywriting hooks."*
* *"Compare the CTA buttons and headline strategies of Gymshark vs Lululemon based on their active Facebook ads."*

---

## ๐Ÿ”‘ Authentication & Tokens

* **Free Tier:** Works out of the box with sample intelligence queries and direct Ad Library routing.
* **Live Graph API Mode:** To query Meta's high-speed Graph API archives directly, supply a free Meta Graph Developer token in `META_ACCESS_TOKEN`.
  1. Go to [Meta for Developers](https://developers.facebook.com/).
  2. Generate a User Access Token with `ads_read` permission.
  3. Paste it into your MCP config `env`.

---

## ๐Ÿ“„ License

MIT ยฉ [Abdul-Basit-Zahid](https://github.com/Abdul-Basit-Zahid)

TDQS

A3.8/5.0

Scored across 3 tools

Disambiguation4/5

search_meta_ads (raw retrieval with filters) and analyze_competitor_ads (aggregated intelligence) could be confused by an agent wanting competitor ads, but the descriptions clearly delineate raw search vs. analysis. get_ad_library_url is distinct as a URL generator for manual verification.

Naming Consistency5/5

All three tools follow a consistent verb_noun snake_case pattern (search_meta_ads, analyze_competitor_ads, get_ad_library_url). The noun segments vary naturally by resource but the convention is predictable.

Tool Count4/5

Three tools is a tightly scoped surface for a narrow ad-library purpose, with each tool earning its place (search, analyze, URL generation). Slightly thin, but reasonable for the focused domain.

Completeness4/5

Core workflowsโ€”finding ads, analyzing a competitor's ad strategy, and generating a manual-verification URLโ€”are covered. Minor gaps exist, such as fetching details for a single specific ad or paginating raw search results, but the URL tool provides a workaround.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues