meta-ads-mcp
Provides tools for managing Meta Ads accounts, campaigns, adsets, ads, custom audiences, and lead forms, along with performance reporting and A/B testing.
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-mcpget campaign performance for the last 30 days"
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 Server
A Model Context Protocol (MCP) server built with Python and fastmcp to integrate Meta Ads (Facebook Ads) Graph API directly with AI coding assistants (like Antigravity and Claude Desktop).
This server maps Meta Ads API calls directly to easy-to-use, semantic tools for account discovery, campaign/adset/ad creation, custom audiences, status updates, campaign performance queries, placement breakdowns, demographic breakdowns, video retention analysis, and statistical A/B significance testing.
๐ Table of Contents
Related MCP server: meta-ads-mcp
๐ ๏ธ Features & Tool Directory
The server exposes 21 semantic tools categorized into 5 main groups:
1. Account Discovery
list_accounts: Lists all accessible Facebook ad accounts including IDs, names, statuses, currencies, and total spent.
2. Performance Reporting (Level-specific & Segmented)
All reporting tools support outputting results as a Markdown Table (default), CSV, or raw JSON.
get_campaign_performance: Fetch campaign-level insights (impressions, clicks, CTR, spend, CPC, conversions, conversion values).get_adset_performance: Fetch adset-level performance details.get_ad_performance: Fetch ad-level performance and creative insights.get_device_performance: Segment campaign performance by device platform (mobile, desktop, etc.).get_geo_performance: Segment campaign performance by country.get_placement_performance: Segment performance by publisher platform (Facebook/Instagram), placement position (Feeds/Stories), and device platform.get_demographic_performance: Segment campaign performance by age and gender demographics.get_video_performance: Fetch detailed video-specific plays, average watch time, and watched retention milestones (25%, 50%, 75%, 95%, 100% video completions).get_creative_report: Merges ad creative details (title, body, text copy, image thumbnail) with performance metrics.
3. Audiences & Forms Management
list_custom_audiences: List remarketing lists, customer list audiences, and website pixel audiences.create_lead_form: Create Meta Lead Generation Instant Forms on a Facebook Page.
4. Advanced Analytics & A/B Testing
analyze_cross_campaign_performance: Runs cross-campaign health checks, details best/worst performing campaigns, and suggests concrete budget reallocation or creative refresh strategies.analyze_ab_test: Conducts statistical z-score calculations comparing CTR, CVR, and CPA between two campaigns (control vs variation) and indicates statistical significance (90%, 95%, 99% confidence levels).
5. Campaign & Creative Creations
create_campaign: Create new campaigns (supports objectives likeOUTCOME_TRAFFIC,OUTCOME_SALES,OUTCOME_LEADS,OUTCOME_AWARENESS,OUTCOME_ENGAGEMENT,OUTCOME_APP_PROMOTION).create_adset: Create adsets containing schedules, optimization goals, targeting specs, and budgets.create_ad_creative: Prepare ad creative layouts linked to a page.create_ad: Spin up ads under your adsets with your creatives.
6. Status Mutation
update_campaign_status: Activate (ACTIVE) or pause (PAUSED) campaigns.update_adset_status: Activate or pause adsets.update_ad_status: Activate or pause ads.
๐ Step 1: Prerequisites & Credentials
To use the Meta Ads MCP Server, you need to obtain credentials from the Meta Developer platform.
1.1 Generate a Facebook Access Token
Go to the Meta for Developers Portal.
Create a new App (choose Business or Other depending on your business requirements).
Set up the Marketing API product inside the app dashboard.
Navigate to Marketing API -> Tools.
Select the required permissions:
ads_readads_managementbusiness_management
Click Generate Token and copy the access token.
1.2 Locate Ad Account ID
Navigate to your Meta Ads Manager.
In the account dropdown, copy the 15-digit Ad Account ID (e.g.
123456789012345).
๐ป Step 2: Local Installation
Navigate to the project directory:
cd C:\Users\prala\.gemini\antigravity-ide\scratch\meta-ads-mcpCreate a virtual environment:
python -m venv venvInstall required packages:
.\venv\Scripts\pip install -r requirements.txtCreate your
.envcredentials file by creating a file named.envin the root of the project directory with the following contents:# Meta Graph API Credentials META_ADS_ACCESS_TOKEN=EACJye51NVHcBO6... (your token) META_ADS_AD_ACCOUNT_ID=act_1234567890... (your ad account ID, optional)
โ๏ธ Step 3: Registering with Antigravity IDE
To integrate the Meta Ads MCP Server directly with your Google Antigravity IDE assistant:
Ensure your
.envfile is populated with your active Meta credentials.Execute the registration script inside your virtual environment:
.\venv\Scripts\python configure_antigravity_mcp.pyThis script will read credentials from
.envand configure them inside the Antigravity global configuration file (C:\Users\prala\.gemini\config\mcp_config.json).Restart your Antigravity IDE (or rebuild your agent connections) to load the new server. You will see 21 tools prefixed with
mcp_meta-ads_*registered.
โ๏ธ Step 4: Registering with Claude Desktop
To use the connector locally with your Claude Desktop client:
Execute the local registration script:
.\venv\Scripts\python configure_local_mcp.pyThe script will write your local
.envand automatically add themeta-adsserver block into your Claude Desktop configuration file (%APPDATA%\Claude\claude_desktop_config.json).Restart your Claude Desktop App to apply the configuration.
๐งช Step 5: Verifying the Connection
You can verify that the server is functional and authenticating correctly with the Meta API:
5.1 Run the Automated Test Client
Run the verification script to confirm all 21 tools are successfully registered in FastMCP:
.\venv\Scripts\python test_client.pyExpected Output:
Importing Meta Ads MCP Server...
Successfully loaded MCP Server!
Server Name: Meta Ads MCP Server
Checking registered MCP tools:
1. Tool name: list_accounts
Description: List all Meta Ad Accounts accessible...
...
21. Tool name: analyze_ab_test
Description: Perform a statistical A/B test analysis...
Total Tools Registered: 21
Dry-run validation PASSED: Server script compiles and registers all endpoints successfully.5.2 Test Active Account Fetching
Verify that your access token is valid and can retrieve real data:
.\venv\Scripts\python -c "import server; print(server.list_accounts())"This should print a JSON array listing all your active ad accounts, their status codes, and currency configurations.
๐ค Step 6: Pushing to GitHub
To push the codebase and documentations to your remote GitHub repository:
Go to your GitHub account (
pralayasimha23).Create a new public/private repository named
meta-ads-mcp.Run the automated Git push script:
.\venv\Scripts\python push_to_github.py
This script will initialize Git, commit all code, configure the remote origin, and push the repository to https://github.com/pralayasimha23/meta-ads-mcp.git.
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
- Alicense-qualityDmaintenanceAn MCP server for programmatic management of Meta (Facebook/Instagram) advertising campaigns through AI assistants. It enables campaign creation, ad set management, creative upload, analytics, audience management, and conversion tracking.1994MIT
- AlicenseAqualityDmaintenanceMCP server to manage Meta Ads (Facebook/Instagram) campaigns, ad sets, insights, and audiences from Claude Code using natural language.910MIT
- Alicense-qualityDmaintenanceMCP server for Meta/Facebook Marketing API allowing you to view and manage ad accounts, campaigns, ad sets, ads, and creatives, as well as fetch insights and upload ad images.MIT
- Alicense-qualityDmaintenanceMCP server for Meta Ads providing 30 tools for account discovery, campaign management, targeting research, and insights. Designed with LLM-friendly outputs and productivity features like cloning and bulk operations.1MIT
Related MCP Connectors
Search Meta, Google Ads, LinkedIn, and TikTok ad libraries plus creative analysis via MCP.
Hosted Amazon Seller Central and Amazon Ads MCP server for Claude, ChatGPT, Cursor, and agents.
Managed LinkedIn MCP server for AI agents: search, connect, message and enrich on accounts you own.
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/pralayasimha23/meta-ads-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server