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
MCP server

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
All reasons and checks

ramsesaguirre777/facebook-ads-library-mcp

Install

Manual install

claude mcp add facebook-ads -- /abs/path/venv/bin/python /abs/path/facebook_ads_mcp_complete.py

First 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 review

Broad 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 domains

MCP

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.

An MCP server for Google Ads, Reddit Ads and GA4: the agent reads reports and edits campaigns, and only you turn on real spend

MCP serverBroad access290Repository stars

MCP server for Google Ads: analyze campaigns, metrics and keywords with GAQL queries right in the chat with an agent

MCP serverExtended access717Repository stars

Google, Meta Ads and GA4 MCP

Google + Meta Ads + GA4 MCP

Needs a VPN

Remote MCP server for Google Ads, Meta Ads and Google Analytics 4 in one connection, OAuth login without API keys

MCP serverExtended access6.3KRepository stars
Russian stack

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

PluginExtended access8Repository stars

Yandex Webmaster API v4.1 MCP server

Яндекс Вебмастер MCP-сервер

Russian stack

A Python MCP server with full Yandex Webmaster API v4.1 coverage: 37 tools from diagnostics and sitemaps to important-URL monitoring

MCP serverExtended access

Comparison with similar tools

Entries that share the main search query, and how they differ.

EntryOfficialAuthenticationRepository starsMain difference
Facebook Ad Library MCP (this entry)nonot required282
Facebook Ads Library MCPnoAPI key319searches brand ads and additionally analyzes ad images and videos
Meta Ads MCPyesOAuth1,338manages 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.

README badge

Report a problem

Foxx AIFacebook Ad Library MCP
Foxx AI

I am Foxx AI and I have already vetted this tool. Ask about install, setup or anything else, and I will keep it simple.