meta-ads
Provides tools for retrieving Facebook Ads campaign insights (spend, impressions, reach, clicks, CTR, CPC, CPM, actions, video view rates) and fetching ad creative assets (images, copy, CTA, post link) via the Graph API.
Provides tools for retrieving Meta Ads campaign insights (spend, impressions, reach, clicks, CTR, CPC, CPM, actions, video view rates) and fetching ad creative assets (images, copy, CTA, post link) via the Graph API.
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-adswhat were my top 5 ads by spend last week?"
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
Wrap the Meta (Facebook) Ads Graph API as an MCP server for Claude (Desktop / Claude Code) to call directly, so colleagues can query ad performance and creatives through conversation.
The two APIs corresponding to the PDF spec:
Tool | Endpoint | Purpose |
|
| Fetch spend, impressions, reach, clicks, CTR/CPC/CPM, actions, video view rate, etc. |
|
| Fetch a single ad's creative (image, copy, CTA, post link) |
Two ways to run
Mode | Use case | Transport |
stdio (default) | Local / single user / development | Claude Desktop spawns a subprocess |
http | EC2 / container / company-wide | streamable-http + Bearer auth |
A. Local (stdio)
Related MCP server: Meta Ads MCP Server
Installation
cd C:\Users\bexo6\OneDrive\桌面\mcp_meta_claude
uv sync
Copy-Item .env.example .env # 然後填好 META_ACCESS_TOKEN 等Connect to Claude Desktop
Edit %APPDATA%\Claude\claude_desktop_config.json:
{
"mcpServers": {
"meta-ads": {
"command": "uv",
"args": [
"--directory",
"C:\\Users\\bexo6\\OneDrive\\桌面\\mcp_meta_claude",
"run",
"python",
"server.py"
]
}
}
}Restart Claude Desktop → Settings → Developer should show meta-ads.
B. Deploy to EC2 for company-wide use (http)
Assuming you already have EC2 + nginx + HTTPS running at
https://ai.gastom.com.tw. We won't install Caddy separately; we only run the MCP container (bound to127.0.0.1:8000), and let your existing nginx proxyhttps://ai.gastom.com.tw/meta-ads/*to it.
1. Generate a shared Bearer token
python3 -c "import secrets; print(secrets.token_urlsafe(32))"Save the string (password manager / company vault). Next:
Write it into EC2's
.envDistribute it to colleagues to fill into Claude Desktop
2. Put the code on EC2
ssh your-user@ec2-host
git clone <你的 repo 位置> meta-ads-mcp
cd meta-ads-mcp
cat > .env <<'EOF'
META_ACCESS_TOKEN=<長效 Graph API token>
META_AD_ACCOUNT_ID=act_870176260326362
MCP_BEARER_TOKEN=<上一步產生的字串>
EOF
chmod 600 .env3. Start the MCP container
docker compose up -d --build
docker compose logs -f mcp # 看到 "Uvicorn running on http://0.0.0.0:8000" 就 OKVerify from the EC2 host itself (not yet through nginx):
curl -i http://127.0.0.1:8000/healthz # 200
curl -i -X POST http://127.0.0.1:8000/mcp # 401(沒 token)4. Add a location block to nginx
Paste the contents of deploy/nginx-meta-ads.conf into your existing
server { listen 443 ssl; server_name ai.gastom.com.tw; ... } block, then:
sudo nginx -t # 語法檢查
sudo systemctl reload nginx # 套用Verify from the external network:
curl -i https://ai.gastom.com.tw/meta-ads/healthz # 200
curl -i -X POST https://ai.gastom.com.tw/meta-ads/mcp # 401
curl -i -X POST -H "Authorization: Bearer <你的token>" \
-H "Accept: application/json, text/event-stream" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"t","version":"1"}}}' \
https://ai.gastom.com.tw/meta-ads/mcp # 200 + serverInfo5. Colleagues' Claude Desktop configuration
Each colleague adds to %APPDATA%\Claude\claude_desktop_config.json (macOS: ~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"meta-ads": {
"command": "npx",
"args": [
"-y",
"mcp-remote",
"https://ai.gastom.com.tw/meta-ads/mcp",
"--header",
"Authorization: Bearer 上面產生的_MCP_BEARER_TOKEN"
]
}
}
}Colleagues' machines need Node.js (so
npxcan run).mcp-remotebridges between stdio and your HTTPS endpoint; they don't need to install Python / uv / your code.
Upgrade / update process
cd /path/to/meta-ads-mcp
git pull
docker compose up -d --buildShut down
docker compose downToken rotation
When the token leaks or needs periodic rotation:
Change
MCP_BEARER_TOKENin.envon EC2docker compose up -d(will recreate the mcp container)Distribute the new token to colleagues and update their
claude_desktop_config.json
Conversation examples
"Fetch ad data from 2026-03-23 to 2026-03-25 and list the top 3 ads by spend"
"Show me what the creative for ad ID
120228265609960545looks like"
Claude will decide on its own to call get_ad_insights first, then call get_ad_creative for the specific ad_id.
Security notes
Never commit
.env:.gitignorealready blocks it.MCP_BEARER_TOKENis the key to the company budget: anyone who gets it can call the Meta API and burn your company's ad spend. Treat it with password-level care.HTTPS is not optional: sending the Bearer token over HTTP is equivalent to plaintext transmission.
EC2 Security Group: besides 80/443 being open to the outside, restrict other ports (especially 22) to the company IP range.
This server cannot be installed
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 Connectors
Conversational access to advertising performance data, creative analysis, and campaign insights
Conversational access to advertising performance data, creative analysis, and campaign insights
Query Meta Ads performance data — accounts, campaigns, ad sets, ads, metrics & settings.
Ask AI about your ads — query Meta, TikTok, and Google Ads performance in natural language.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceWraps the Meta Marketing API to enable creating, modifying, viewing, and deleting Instagram ads via natural language.27MIT
- AlicenseNot gradedqualityDmaintenancePython MCP server that exposes Meta Marketing API data, providing tools to manage ad accounts, campaigns, and analytics through natural language interfaces.MIT
- AlicenseNot gradedqualityDmaintenanceEnables management and analysis of Meta (Facebook/Instagram) ads through natural language conversations, with 30 tools for reading and writing ad data.MIT
- AlicenseNot gradedqualityDmaintenanceEnables full read/write management of Facebook ad campaigns, ad sets, ads, and creatives via the Meta Marketing API through natural language, with AI creative generation, performance analytics, and PDF reporting.MIT
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/vitahuang629/mcp_meta_ads_claude'
If you have feedback or need assistance with the MCP directory API, please join our Discord server