meta-ad-library-mcp
# Meta Ad Library Intelligence MCP Server ๐ต๏ธโโ๏ธ๐
[](https://smithery.ai/server/meta-ad-library-mcp)
[](https://opensource.org/licenses/MIT)
[](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
Scored across 3 tools
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.
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.
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.
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.