mcp
v0.5.2MCP server for the adlibrary.com ad-intelligence API (Meta, Instagram, Google ATC, LinkedIn)
MCP (Model Context Protocol) server for the adlibrary.com ad-intelligence API. Gives Claude Desktop, Cursor, or any MCP client tools to research ads across Meta (Facebook/Instagram), Google Ads Transparency Center, LinkedIn: search creatives, resolve brands to advertiser IDs, scan advertisers for winning ads, size ad markets, and AI-analyze single ads. Add this to your claude_desktop_config.json (Claude Desktop → Settings → Developer → Edit Config): Restart Claude Desktop. You should see the adlibrary tools in the tools menu.
Summary extracted from the README.
adlibrary
MCP (Model Context Protocol) server for the adlibrary.com ad-intelligence API. Gives Claude Desktop, Cursor, or any MCP client tools to research ads across Meta (Facebook/Instagram), Google Ads Transparency Center, LinkedIn: search creatives, resolve brands to advertiser IDs, scan advertisers for winning ads, size ad markets, and AI-analyze single ads.
Requirements
- An adlibrary.com Business subscription and an API key (format
adl_...). Create one at adlibrary.com/api-access. - Node.js 18 or newer.
Setup — Claude Desktop
Add this to your claude_desktop_config.json (Claude Desktop → Settings → Developer → Edit Config):
{
"mcpServers": {
"adlibrary": {
"command": "npx",
"args": ["-y", "@adlibrary/mcp"],
"env": {
"ADLIBRARY_API_KEY": "adl_your_key_here"
}
}
}
}
Restart Claude Desktop. You should see the adlibrary tools in the tools menu.
Setup — Cursor / other MCP clients
Any MCP client that supports stdio servers works with the same command (npx -y @adlibrary/mcp) and the ADLIBRARY_API_KEY environment variable. In Cursor: Settings → MCP → Add new MCP server, command type stdio.
Tools
Free tools cost no credits; paid tools state their cost. The server's tool descriptions steer the model to run the free probes before spending credits.
| Tool | Cost | What it does |
|---|---|---|
count_ads |
free | Market sizing: total number of ads matching filters, no results returned. Run before search_ads. |
resolve_brand |
free | Brand name → advertiser IDs on Meta (page id), Google ATC (AR… id) and LinkedIn (company id). |
find_advertiser_pages |
free | Find Meta advertiser pages (page_id, ad_count, verification) — required probe before scan_winners. |
get_ad_detail |
free | Full metadata for one ad: copy, media, CTA, runtime, impressions, Meta audience breakdown. |
update_saved_advertiser |
free | Rename a brand you created; platform ids you pass become proposals. |
list_saved_advertisers / save_advertiser / delete_saved_advertiser |
free | Deprecated aliases of list_followed_brands / follow_brand / unfollow_brand. |
search_ads |
1 credit/call | Multi-platform ad search with 25+ filters (media type, geo, run time, engagement, CTA, sort). Each page costs 1 credit. |
get_advertiser_ads |
1 credit / 30-min session | Pull a saved brand's ads across Meta + Google + LinkedIn; pagination within 30 minutes is free. |
analyze_ad |
1+ credit | AI (Gemini) creative analysis of one ad: analysis, summary, scene-marked transcription. Long videos cost more. |
scan_winners |
10 credits | Scan an advertiser's full Meta portfolio and detect winning ads (winner/loser tiers, composite scores, creative DNA diffs). |
Brand tracking (beta, free during beta)
Follow a brand once and adlibrary crawls its ads daily on Meta, Google and LinkedIn, keeps the history, scores winners and answers questions about it.
| Tool | What it does |
|---|---|
follow_brand |
Follow a brand by name + platform ids, or by pasting an Ad Library link / id (source); the link is mapped to the right platform id. |
list_followed_brands |
The brands you follow with ids, active ads, crawl state and new_count. |
unfollow_brand |
Stop following. The brand and its history stay for other followers. |
get_brand_profile |
Description, category, similar brands, stats, top links, sources per platform, open proposals. |
get_brand_insights |
Totals, day/week/month series (active, new, ended, reach, est. spend, est. CPM), per-platform stats, targeting rollup. |
get_brand_ads |
Page through the brand's ads from the tracker: status all/active/inactive/new, platform, inferred set, sort. |
get_brand_sets |
Inferred ad sets (same account + launch day + landing page) with reach and estimated spend per day. |
get_brand_winners |
Current winners folded by concept with facts, reasons, the winning-formula breakdown, variants, "what wins" themes and look-alike matches. |
search_ads_by_meaning |
Semantic search over tracked ads: plain-words query, optional brand or winners-only scope, angle/format/stage/lever filters. Pro/Business plan. |
get_feed |
Newest ads across all followed brands, keyset-paged, newOnly for "since my last visit". |
get_notifications |
Per-brand new/stopped ad counts since your last visit. |
get_brand_report |
The PDF report link plus the exact curl (MCP results are text, so the PDF is not embedded). |
Reach and spend cover what the platforms disclose (Meta discloses EU reach). Spend and CPM are our estimates in USD.
Library & sharing (free)
The user's saved-ads library (same as the web app), its folders, and public share links.
| Tool | What it does |
|---|---|
save_ads_to_library |
Save ad objects from search/detail results, optionally into folders (else "General"). Returns entry_id per ad. |
list_library_ads |
Saved ads, all or one folder, paginated (max 100 per page). |
move_library_ads |
Set the folder list of saved ads (replaces it). |
remove_library_ads |
Delete saved ads from the library. |
list_folders / create_folder / rename_folder / delete_folder |
Manage folders. Deleting moves its ads to "General"; "General" can't be deleted. |
create_share_link |
Public link to a folder or swipe file (live) or up to 15 ads (snapshot). 50 new links/hour. |
list_share_links / revoke_share_link |
List your links; revoke one (URL stops working at once). |
Swipe files
The user's canvas boards (same as the web app). Changes show up live if the board is open.
| Tool | Cost | What it does |
|---|---|---|
list_swipefiles |
free | Your swipe files: id, name, folder, version, dates. |
create_swipefile |
free | New empty swipe file (optional name, folder). Max 500 per user. |
get_swipefile |
free | Items on the board: id, kind, position/size, text, ad_key, advertiser, url. Landing HTML omitted. |
add_to_swipefile |
free | Add ads (by ad_key), notes, text, landing pages, screenshots, images, arrows. Use ref to place or connect items in one call. 25 items per call, 3 screenshots + 3 landings per call. Partial success. |
update_swipefile_items |
free | Move, resize, recolor or edit text of items. Max 200 per call. |
remove_swipefile_items |
free | Delete items (and their arrows). The user can't undo it. |
rename_swipefile |
free | Change name and/or folder. |
analyze_swipefile |
1 credit/message | AI analysis of the board (ads, transcripts, notes, landing titles, up to 6 images); can add sticky notes. Pass history for follow-ups. |
Search workers (beta, Business plan)
Saved searches adlibrary re-runs daily or weekly (time of day picked by the platform). Include/exclude rules filter results, and only ads new since earlier runs are delivered by email and/or signed webhook, with an optional AI brief.
Cost per run: pages × (1 + floor(keywords/5)) credits (1-4 keywords = 1 per page, 5-9 = 2, …). The brief adds 1 + floor(keywords/5). Empty runs still cost; failed searches are refunded.
| Tool | Cost | What it does |
|---|---|---|
estimate_worker_cost |
free | Credits per run and per month for a keywords/pages/brief setup. |
create_worker |
per run | Create a worker: keywords, search filters, rules, pages, schedule, email/webhook, brief. Webhook secret shown once. |
list_workers / get_worker |
free | Workers with settings, cost per run, last run. |
update_worker |
free | Partial update; status: paused stops runs and charges. |
delete_worker |
free | Delete a worker. |
run_worker |
per run | Run now in the background; returns run_id immediately. |
get_worker_runs |
free | Recent runs with stats, or one run (runId) with its new ads and brief. |
Limits worth knowing
search_ads: max 60 results per page (upstream hard limit), max page 100, rate limit 100 calls/min and 10,000/day per key, e-commerce ads only for API keys, LinkedIn caps at 25 results.scan_winners: one concurrent scan per user; takes 1–5 minutes; auto-refunds on no-ads/upstream errors — but a valid-but-wrong page_id still charges, so confirm the page withfind_advertiser_pagesfirst.- Impressions and spend figures are ranges/estimates, never exact disclosures.
- All charges bill the team owner's credit balance.
Environment variables
| Variable | Required | Description |
|---|---|---|
ADLIBRARY_API_KEY |
yes | Your adl_... API key from adlibrary.com/api-access |
ADLIBRARY_BASE_URL |
no | Override the API base URL (default https://adlibrary.com) |
Development
npm install
npm run build # tsc → dist/
node dist/index.js # run over stdio (needs ADLIBRARY_API_KEY)
node test/live.mjs # live end-to-end test against the real API (spends ~2 credits)
ADLIBRARY_BASE_URL=http://localhost:3002 ADLIBRARY_API_KEY=adl_... node test/live-brands.mjs # brand tracking tools, free
License
MIT
Connect to Claude Desktop
- Open the config file (create it if missing):
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
- macOS:
- Add the server (get a Business-tier key from adlibrary.com → Settings → API):
{ "mcpServers": { "adlibrary": { "command": "npx", "args": ["-y", "@adlibrary/mcp"], "env": { "ADLIBRARY_API_KEY": "adl_your_key_here" } } } } - Restart Claude Desktop. The adlibrary tools appear under the tools (hammer) icon.
Requires Node.js ≥ 18.
Remote server (Custom Connector — no install for users)
Run one container; users add it in Claude via Settings → Connectors → Add custom connector by pasting a URL — no Node, no config file.
Deploy (Docker):
docker build -t adlibrary-mcp .
docker run -d -p 8080:8080 --restart unless-stopped adlibrary-mcp
Put it behind a TLS reverse proxy (Traefik/Caddy) at e.g. https://mcp.adlibrary.com. It's a thin passthrough to the adlibrary.com API — negligible load, stateless, scales to any number of users on one instance.
User setup: paste this as the Remote MCP Server URL (the API key is the last path segment):
https://mcp.adlibrary.com/adl_yourkey
GET /health returns {"status":"ok"} for orchestrators. The key never persists server-side — it's read from the URL per request and forwarded as the API Bearer token.