Facebook Ad Library MCP
An MCP server that searches competitors' ads in the public Facebook Ad Library with no account or token
- 282 ★ on the repository
- Last commit
- MIT
Broad access
Why this level
- Runs a headless browser that scrapes Facebook pages, and the service's terms may restrict automated collection
- A script on your machine goes to the network, and other advertisers' ad texts enter the agent's context
- With frequent requests the results go empty for a while
Install
- Works in
Manual install
claude mcp add facebook-ads -- /abs/path/venv/bin/python /abs/path/facebook_ads_mcp_complete.pyFirst clone the repository, create a virtual environment, run `pip install -r requirements.txt` and `python -m playwright install chromium`. Paths in the command must be absolute.
Access and checks
How we reviewBroad accessThe tool can change data, run commands or handle secrets.
- Runs a headless browser that scrapes Facebook pages, and the service's terms may restrict automated collection
- A script on your machine goes to the network, and other advertisers' ad texts enter the agent's context
- With frequent requests the results go empty for a while
This is third-party code. Review the repository files before installing.
What it does
Facebook Ad Library MCP opens the Facebook Ad Library web page in headless Chromium and parses the ad cards. The official `ads_archive` API returns all ads only for political content, and for other ad types only in the EU and UK. The author therefore skipped the API: the server reads the same page you see in a browser. There are two tools. `search_ad_library` searches by keyword and country code, and `scrape_ad_library_url` parses any library link. For each ad it returns the advertiser and their page, the first-seen date, the number of ads using the creative, the landing URL unwrapped from `l.facebook.com`, the button label, the line under the creative, the full copy and a thumbnail link. The response adds an advertiser histogram and the page's raw markup as Markdown. The library loads cards as you scroll, and `scroll_rounds` sets the number of scrolls: 0 for a fast first screen, 15 or more for a deep sweep. `wait_seconds` controls the load wait, and `advertiser_page_id` opens the all-ads view of one page.
Who it is for. For marketers and business owners studying competitors' ads: copy, buttons and landing pages.
Good fit when
- You want to see which ads an advertiser is running now in Mexico, the US or another country
- Search results need grouping by advertiser and a list of landing domains
- You have an Ad Library link with filters and want it parsed in full with deep scrolling
- You need to gauge campaign scale by the number of ads sharing one creative
- You want ad copy and button labels collected to analyze creative angles
Not a fit when
- You need budgets and impressions: Meta publishes them only for political ads and only through the API
- You need to manage your own ad campaigns: the server only reads someone else's public library
- You need a stable scheduled export: there is no cache or rate-limit handling, and frequent requests return empty results
- You want to download and analyze the images and videos themselves: only a thumbnail link is returned
Example request
Search the Mexico Ad Library for "AI automation", group the ads by advertiser and list the landing domainsMCP
- Transport
- stdio
- Authentication
- not required
Limitations
The server parses the markup of Facebook's single-page app, so a layout change can break field extraction. `raw_markdown` is always returned as a fallback. The platforms field often comes back empty because the Facebook, Instagram and Messenger markers render as icons rather than text.
There is no caching or rate-limit protection. If you send too many requests, responses go empty for a while; then wait and raise `wait_seconds`. Facebook answers the headless browser with HTTP 403 and still serves the rendered cards, so success is judged by the number of parsed cards, not by status.
You need Python 3.10 or newer, the packages from `requirements.txt` including `crawl4ai` and FastMCP 3, and a browser installed with `python -m playwright install chromium`. The all-ads view by `advertiser_page_id` is heavier and does not always hydrate; searching by advertiser name is more reliable.
How to disable. Run `claude mcp remove facebook-ads` or delete the `facebook-ads` entry from `claude_desktop_config.json`, then restart the client. The repository folder and virtual environment can be deleted by hand.
FAQ
Do I need a Facebook account or a Meta token?
No. The server opens the public Ad Library page in a headless browser, as you would yourself, and uses neither a login nor an API token.
Why does the server not use Meta's official API?
`ads_archive` returns only political and issue ads worldwide, and returns all ad types only for the EU and UK. For an ordinary commercial advertiser elsewhere it gives almost nothing, so the author reads the web page.
How do I connect Facebook Ad Library MCP to Claude Code?
After installing the dependencies run `claude mcp add facebook-ads -- /abs/path/venv/bin/python /abs/path/facebook_ads_mcp_complete.py` with absolute paths. For Claude Desktop the same `command` and `args` pair goes into `claude_desktop_config.json`. Then restart the client.
What if the results come back empty?
Raise `wait_seconds` so the page can hydrate and lower your request rate. The server has no limits or cache, so with frequent calls Facebook stops serving cards for a while.
Can I learn how much is spent on ads?
No. Meta publishes amounts and impressions only for political ads and only through the API. The server gives creatives, launch cadence and landing-page data, not budgets.
Discussion
No questions or reviews yet.
Related
MCP serversAn MCP server for Google Ads, Reddit Ads and GA4: the agent reads reports and edits campaigns, and only you turn on real spend
MCP server for Google Ads: analyze campaigns, metrics and keywords with GAQL queries right in the chat with an agent
Google, Meta Ads and GA4 MCP
Google + Meta Ads + GA4 MCP
Remote MCP server for Google Ads, Meta Ads and Google Analytics 4 in one connection, OAuth login without API keys
Eight read-only SEO MCP servers
seo-tools-mcp
SERP, Wordstat, GSC, GA4, Yandex Webmaster, Metrika and A-Parser: eight read-only MCP servers with strict JSON and multi-account support for Claude Code
Search Console MCP: Google, Bing and GA4 data for agents
Search Console MCP
An MCP server that gives an agent Google Search Console, Bing Webmaster, GA4 and AdSense data with ready SEO checks
Yandex Webmaster API v4.1 MCP server
Яндекс Вебмастер MCP-сервер
A Python MCP server with full Yandex Webmaster API v4.1 coverage: 37 tools from diagnostics and sitemaps to important-URL monitoring
Comparison with similar tools
Entries that share the main search query, and how they differ.
| Entry | Official | Authentication | Repository stars | Main difference |
|---|---|---|---|---|
| Facebook Ad Library MCP (this entry) | no | not required | 282 | |
| Facebook Ads Library MCP | no | API key | 319 | searches brand ads and additionally analyzes ad images and videos |
| Meta Ads MCP | yes | OAuth | 1,338 | manages your own Facebook and Instagram campaigns rather than reading the public library |
README in short
The README explains why the server exists and why the official API does not fit. It then covers the field list, installation, client registration, example prompts, parameters, how it works and limitations.