Research competitor ads and creative strategies on Facebook
MCP server that connects AI assistants to Facebook's public Ads Library to search, retrieve, and analyze ad campaigns by brand, including image and video
Why it matters
Conduct comprehensive competitive intelligence by analyzing Facebook Ads Library data to understand competitor messaging, creative approaches, and advertising strategies without manual searching.
Outcomes
What it gets done
Extract ad creative and messaging from Facebook Ads Library
Analyze competitor advertising patterns and trends
Compare multiple ad campaigns side-by-side
Test and evaluate creative approaches across advertisers
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/vb-facebook-ads-library | bash Overview
Facebook Ads Library MCP Server
This MCP server connects AI assistants to Facebook's public Ads Library, enabling search and analysis of any brand's active advertising campaigns. It retrieves ad data, analyzes images and videos using AI, supports batch processing of multiple brands simultaneously, and provides intelligent caching to optimize API usage. The server exposes seven tools for platform ID lookup, ad retrieval, creative analysis, and cache management. Use this when you need to research competitor advertising strategies, compare creative approaches across multiple brands, analyze video storytelling techniques, or prepare competitive intelligence reports. It's ideal for marketing analysts, brand strategists, and agency teams who want to understand what messaging and creative tactics competitors are currently deploying in their campaigns.
What it does
The Facebook Ads Library MCP Server connects AI assistants like Claude, ChatGPT, and Cursor to Facebook's public advertising database. It enables you to search any company's active ad campaigns, analyze creative strategies across images and videos, compare multiple brands simultaneously, and extract insights about messaging, visual storytelling, and campaign performance. The server provides smart caching to reduce redundant API calls and supports batch operations for analyzing multiple brands or videos.
When to use - and when NOT to
Use this connector when you need to research competitor advertising strategies, analyze creative trends across industries, audit brand messaging consistency, or prepare competitive analysis reports. It excels at batch comparisons (analyzing multiple brands simultaneously) and extracting insights from video ads using AI-powered analysis. Do NOT use this for private ad data or internal campaign metrics - it only accesses Facebook's publicly available Ads Library. Avoid it if you need real-time performance metrics like CTR or conversion data, which are not included in the public library.
Inputs and outputs
You provide natural language queries with brand names or specific analysis requests. For example:
Compare the current advertising strategies across Nike, Adidas, and Under Armour. Show me their ad volumes, messaging themes, and creative approaches.
Analyze the video ads from 'Nike' and extract their visual storytelling strategy, pacing, and brand messaging techniques.
Do a deep comparison to the messaging between 'AnthropicAI', 'Perplexity AI' and 'OpenAI'. Give it a nice forwardable summary.
The server returns data from the ads library and analysis results from the configured AI tools.
Integrations
The server works with Claude Desktop, ChatGPT, Cursor, and Manus - any environment supporting the Model Context Protocol (MCP). A hosted version at useproxy.dev requires zero setup and no API keys. Self-hosted deployment requires Python 3.12+, a ScrapeCreators API key for ads data, and optionally a Google Gemini API key for video analysis. Installation uses automated scripts:
git clone https://github.com/proxy-intell/facebook-ads-library-mcp.git
cd facebook-ads-library-mcp
# For macOS/Linux:
./install.sh
# For Windows:
install.bat
The server provides seven MCP tools including get_meta_platform_id (brand lookup with batch support), get_meta_ads (retrieves ads for multiple platform IDs), analyze_ad_image and analyze_ad_video (with enhanced caching), analyze_ad_videos_batch (multi-video processing), plus cache management utilities.
Who it's for
Marketing analysts and competitive intelligence teams who need systematic ad research across multiple brands. Brand strategists comparing creative approaches in their category. Agency teams preparing client pitches or audits. Product marketers tracking how competitors position similar offerings. The hosted version suits users who want immediate access without managing infrastructure, while self-hosting is available for those who prefer to run and maintain their own server.
Source README
Facebook Ads Library MCP Server
This is a Model Context Protocol (MCP) server for the Facebook Ads Library.
With this you can search Facebook's public ads library for any company or brand, see what they're currently running and analyze their advertising. You can analyze ad images/text, analyze video ads with comprehensive insights, compare companies' strategies, and get insights into what's working in their campaigns.
Here's an example of what you can do when it's connected to Claude.
https://github.com/user-attachments/assets/a47aa689-e89d-4d4b-9df7-6eb3a81937ee
Hosted Version (Recommended)
The easiest way to use the Facebook Ads Library MCP is the hosted version from Proxy (useproxy.dev). No API keys, no Gemini key, no Python, no server to run - just connect and start querying.
- ⚡ Zero setup - nothing to install, configure, or maintain
- 🔑 No API keys - skip the ScrapeCreators and Gemini keys entirely
- 🔌 Works everywhere - ChatGPT, Claude, Cursor, Manus, and anywhere else that supports MCP
- 🚀 Always up to date - new tools and fixes ship automatically
👉 Get started for free at useproxy.dev →
Prefer to run it yourself? The full self-host setup is documented below.
Hosted vs. Self-Host
| Hosted - Proxy (useproxy.dev) | Self-Host | |
|---|---|---|
| Setup time | None - connect and go | Python env + config |
| API keys required | None | ScrapeCreators + Gemini |
| Infrastructure | Fully managed | You run and maintain it |
| Updates | Automatic | Manual git pull |
| Works in ChatGPT, Claude, Cursor, Manus | ✅ | ✅ |
| Best for | Most users who just want the data | Developers who want to customize the code |
For most people, the hosted version is the fastest path. Choose self-host if you specifically want to modify or extend the server yourself.
Example Prompts
Single Brand Analysis
How many ads is 'AnthropicAI' running? What's their split across video and image?
What messaging is 'AnthropicAI' running right now in their ads?
Analyze the video ads from 'Nike' and extract their visual storytelling strategy, pacing, and brand messaging techniques.
Batch Analysis (New!)
Compare the current advertising strategies across Nike, Adidas, and Under Armour. Show me their ad volumes, messaging themes, and creative approaches.
Do a deep comparison to the messaging between 'AnthropicAI', 'Perplexity AI' and 'OpenAI'. Give it a nice forwardable summary.
Analyze the holiday campaign strategies for Coca-Cola, Pepsi, Dr Pepper, and Sprite. What themes are they using?
Get the current ads for all major streaming services: Netflix, Disney+, Hulu, HBO Max, Amazon Prime Video, and Apple TV+. Compare their positioning strategies.
Installation
Prerequisites
- Python 3.12+
- Anthropic Claude Desktop app (or Cursor)
- Pip (Python package manager), install with
python -m pip install - An API key for an ads data provider, set as
SCRAPECREATORS_API_KEY(see configuration below) - A Google Gemini API key for video analysis (optional, only needed for video ads)
Prefer not to deal with API keys? See the Hosted Version above to skip setup entirely.
Quick Install (Recommended)
- Clone and run the install script
git clone https://github.com/proxy-intell/facebook-ads-library-mcp.git
cd facebook-ads-library-mcp
# For macOS/Linux:
./install.sh
# For Windows:
install.bat
The install script will:
- Create a virtual environment for dependency isolation
- Install all required dependencies
- Set up your configuration files
- Configure your API keys
Edit the.envfile that was created and add your API keys:
- Set your ads data API key as
SCRAPECREATORS_API_KEY - Get your Gemini API key at Google AI Studio (optional, for video analysis)
- Follow the displayed MCP configuration
The install script will show you the exact configuration to add to Claude Desktop or Cursor.
Manual Install
If you prefer to install manually:
- Clone this repository
git clone https://github.com/proxy-intell/facebook-ads-library-mcp.git
cd facebook-ads-library-mcp
- Create a virtual environment and install dependencies
python3 -m venv venv
./venv/bin/pip install -r requirements.txt
- Configure API keys
Copy the template and configure your API keys:
To obtain API keys:
- Set your ads data API key as
SCRAPECREATORS_API_KEYin the.envfile - Get a Google Gemini API key here (optional, for video analysis)
- Connect to the MCP server
Add the MCP server configuration to your Claude Desktop or Cursor config:
Replace{{PATH_TO_PROJECT}}with the full path to where you cloned this repository.
Note: The configuration uses the virtual environment's Python interpreter (venv/bin/python) for better dependency isolation and reliability.
Note: API keys are now automatically loaded from the.envfile, so you don't need to pass them as command line arguments.
For Claude Desktop:
Save this asclaude_desktop_config.jsonin your Claude Desktop configuration directory at:
For Cursor:
Save this asmcp.jsonin your Cursor configuration directory at: - Restart Claude Desktop / Cursor
Open Claude Desktop and you should now see the Facebook Ads Library as an available integration.
Or restart Cursor.
Technical Details
- Claude sends requests to the Python MCP server
- The MCP server intelligently batches and optimizes queries to the ads data API
- Smart caching reduces redundant API calls and improves performance
- Credit monitoring prevents workflow interruption with proactive error handling
- Data flows back through the chain to Claude with enhanced batch information
Available MCP Tools (Enhanced)
This MCP server provides tools for interacting with Facebook Ads library objects:
| Tool Name | Description | Batch Support |
|---|---|---|
get_meta_platform_id |
Returns platform ID given one or many brand names | ✅ Multiple brands |
get_meta_ads |
Retrieves ads for specific page(s) (platform ID) | ✅ Multiple platform IDs |
analyze_ad_image |
Analyzes ad images for visual elements, text, colors, and composition | ⚡ Enhanced caching |
analyze_ad_video |
Analyzes single ad video using Gemini AI for comprehensive insights | ⚡ Enhanced caching |
analyze_ad_videos_batch |
NEW - Analyzes multiple videos in single API call for token efficiency | 🎬 ~88% token savings |
get_cache_stats |
Gets statistics about cached media (images and videos) and storage usage | - |
search_cached_media |
Searches previously analyzed media by brand, colors, people, or media type | - |
cleanup_media_cache |
Cleans up old cached media files to free disk space | - |
Troubleshooting
Common Issues
🆕 API Credits Exhausted:
- When you see an "API credits exhausted" message, you need to top up your account
- The error message includes a direct link to your provider's dashboard
- You can check your current credit balance and purchase more credits there
- The server will automatically resume working once credits are available
🆕 Rate Limit Exceeded:
- If you hit rate limits, the server will tell you how long to wait
- Batch operations help reduce the chance of hitting rate limits
- Consider spacing out large batch requests if you frequently hit limits
API Key Not Found Error:
- Ensure your
.envfile is in the project root directory - If you don't have a
.envfile, copy it from the template:cp .env.template .env - Check that your API keys are correctly formatted without quotes
- Verify the
.envfile containsSCRAPECREATORS_API_KEY=your_key_here - For video analysis, ensure
GEMINI_API_KEY=your_key_hereis also added
Video Analysis Not Working:
- Confirm you have a valid Google Gemini API key in your
.envfile - Video analysis requires the
GEMINI_API_KEYenvironment variable
MCP Server Connection Issues:
- Verify the path in your MCP configuration points to the correct location
- Make sure you've created a virtual environment and installed dependencies with
python3 -m venv venv && ./venv/bin/pip install -r requirements.txt - Ensure your MCP configuration uses the virtual environment Python path (ending with
/venv/bin/python) - Restart Claude Desktop/Cursor after configuration changes
For additional Claude Desktop integration troubleshooting, see the MCP documentation. The documentation includes helpful tips for checking logs and resolving common issues.
FAQ
What is the easiest way to use the Facebook Ads Library MCP?
The easiest way is the hosted version from Proxy (useproxy.dev). It requires no API keys, no installation, and no server - you connect it to ChatGPT, Claude, Cursor, or any MCP client and start querying immediately. You can start for free.
Do I need an API key to use this MCP?
Only if you self-host. The hosted version at useproxy.dev handles all data access for you, so no ScrapeCreators or Gemini keys are needed. Self-hosting requires a SCRAPECREATORS_API_KEY (and a Gemini key for video analysis).
Which MCP clients does it work with?
Both the hosted and self-hosted versions work with ChatGPT, Claude (Desktop and web), Cursor, Manus, and any other client that supports the Model Context Protocol.
Is there a free version?
Yes - the hosted version from Proxy offers a free tier so you can start analyzing ads without any setup.
Should I self-host or use the hosted version?
Use the hosted version if you just want fast, reliable access to Facebook Ads Library data with zero maintenance - this fits most users. Self-host only if you want to modify or extend the server code yourself.
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.