agentleFS
thenavidmthenavidm/facebook-ad-library-mcp-cli/AGENTS.md

facebook-ad-library-mcp-cli

AGENTS.md3 starsChanged 56 days agoMITView on GitHub

For agents editing this repo. Users read README.md; models driving the server read SKILL.md. An MCP server that reads Meta's public Ad Library. TypeScript, Node 22+, ESM, on Slipway, published as @thenavidm/facebook-ad-library-mcp-cli. Every tool is read-only. There is no write path, so there is no confirm gating and no audit log, unlike the other servers in this family. Do not add one "for consistency": the safety model here is that the server cannot act at all. The Ad Library is…

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 1

    1. thenavidm/facebook-ad-library-mcp★ 3100% same

    Edited · 0

    None found.

    Wrote their own version · 0

    None found.

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.

    Of the AGENTS.md files we read, the 33,398 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repository2 other files it gives its agents.

The file

We split this AGENTS.md into the rules it gives an agent

2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Every tool is read-only. There is no write path, so there is no confirm gating and no audit log, unlike the other servers in this family.

    line 9
  2. Distinctive:

    No em dashes. Short paragraphs.

    line 71

≈ “Common” is an estimate: at least 1 in 5 of the 43,423 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

Working on this repo

For agents editing this repo. Users read README.md; models driving the server read SKILL.md.

What this is

An MCP server that reads Meta's public Ad Library. TypeScript, Node 22+, ESM, on Slipway, published as @thenavidm/facebook-ad-library-mcp-cli.

Every tool is read-only. There is no write path, so there is no confirm gating and no audit log, unlike the other servers in this family. Do not add one "for consistency": the safety model here is that the server cannot act at all.

The one idea the whole repo rests on

The Ad Library is a React app that receives ads from Meta as structured JSON. Most scrapers render that JSON to a DOM, flatten it to markdown, and regex the fields back out, which loses most of each ad.

We read the JSON. src/backends/browser.ts attaches a response listener and keeps the payload the page was already given.

Meta serves it from two places, and both are needed:

  1. The first page is inlined in the document inside a <script type="application/json"> block, with no network call at all.
  2. Later pages arrive as GraphQL responses triggered by scrolling.

Reading only the second is why the first search intermittently returned nothing. If ads stop coming back, check that both sources are still being read before assuming a rate limit.

Where things are

PathHolds
src/adlibrary/harvest.tsfinding ad cards in any payload, by shape not by path
src/adlibrary/normalize.tsevery source's payload into one Ad
src/adlibrary/url.tsthe Ad Library URL builder, shared by browser and Apify
src/backends/the three backends behind one interface
src/format/ads.tsshaping ads for a model: compact in lists, complete in detail
src/store/snapshots.tsJSON snapshots, only for diff_advertiser
src/tools/one module per group; kit.ts adapts them to Slipway, maps provider errors to exit codes, and closes the browser after a CLI call
src/app.tsthe Slipway app: tools, settings, resources, prompts, doctor. Slipway owns MCP, the CLI, --http and annotations

Rules specific to this repo

Never hardcode a path into Meta's payload. harvest.ts walks for shape: an object with edges and page_info is a connection, one with ad_archive_id is an ad. Meta has moved that path before and will again. A test pins this.

Creatives live in three disjoint keys. images for IMAGE ads, videos for VIDEO, cards for DCO, DPA and CAROUSEL. Reading only one is the most common bug in this domain. Tests cover all three.

Never invent spend or reach. Those fields are null outside the EU and outside political ads, and that is the correct answer. Do not add an estimator, do not infer a range from days_active.

Longevity is a hypothesis, never a measurement. The instructions, the SKILL.md and the prompts all say this. Keep it that way in anything new.

Pin nothing from memory. The Graph API version, the SDK version, the action versions and the provider endpoints were each verified by a live probe. Re-probe rather than recall:

npm view @thenavidm/slipway version
curl -s "https://graph.facebook.com/v26.0/ads_archive?ad_reached_countries=%5B%22DE%22%5D"
curl -sL https://api.github.com/repos/actions/checkout/releases/latest | grep tag_name

A valid Graph version answers with error code 1; an unsupported one answers 100.

Testing

npm test          # vitest, fixtures only, no network
npm run typecheck
npm run build

Tests never touch the network. The fixture in tests/fixtures/ is a real trimmed Meta response covering all three creative shapes.

Unit tests are not enough for a change to the browser backend. Run a real client handshake against a live search before claiming it works.

Writing

No em dashes. Short paragraphs. Comments explain why, not what. Never name another repo or maintainer as a comparison.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.