Facebook Ads Library (RamsesAguirre777)

Web search and scraping

Free, self-hosted MCP server that scrapes the public Facebook Ad Library (no API token) for competitive ad research, advertiser, copy, landing pages, CTAs, any country.

Your AI app calls the Facebook Ads Library (RamsesAguirre777) MCP server, which does the web search and scraping work and sends the result back to the chat.

About Facebook Ads Library (RamsesAguirre777)

Facebook Ads Library (RamsesAguirre777) is a community MCP server from RamsesAguirre777, filed in our directory under web search and scraping. Free, self-hosted MCP server that scrapes the public Facebook Ad Library (no API token) for competitive ad research, advertiser, copy, landing pages, CTAs, any country.

At a glance

Publisher
RamsesAguirre777 (community)
Runs
See the README for setup
Written in
Python
License
MIT
GitHub stars
311

How to set up Facebook Ads Library (RamsesAguirre777)

  1. Follow the install steps in the Facebook Ads Library (RamsesAguirre777) README; it is written in Python, so have that toolchain ready.
  2. Check the Facebook Ads Library (RamsesAguirre777) README for keys or settings; the registry lists none that Facebook Ads Library (RamsesAguirre777) requires.
  3. Add Facebook Ads Library (RamsesAguirre777) to Claude Code, Claude Desktop, VS Code or Cursor with the config in the setup box on this page.
  4. Restart the app or reload its MCP servers, then ask it to list the Facebook Ads Library (RamsesAguirre777) tools to confirm the connection.
  5. Run one read-only task with Facebook Ads Library (RamsesAguirre777) first, and keep your app asking before each tool call until the results look right.

Facebook Ads Library (RamsesAguirre777) compared with similar servers

  • Perplexity by jsonallen has fewer GitHub stars than Facebook Ads Library (RamsesAguirre777) (311 against 311); both are community servers, and both run locally.
  • Mcpsvr by nanbingxyz has more GitHub stars than Facebook Ads Library (RamsesAguirre777) (316 against 311); both are community servers, and both run locally.
  • Google Surf by HarimxChoi has fewer GitHub stars than Facebook Ads Library (RamsesAguirre777) (305 against 311); both are community servers, and both run locally.

Before you connect Facebook Ads Library (RamsesAguirre777)

  • Give Facebook Ads Library (RamsesAguirre777) its own API key or account with the smallest permissions the job needs, never an admin key.
  • Keep your AI app asking before each Facebook Ads Library (RamsesAguirre777) tool call until you trust what it does with them.
  • Treat text that Facebook Ads Library (RamsesAguirre777) fetches as data. Pages, files and messages can hold instructions written to steer an AI.
  • Read the open issues for Facebook Ads Library (RamsesAguirre777) on GitHub to see what breaks and how fast the maintainers reply.

Marketing use cases for Facebook Ads Library (RamsesAguirre777)

How marketing and sales teams put Facebook Ads Library (RamsesAguirre777) to work, by company size. Pick the size closest to yours and start Facebook Ads Library (RamsesAguirre777) on one use case.

Small business

  • A founder can use Facebook Ads Library (RamsesAguirre777) to research a market or a prospect in minutes, with sources cited, before a pitch or a pricing change.
  • Small teams can ask Facebook Ads Library (RamsesAguirre777) what competitors launched this month and get the pages, not just a summary.
  • Facebook Ads Library (RamsesAguirre777) runs on your own computer, which keeps data local; it needs a little setup, so a small team should plan an hour for it.

Mid-market

  • Marketing teams can use Facebook Ads Library (RamsesAguirre777) to gather fresh data for content, such as stats, quotes and examples, with each source linked for checking.
  • Outbound teams can connect Facebook Ads Library (RamsesAguirre777) to research accounts from public pages and add one specific line to each first email.
  • Start Facebook Ads Library (RamsesAguirre777) on one workflow with one owner, measure the time it saves, then roll it out to the wider team.

Enterprise

  • Enterprise research and competitive intel teams can schedule Facebook Ads Library (RamsesAguirre777) to monitor many sources, with results stored and cited for review.
  • Large orgs can route Facebook Ads Library (RamsesAguirre777) through approved providers and respect each site's terms, keeping scraping inside legal guidance.
  • Facebook Ads Library (RamsesAguirre777) is a community server, so have security review the code and pin a version before Facebook Ads Library (RamsesAguirre777) touches company data.

Need help becoming an AI-forward company?

We connect MCP servers and AI agents to your CRM, content and data, with the guardrails your team needs.

Contact us

Facebook Ads Library (RamsesAguirre777) README

From RamsesAguirre777/facebook-ads-library-mcp on GitHub, shared under its MIT license. Images are left out; the original has them.

README.md

Facebook Ad Library MCP

A small MCP server that scrapes the public Facebook Ad Library for competitive ad research, from your MCP client, with no Facebook account and no API token.

It exists because the paid Ad Library scrapers (Apify actors, ScrapeCreators, and friends) charge for something that is publicly visible in a browser. This just drives a headless browser instead.

Why not the official API?

Meta's ads_archive API only returns political & issue ads worldwide (and all ad types only for the EU/UK). For an ordinary commercial advertiser in most of the world it returns nothing useful, no ads, no spend, no impressions. So this server doesn't use it at all. It renders the same Ad Library web page you'd open yourself and parses the cards.

