Meta Ads MCP
Allows interacting with Facebook Pages, posts, insights, and comment moderation, as well as Facebook ads through the Meta Marketing API.
Provides tools for Instagram media management, publishing, insights, and comment moderation.
Provides tools for managing Meta ad accounts, campaigns, ad sets, ads, insights, billing, audiences, catalogs, leads, and more via the Meta Marketing API.
Provides tools for WhatsApp Business account management, phone numbers, message templates, and sending messages.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Meta Ads MCPList my Meta ad accounts."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Meta Ads MCP
An MCP server for the Meta Marketing API — built for people running real ad spend.
118 typed tools across Ads, Insights, Pixels/CAPI, Pages, Instagram, WhatsApp Business, Catalogs, Audiences, Leads and Billing — with the token kept out of your config files and a confirmation gate on every destructive call.
Why this one
There are several Meta Ads MCP servers out there. This one is built around a specific assumption: the person using it is spending real money, possibly on behalf of clients, and a mis-fired tool call costs more than an apology.
That shapes three decisions the code makes differently:
How most setups do it | How this one does it | |
Token storage | Pasted into a JSON config or | OS credential store first (Windows Credential Manager / macOS Keychain via |
Destructive calls | The model calls |
|
Errors | Meta's opaque | Decoded into a message that says what to actually do |
Plus a global MCP_READ_ONLY kill switch — useful when the server is reachable from a phone.
Related MCP server: ads-mcp
Quick start
Requirements: Python 3.11+, a Meta System User token, and an MCP client (Claude Code, Claude Desktop, Cursor…).
git clone https://github.com/AbnerZx/meta-ads-mcp.git
cd meta-ads-mcp
powershell -ExecutionPolicy Bypass -File .\install.ps1The installer checks your Python, creates .venv, installs dependencies, prompts for your token (masked input, stored in Credential Manager, never written to disk), and prints the exact registration command to run next.
git clone https://github.com/AbnerZx/meta-ads-mcp.git
cd meta-ads-mcp
python3 -m venv .venv && source .venv/bin/activate
pip install -e .
python -m keyring set meta-ads-mcp access_token # paste token when promptedThen register it with your client:
claude mcp add meta-ads --scope user -- /path/to/.venv/bin/python /path/to/src/server.pyRestart the client. Tools appear as mcp__meta-ads__*.
Verify it works — ask your assistant:
"List my Meta ad accounts."
What's in it
118 tools across 12 modules:
Module | Tools | What it covers |
| 29 | Campaigns, ad sets, ads — create, update, duplicate, pause, activate, delete, schedules, previews |
| 12 | Product catalogs, feeds, product sets, diagnostics |
| 12 | Media, insights, publishing (image/video), comment moderation |
| 11 | Posts, insights, publishing, comment moderation |
| 10 | Link & carousel creatives, image/video upload, previews |
| 9 | Business accounts, phone numbers, message templates, sending |
| 8 | Custom & saved audiences, applying them to ad sets |
| 7 | Pixel management, stats, sharing, Conversions API events |
| 6 | Reports, period comparison, async report lifecycle |
| 6 | Spend, limits, funding source, invoices, cross-account summary |
| 5 | Lead forms and lead retrieval |
| 3 |
|
graph_callmatters more than it looks. The Meta Marketing API is enormous and changes often. Rather than pretend 118 tools cover it, there's a typed escape hatch for any endpoint that isn't wrapped yet — so you're never blocked waiting on this repo.
Conventions
Worth knowing before your first call:
Ad account IDs are auto-prefixed with
act_— pass123456oract_123456, both work.Budgets are integers in account-currency cents.
R$ 10,00→1000. This is Meta's convention, not ours.Destructive ops need
confirm=True. Without it you get a blocked-operation error naming the target.The token never travels through tool arguments. It's loaded once at startup from the credential store.
Security model
The threats this is designed against, and what handles each:
Asset | Risk if exposed | Control |
Meta access token | Full control of every ad account the token can reach | OS credential store (encrypted at rest); never logged, never serialized, never returned by a tool |
Server logs | Token leaking through a stack trace | Regex scrubbing in |
Docker image | Secrets baked into build layers |
|
Public endpoint | Brute force, DNS rebinding | Bearer auth with constant-time compare, global rate limit, |
Destructive calls | A campaign paused or deleted by mistake |
|
CAPI payloads | PII sent in the clear | SHA-256 hashing applied client-side before transmission |
Found a vulnerability? See SECURITY.md — please don't open a public issue.
Getting a token
Use a System User token, not a personal one. It doesn't expire, it's revocable independently of your own account, and Meta gives you a per-user audit trail.
Business Manager → Business settings → Users → System users → Add → assign only the ad accounts and Pages you actually need → Generate new token.
Typical scopes: ads_management, ads_read, business_management, read_insights. Add pages_*, instagram_*, leads_retrieval, whatsapp_business_* or catalog_management only if you use those modules. Meta shows the token exactly once.
Configuration
All optional except the token. See .env.example.
Variable | Default | Purpose |
| — | Token, if you're not using the credential store |
| — | Fallback Business Manager ID |
|
| Graph API version |
|
| Read timeout, seconds — Meta's validation paths can sit 20–40s |
|
| Local rate limiter |
|
|
|
| — | Host allowlist — required for public HTTP deploys |
|
| Per-minute cap on the HTTP transport |
Remote deployment
The server speaks two transports: stdio for local clients, streamable-http for remote ones. The HTTP mode lets you reach your ad accounts from Claude.ai on mobile via a Custom Connector.
→ Full deployment guide (DEPLOY.md) — Fly.io walkthrough, bearer secret generation, secret rotation, and an incident-response checklist.
Short version:
fly launch --no-deploy --copy-config # edit fly.toml first: app name + MCP_PUBLIC_HOSTS
fly secrets set MCP_BEARER_SECRET="..." META_ADS_TOKEN="..."
fly deployfly.toml ships with MCP_READ_ONLY = 'true'. Leave it that way until you've confirmed the deployment works.
Project layout
src/
├── server.py # stdio entrypoint
├── http_server.py # streamable-http transport, bearer auth, rate limiting
├── mcp_instance.py # shared FastMCP instance + transport security
├── client.py # Graph API client — retries, backoff, log scrubbing
├── auth.py # token loading (credential store → env fallback)
├── safety.py # confirmation gate, ID normalization, input validation
└── tools/ # 12 modules, 118 toolsContributing
Issues and pull requests are welcome — see CONTRIBUTING.md. Especially useful: Graph API error subcodes you've hit that aren't decoded yet, and coverage gaps you're currently working around with graph_call.
License
MIT © Abner Ferreira
Not affiliated with or endorsed by Meta Platforms, Inc. "Meta", "Facebook", "Instagram" and "WhatsApp" are trademarks of Meta Platforms, Inc.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseBqualityDmaintenanceMCP server for Meta Marketing API v25.0 — 123 tools for Facebook & Instagram ad campaign managementLast updated10045261MIT
- Alicense-qualityCmaintenanceUnified MCP server for managing Meta Ads, LinkedIn Ads, Google Ads, GA4, and Search Console with 89 read/write tools, multi-account support, OAuth setup, and safe dry-run mutations.Last updatedMIT
- Flicense-qualityDmaintenanceMCP server that wraps the Meta Marketing API (Graph API v25.0) as semantic tools for LLM agents.Last updated1
- Flicense-qualityDmaintenanceA comprehensive MCP server for managing and analyzing Meta Ads (Facebook/Instagram) with over 80 natural-language tools for AI agents like Claude Desktop.Last updated
Related MCP Connectors
34 production API tools over one hosted MCP endpoint.
60+ Meta Ads tools for AI agents: audits, campaign management, audiences and CAPI tracking.
Hosted MCP with 91 agent tools: X, domains, SEO, Maps, Trends, Search, YouTube, TikTok, and more.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/AbnerZx/meta-ads-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server