by talknerdytome-labs
Provides instant retrieval and analysis of Facebook's public ads library, enabling queries about ad campaigns, image and video creatives, and comparative marketing insights.
The server acts as a bridge between LLMs (e.g., Claude) and Facebook's Ads Library, allowing users to fetch, batch‑process, and analyze ads—both images and videos—across multiple brands.
install.sh
or the manual steps)..env
file with a ScrapeCreators API key and optionally a Gemini API key for video analysis.mcp_server.py
.get_meta_ads
, analyze_ad_image
, analyze_ad_videos_batch
, etc.Q: Do I need a Gemini API key?
A: Only if you plan to use video analysis. Image analysis works solely with the ScrapeCreators API.
Q: What happens when ScrapeCreators credits run out?
A: The server returns a clear message with a link to the ScrapeCreators dashboard for topping up; operations resume automatically after credits are replenished.
Q: Can I run the server on Windows?
A: Yes. Use install.bat
for the quick install or follow the manual steps with a PowerShell prompt.
Q: How are duplicate requests handled in batch mode?
A: The server automatically deduplicates identical queries before sending them to the external API, minimizing rate‑limit hits.
Q: Is the MCP server open‑source?
A: Yes, it is released under the MIT License.
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
To get updates on this and other projects we work on subscribe here
PS: Join our Twitter community for all things MCP
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.
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.
python -m pip install
Clone and run the install script
git clone http://github.com/talknerdytome-labs/facebook-ads-library-mcp.git
cd facebook-ads-library-mcp
# For macOS/Linux:
./install.sh
# For Windows:
install.bat
The install script will:
Configure your API keys
Edit the .env
file that was created and add your API keys:
Follow the displayed MCP configuration
The install script will show you the exact configuration to add to Claude Desktop or Cursor.
If you prefer to install manually:
Clone this repository
git clone https://github.com/trypeggy/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:
cp .env.template .env
# Then edit .env with your actual API keys
To obtain API keys:
Connect to the MCP server
Add the MCP server configuration to your Claude Desktop or Cursor config:
{
"mcpServers": {
"fb_ad_library": {
"command": "{{PATH_TO_PROJECT}}/facebook-ads-library-mcp/venv/bin/python",
"args": [
"{{PATH_TO_PROJECT}}/facebook-ads-library-mcp/mcp_server.py"
]
}
}
}
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 .env
file, so you don't need to pass them as command line arguments.
For Claude Desktop:
Save this as claude_desktop_config.json
in your Claude Desktop configuration directory at:
~/Library/Application Support/Claude/claude_desktop_config.json
For Cursor:
Save this as mcp.json
in your Cursor configuration directory at:
~/.cursor/mcp.json
Restart Claude Desktop / Cursor
Open Claude Desktop and you should now see the Facebook Ads Library as an available integration.
Or restart Cursor.
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 | - |
get_meta_platform_id
and get_meta_ads
now accept single strings or arrays for efficient bulk operationsanalyze_ad_videos_batch
processes multiple videos in a single Gemini API call for massive token savings🆕 ScrapeCreators API Credits Exhausted:
🆕 Rate Limit Exceeded:
API Key Not Found Error:
.env
file is in the project root directory.env
file, copy it from the template: cp .env.template .env
.env
file contains SCRAPECREATORS_API_KEY=your_key_here
GEMINI_API_KEY=your_key_here
is also addedVideo Analysis Not Working:
.env
fileGEMINI_API_KEY
environment variableMCP Server Connection Issues:
python3 -m venv venv && ./venv/bin/pip install -r requirements.txt
/venv/bin/python
)For additional Claude Desktop integration troubleshooting, see the MCP documentation. The documentation includes helpful tips for checking logs and resolving common issues.
Your feedback will be massively appreciated. Please tell us which features on that list you like to see next or request entirely new ones.
This project is licensed under the MIT License.
Please log in to share your review and rating for this MCP.
{ "mcpServers": { "fb_ad_library": { "command": "<PROJECT_ROOT>/venv/bin/python", "args": [ "<PROJECT_ROOT>/facebook-ads-library-mcp/mcp_server.py" ], "env": { "SCRAPECREATORS_API_KEY": "<YOUR_SCRAPECREATORS_API_KEY>", "GEMINI_API_KEY": "<YOUR_GEMINI_API_KEY>" } } } }
Explore related MCPs that share similar capabilities and solve comparable challenges
by lharries
Enables searching, reading, and sending personal WhatsApp messages and media through a Model Context Protocol (MCP) server, storing all data locally in SQLite and exposing controlled tools for LLMs like Claude.
by iFurySt
Provides authenticated access to XiaoHongShu (RedNote) notes, supporting keyword search, note retrieval by URL, and cookie persistence via a Model Context Protocol server.
by korotovsky
Provides a powerful Model Context Protocol interface for Slack workspaces, enabling message retrieval, search, and optional posting via Stdio or SSE transports without requiring bot permissions.
by ZubeidHendricks
Provides a standardized interface for interacting with YouTube content, enabling video retrieval, transcript access, channel and playlist management, and advanced analytics through the Model Context Protocol.
by InditexTech
Provides Microsoft Teams integration via the Model Context Protocol, enabling reading, creating, replying to messages and mentioning members.
by chigwell
Provides a full‑featured Telegram integration for MCP‑compatible clients, enabling programmatic access to chats, messages, contacts, profile management, and group administration.
by EnesCinr
Interact with Twitter to post tweets and search tweets programmatically via an MCP server.
by chaindead
Manages Telegram dialogs, messages, drafts, and read statuses via the Model Context Protocol, enabling AI assistants to query and interact with Telegram accounts.
by carterlasalle
Securely interfaces with the macOS Messages database via MCP, enabling LLMs to query, analyze, filter, and send iMessage or SMS communications with built‑in phone number validation, attachment handling, and group chat support.