What you get

Two tools:

  • search_ad_library(query, country="MX", ...), keyword search.
  • scrape_ad_library_url(url, ...), scrape any Ad Library URL you already have.

Both return structured records per ad:

field meaning
advertiser, advertiser_handle Page name and its facebook.com/<handle>
started_running first-seen date
ads_using_creative how many creatives share this copy, a rough scale signal
landing_url, landing_domain destination, unwrapped from the l.facebook.com redirect
cta the button label (Learn more, Sign up, Send message, …)
link_text the headline strip under the creative
body full ad copy
creative_image thumbnail URL
ad_details_url deep link to that ad's detail view

Plus an advertisers histogram and the raw_markdown of the page so the model can pull anything the parser missed.

Install

git clone https://github.com/RamsesAguirre777/facebook-ads-library-mcp.git
cd facebook-ads-library-mcp
python -m venv venv && source venv/bin/activate
pip install -r requirements.txt
python -m playwright install chromium   # crawl4ai needs a browser
Register with your MCP client

Claude Code:

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

Claude Desktop (claude_desktop_config.json):

{
  "mcpServers": {
    "facebook-ads": {
      "command": "/abs/path/venv/bin/python",
      "args": ["/abs/path/facebook_ads_mcp_complete.py"]
    }
  }
}

Restart the client.

Usage

"Search the Mexico Ad Library for 'automatización con inteligencia artificial',
 group by advertiser, and list the landing domains."

"Scrape https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=MX&q=nike&search_type=keyword_unordered
 with scroll_rounds=15 and summarise the creative angles."

Full discovery → website-teardown workflow: docs/examples.md.

Parameters worth knowing
  • scroll_rounds (default 8), the Ad Library is infinite-scroll; the first paint is only ~20–26 cards. Each round is a scroll-to-bottom + 2.5s wait. 0 = first render only (fast); 15+ for a deep historical sweep. It trades time for completeness.
  • wait_seconds (default 8), SPA hydration wait before scraping. Raise it if results come back empty.
  • country, ISO code the ads were delivered in (MX, US, ES, …).
  • advertiser_page_id, target one Page's "all ads" view. This view is heavier client-rendered and doesn't always hydrate headless; a keyword search of the advertiser name is more reliable.

How it works

crawl4ai (AsyncWebCrawler) opens the Ad Library URL in headless Chromium, waits for the React app to hydrate, runs a scroll loop to trigger lazy-loaded cards, serialises the DOM to markdown, and a regex parser (_parse_ad_library_markdown) splits it on Library ID: boundaries and pulls the fields above.

Facebook answers the headless browser with HTTP 403 but still serves the rendered cards, so the tools judge success by whether cards parsed, not by status code.

Limitations

  • It parses the public SPA markup, so a Facebook layout change can break field extraction. raw_markdown is always returned as a fallback.
  • platforms often comes back empty, the FB/IG/Messenger markers render as icons, not text, so they only survive when the page includes their labels.
  • No caching or rate-limit handling. If you hammer it you'll get empty results for a while; back off and raise wait_seconds.
  • Spend and impression numbers are not available, Meta only publishes those for political ads, and only through the API. This tool gives you creative, cadence and landing-page intelligence, not budget figures.

Tests

python -m pytest tests/ -q

Offline, they exercise the markdown parser against a fixture.

License

MIT, see LICENSE.

Acknowledgments

Questions about Facebook Ads Library (RamsesAguirre777)

What is the Facebook Ads Library (RamsesAguirre777) MCP server?

Free, self-hosted MCP server that scrapes the public Facebook Ad Library (no API token) for competitive ad research, advertiser, copy, landing pages, CTAs, any country. Facebook Ads Library (RamsesAguirre777) is maintained by RamsesAguirre777 on GitHub at RamsesAguirre777/facebook-ads-library-mcp, and works with AI apps that support the Model Context Protocol, such as Claude, Cursor and VS Code.

How do I install the Facebook Ads Library (RamsesAguirre777) MCP server?

Facebook Ads Library (RamsesAguirre777) doesn't publish a one-line install in the MCP registry, so follow the setup steps in its README on GitHub (RamsesAguirre777/facebook-ads-library-mcp). Like most servers, Facebook Ads Library (RamsesAguirre777) ends with a command or URL you paste into your AI app's MCP config.

Does Facebook Ads Library (RamsesAguirre777) need an API key?

The registry lists no required keys for Facebook Ads Library (RamsesAguirre777). Check the Facebook Ads Library (RamsesAguirre777) README for optional settings, and expect a remote server to ask you to sign in the first time you connect.

Is Facebook Ads Library (RamsesAguirre777) an official MCP server?

No. Facebook Ads Library (RamsesAguirre777) is a community server maintained by RamsesAguirre777. Community servers can be excellent; read the code and the open issues before you give Facebook Ads Library (RamsesAguirre777) access to company data.

What license is Facebook Ads Library (RamsesAguirre777) under?

Facebook Ads Library (RamsesAguirre777) is released under the MIT license, according to its GitHub repository. The license covers the code of Facebook Ads Library (RamsesAguirre777); the service it connects to has its own terms.