Meta Ads Integration
STDIOMCP server for interacting with Meta Ads API, enabling AI models to manage campaigns.
MCP server for interacting with Meta Ads API, enabling AI models to manage campaigns.
A Model Context Protocol (MCP) server for interacting with Meta Ads API. This tool enables AI models to access, analyze, and manage Meta advertising campaigns through a standardized interface, allowing LLMs to retrieve performance data, visualize ad creatives, and provide strategic insights for Facebook, Instagram, and other Meta platforms.
DISCLAIMER: This is an unofficial third-party tool and is not associated with, endorsed by, or affiliated with Meta in any way. This project is maintained independently and uses Meta's public APIs according to their terms of service. Meta, Facebook, Instagram, and other Meta brand names are trademarks of their respective owners.
"mcpServers": { "meta-ads": { "command": "uvx", "args": ["meta-ads-mcp"], "env": { "PIPEBOARD_API_TOKEN": "your_pipeboard_token" // Get your token at https://pipeboard.co/api-tokens } } }
That's it! You can now use Meta Ads MCP in your favorite MCP client.
Note: If you prefer to use your own Meta Developer App instead of Pipeboard authentication, see CUSTOM_META_APP.md for instructions.
If you're contributing to the project or need to run it directly:
# From the repository root uv pip install -e .
The Meta Ads MCP follows security best practices:
Tokens are cached in a platform-specific secure location:
%APPDATA%\meta-ads-mcp\token_cache.json
~/Library/Application Support/meta-ads-mcp/token_cache.json
~/.config/meta-ads-mcp/token_cache.json
You do not need to provide your access token for each command; it will be automatically retrieved from the cache.
When using the Meta Ads MCP with an LLM interface (like Claude):
mcp_meta_ads_get_ad_accounts
mcp_meta_ads_get_account_info
If you encounter authentication issues:
Verify your Pipeboard setup:
PIPEBOARD_API_TOKEN
is set correctlypython test_pipeboard_auth.py --force-login
When using the LLM interface:
If you receive errors from the Meta API:
Log files are stored in a platform-specific location:
~/Library/Application Support/meta-ads-mcp/meta_ads_debug.log
%APPDATA%\meta-ads-mcp\meta_ads_debug.log
~/.config/meta-ads-mcp/meta_ads_debug.log
The easiest way to use Meta Ads MCP is with Pipeboard authentication:
export PIPEBOARD_API_TOKEN=your_pipeboard_token
Add this to your claude_desktop_config.json
to integrate with Claude or ~/.cursor/mcp.json
to integrate with Cursor:
"mcpServers": { "meta-ads": { "command": "uvx", "args": ["meta-ads-mcp"], "env": { "PIPEBOARD_API_TOKEN": "your_pipeboard_token" // Get your token at https://pipeboard.co } } }
Meta Ads MCP uses stdio transport by default, which works with MCP clients like Claude Desktop and Cursor. For web applications and direct HTTP API access, see STREAMABLE_HTTP_SETUP.md for streamable HTTP transport configuration.
mcp_meta_ads_get_ad_accounts
access_token
(optional): Meta API access token (will use cached token if not provided)user_id
: Meta user ID or "me" for the current userlimit
: Maximum number of accounts to return (default: 10)mcp_meta_ads_get_account_info
access_token
(optional): Meta API access token (will use cached token if not provided)account_id
: Meta Ads account ID (format: act_XXXXXXXXX)mcp_meta_ads_get_account_pages
access_token
(optional): Meta API access token (will use cached token if not provided)account_id
: Meta Ads account ID (format: act_XXXXXXXXX) or "me" for the current user's pagesmcp_meta_ads_get_campaigns
access_token
(optional): Meta API access token (will use cached token if not provided)account_id
: Meta Ads account ID (format: act_XXXXXXXXX)limit
: Maximum number of campaigns to return (default: 10)status_filter
: Filter by status (empty for all, or 'ACTIVE', 'PAUSED', etc.)mcp_meta_ads_get_campaign_details
access_token
(optional): Meta API access token (will use cached token if not provided)campaign_id
: Meta Ads campaign IDmcp_meta_ads_create_campaign
access_token
(optional): Meta API access token (will use cached token if not provided)account_id
: Meta Ads account ID (format: act_XXXXXXXXX)name
: Campaign nameobjective
: Campaign objective (AWARENESS, TRAFFIC, ENGAGEMENT, etc.)status
: Initial campaign status (default: PAUSED)special_ad_categories
: List of special ad categories if applicabledaily_budget
: Daily budget in account currency (in cents)lifetime_budget
: Lifetime budget in account currency (in cents)mcp_meta_ads_get_adsets
access_token
(optional): Meta API access token (will use cached token if not provided)account_id
: Meta Ads account ID (format: act_XXXXXXXXX)limit
: Maximum number of ad sets to return (default: 10)campaign_id
: Optional campaign ID to filter bymcp_meta_ads_get_adset_details
access_token
(optional): Meta API access token (will use cached token if not provided)adset_id
: Meta Ads ad set IDmcp_meta_ads_create_adset
account_id
: Meta Ads account ID (format: act_XXXXXXXXX)campaign_id
: Meta Ads campaign ID this ad set belongs toname
: Ad set namestatus
: Initial ad set status (default: PAUSED)daily_budget
: Daily budget in account currency (in cents) as a stringlifetime_budget
: Lifetime budget in account currency (in cents) as a stringtargeting
: Targeting specifications (e.g., age, location, interests)optimization_goal
: Conversion optimization goal (e.g., 'LINK_CLICKS')billing_event
: How you're charged (e.g., 'IMPRESSIONS')bid_amount
: Bid amount in account currency (in cents)bid_strategy
: Bid strategy (e.g., 'LOWEST_COST')start_time
, end_time
: Optional start/end times (ISO 8601)access_token
(optional): Meta API access tokenmcp_meta_ads_get_ads
access_token
(optional): Meta API access token (will use cached token if not provided)account_id
: Meta Ads account ID (format: act_XXXXXXXXX)limit
: Maximum number of ads to return (default: 10)campaign_id
: Optional campaign ID to filter byadset_id
: Optional ad set ID to filter bymcp_meta_ads_create_ad
account_id
: Meta Ads account ID (format: act_XXXXXXXXX)name
: Ad nameadset_id
: Ad set ID where this ad will be placedcreative_id
: ID of an existing creative to usestatus
: Initial ad status (default: PAUSED)bid_amount
: Optional bid amount (in cents)tracking_specs
: Optional tracking specificationsaccess_token
(optional): Meta API access tokenmcp_meta_ads_get_ad_details
access_token
(optional): Meta API access token (will use cached token if not provided)ad_id
: Meta Ads ad IDmcp_meta_ads_get_ad_creatives
access_token
(optional): Meta API access token (will use cached token if not provided)ad_id
: Meta Ads ad IDmcp_meta_ads_create_ad_creative
account_id
: Meta Ads account ID (format: act_XXXXXXXXX)name
: Creative nameimage_hash
: Hash of the uploaded imagepage_id
: Facebook Page ID for the adlink_url
: Destination URLmessage
: Ad copy/textheadline
: Ad headlinedescription
: Ad descriptioncall_to_action_type
: CTA button type (e.g., 'LEARN_MORE')instagram_actor_id
: Optional Instagram account IDaccess_token
(optional): Meta API access tokenmcp_meta_ads_upload_ad_image
account_id
: Meta Ads account ID (format: act_XXXXXXXXX)image_path
: Path to the image file to uploadname
: Optional name for the imageaccess_token
(optional): Meta API access tokenmcp_meta_ads_get_ad_image
access_token
(optional): Meta API access token (will use cached token if not provided)ad_id
: Meta Ads ad IDmcp_meta_ads_update_ad
ad_id
: Meta Ads ad IDstatus
: Update ad status (ACTIVE, PAUSED, etc.)bid_amount
: Bid amount in account currency (in cents for USD)access_token
(optional): Meta API access token (will use cached token if not provided)mcp_meta_ads_update_adset
adset_id
: Meta Ads ad set IDfrequency_control_specs
: List of frequency control specificationsbid_strategy
: Bid strategy (e.g., 'LOWEST_COST_WITH_BID_CAP')bid_amount
: Bid amount in account currency (in cents for USD)status
: Update ad set status (ACTIVE, PAUSED, etc.)targeting
: Targeting specifications including targeting_automationaccess_token
(optional): Meta API access token (will use cached token if not provided)mcp_meta_ads_get_insights
access_token
(optional): Meta API access token (will use cached token if not provided)object_id
: ID of the campaign, ad set, ad or accounttime_range
: Time range for insights (default: maximum)breakdown
: Optional breakdown dimension (e.g., age, gender, country)level
: Level of aggregation (ad, adset, campaign, account)mcp_meta_ads_debug_image_download
access_token
(optional): Meta API access token (will use cached token if not provided)url
: Direct image URL to test (optional)ad_id
: Meta Ads ad ID (optional, used if url is not provided)mcp_meta_ads_get_login_link
access_token
(optional): Meta API access token (will use cached token if not provided)mcp_meta-ads_create_budget_schedule
campaign_id
: Meta Ads campaign ID.budget_value
: Amount of budget increase.budget_value_type
: Type of budget value ("ABSOLUTE" or "MULTIPLIER").time_start
: Unix timestamp for when the high demand period should start.time_end
: Unix timestamp for when the high demand period should end.access_token
(optional): Meta API access token.