meta-ads-mcp-local

v0.4.5
meta-ads-mcp-local Checked 10 hours ago Published 1 year ago

Model Calling Protocol (MCP) plugin for interacting with Meta Ads API (Fork with HTTPS support)

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

get_ad_accounts

Get ad accounts accessible by a user. Args: access_token: Meta API access token (optional - will use cached token if not provided) user_id: Meta user ID or "me" for the current user limit: Maximum number of accounts to return (default: 10)

ParameterTypeDescription
access_tokenstring
limitinteger
user_idstring

get_account_info

Get detailed information about a specific ad account. Args: access_token: Meta API access token (optional - will use cached token if not provided) account_id: Meta Ads account ID (format: act_XXXXXXXXX)

ParameterTypeDescription
access_tokenstring
account_idstring

get_campaigns

Get campaigns for a Meta Ads account with optional filtering. Note: By default, the Meta API returns a subset of available fields. Other fields like 'effective_status', 'special_ad_categories', 'lifetime_budget', 'spend_cap', 'budget_remaining', 'promoted_object', 'source_campaign_id', etc., might be available but require specifying them in the API call (currently not exposed by this tool's parameters). Args: access_token: Meta API access token (optional - will use cached token if not provided) account_id: Meta Ads account ID (format: a…

ParameterTypeDescription
access_tokenstring
account_idstring
afterstring
limitinteger
status_filterstring

get_campaign_details

Get detailed information about a specific campaign. Note: This function requests a specific set of fields ('id,name,objective,status,...'). The Meta API offers many other fields for campaigns (e.g., 'effective_status', 'source_campaign_id', etc.) that could be added to the 'fields' parameter in the code if needed. Args: access_token: Meta API access token (optional - will use cached token if not provided) campaign_id: Meta Ads campaign ID

ParameterTypeDescription
access_tokenstring
campaign_idstring

create_campaign

Create a new campaign in a Meta Ads account. Args: access_token: Meta API access token (optional - will use cached token if not provided) account_id: Meta Ads account ID (format: act_XXXXXXXXX) name: Campaign name objective: Campaign objective. Validates ad objectives. enum{BRAND_AWARENESS, LEAD_GENERATION, LINK_CLICKS, CONVERSIONS, OUTCOME_TRAFFIC, etc.}. status: Initial campaign status (default: PAUSED) special_ad_categories: List of special ad categories if applicable daily_budget: Daily budget in account currency (in cen…

ParameterTypeDescription
ab_test_control_setups
access_tokenstring
account_idstring
bid_capstring
bid_strategystring
buying_typestring
campaign_budget_optimizationboolean
daily_budgetstring
lifetime_budgetstring
namestring
objectivestring
special_ad_categoriesarray
spend_capstring
statusstring

update_campaign

Update an existing campaign in a Meta Ads account. Args: access_token: Meta API access token (optional - will use cached token if not provided) campaign_id: Meta Ads campaign ID (required) name: New campaign name status: New campaign status (e.g., 'ACTIVE', 'PAUSED') special_ad_categories: List of special ad categories if applicable daily_budget: New daily budget in account currency (in cents) as a string lifetime_budget: New lifetime budget in account currency (in cents) as a string bid_strategy: New bid strategy…

ParameterTypeDescription
access_tokenstring
bid_capstring
bid_strategystring
campaign_budget_optimizationboolean
campaign_idstring
daily_budgetstring
lifetime_budgetstring
namestring
objectivestring
special_ad_categoriesarray
spend_capstring
statusstring

get_adsets

Get ad sets for a Meta Ads account with optional filtering by campaign. Args: access_token: Meta API access token (optional - 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 by

ParameterTypeDescription
access_tokenstring
account_idstring
campaign_idstring
limitinteger

get_adset_details

Get detailed information about a specific ad set. Args: adset_id: Meta Ads ad set ID (required) access_token: Meta API access token (optional - will use cached token if not provided) Example: To call this function through MCP, pass the adset_id as the first argument: { "args": "YOUR_ADSET_ID" }

ParameterTypeDescription
access_tokenstring
adset_idstring

create_adset

Create a new ad set in a Meta Ads account. Args: account_id: Meta Ads account ID (format: act_XXXXXXXXX) campaign_id: Meta Ads campaign ID this ad set belongs to name: Ad set name status: Initial ad set status (default: PAUSED) daily_budget: Daily budget in account currency (in cents) as a string lifetime_budget: Lifetime budget in account currency (in cents) as a string targeting: Targeting specifications including age, location, interests, etc. Use targeting_automation.advantage_audience=1 for automatic a…

ParameterTypeDescription
access_tokenstring
account_idstring
bid_amountstring
bid_strategystring
billing_eventstring
campaign_idstring
daily_budgetstring
end_timestring
lifetime_budgetstring
namestring
optimization_goalstring
start_timestring
statusstring
targetingobject

update_adset

Update an ad set with new settings including frequency caps. Args: adset_id: Meta Ads ad set ID frequency_control_specs: List of frequency control specifications (e.g. [{"event": "IMPRESSIONS", "interval_days": 7, "max_frequency": 3}]) bid_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_automation (e.g. {…

ParameterTypeDescription
adset_id *string
access_tokenstring
bid_amountinteger
bid_strategystring
frequency_control_specsarray
optimization_goalstring
statusstring
targetingobject

get_ads

Get ads for a Meta Ads account with optional filtering. Args: access_token: Meta API access token (optional - 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 by adset_id: Optional ad set ID to filter by

ParameterTypeDescription
access_tokenstring
account_idstring
adset_idstring
campaign_idstring
limitinteger

get_ad_details

Get detailed information about a specific ad. Args: access_token: Meta API access token (optional - will use cached token if not provided) ad_id: Meta Ads ad ID

ParameterTypeDescription
access_tokenstring
ad_idstring

create_ad

Create a new ad with an existing creative. Args: account_id: Meta Ads account ID (format: act_XXXXXXXXX) name: Ad name adset_id: Ad set ID where this ad will be placed creative_id: ID of an existing creative to use status: Initial ad status (default: PAUSED) bid_amount: Optional bid amount in account currency (in cents) tracking_specs: Optional tracking specifications (e.g., for pixel events). Example: [{"action.type":"offsite_conversion","fb_pixel":["YOUR_PIXEL_ID"]}] access_token: Meta API acc…

ParameterTypeDescription
access_tokenstring
account_idstring
adset_idstring
bid_amountstring
creative_idstring
namestring
statusstring
tracking_specs

get_ad_creatives

Get creative details for a specific ad. Best if combined with get_ad_image to get the full image. Args: access_token: Meta API access token (optional - will use cached token if not provided) ad_id: Meta Ads ad ID

ParameterTypeDescription
access_tokenstring
ad_idstring

get_ad_image

Get, download, and visualize a Meta ad image in one step. Useful to see the image in the LLM. Args: access_token: Meta API access token (optional - will use cached token if not provided) ad_id: Meta Ads ad ID Returns: The ad image ready for direct visual analysis

ParameterTypeDescription
access_tokenstring
ad_idstring

save_ad_image_locally

Get, download, and save a Meta ad image locally, returning the file path. Args: access_token: Meta API access token (optional - will use cached token if not provided) ad_id: Meta Ads ad ID output_dir: Directory to save the image file (default: 'ad_images') Returns: The file path to the saved image, or an error message string.

ParameterTypeDescription
access_tokenstring
ad_idstring
output_dirstring

update_ad

Update an ad with new settings. Args: ad_id: Meta Ads ad ID status: Update ad status (ACTIVE, PAUSED, etc.) bid_amount: Bid amount in account currency (in cents for USD) tracking_specs: Optional tracking specifications (e.g., for pixel events). access_token: Meta API access token (optional - will use cached token if not provided)

ParameterTypeDescription
ad_id *string
access_tokenstring
bid_amountinteger
statusstring
tracking_specsstring

upload_ad_image

Upload an image to use in Meta Ads creatives. Args: access_token: Meta API access token (optional - will use cached token if not provided) account_id: Meta Ads account ID (format: act_XXXXXXXXX) image_path: Path to the image file to upload name: Optional name for the image (default: filename) Returns: JSON response with image details including hash for creative creation

ParameterTypeDescription
access_tokenstring
account_idstring
image_pathstring
namestring

create_ad_creative

Create a new ad creative using an uploaded image hash. Args: access_token: Meta API access token (optional - will use cached token if not provided) account_id: Meta Ads account ID (format: act_XXXXXXXXX) name: Creative name image_hash: Hash of the uploaded image page_id: Facebook Page ID to be used for the ad link_url: Destination URL for the ad message: Ad copy/text headline: Ad headline description: Ad description call_to_action_type: Call to action button type (e.g., 'LEARN_MORE', 'SIGN_UP', 'SHOP_…

ParameterTypeDescription
access_tokenstring
account_idstring
call_to_action_typestring
descriptionstring
headlinestring
image_hashstring
instagram_actor_idstring
link_urlstring
messagestring
namestring
page_idstring

get_account_pages

Get pages associated with a Meta Ads account. Args: access_token: Meta API access token (optional - will use cached token if not provided) account_id: Meta Ads account ID (format: act_XXXXXXXXX) Returns: JSON response with pages associated with the account

ParameterTypeDescription
access_tokenstring
account_idstring

get_insights

Get performance insights for a campaign, ad set, ad or account. Args: access_token: Meta API access token (optional - will use cached token if not provided) object_id: ID of the campaign, ad set, ad or account time_range: Either a preset time range string or a dictionary with "since" and "until" dates in YYYY-MM-DD format Preset options: today, yesterday, this_month, last_month, this_quarter, maximum, data_maximum, last_3d, last_7d, last_14d, last_28d, last_30d, last_90d, last_week_mon_sun, last_we…

ParameterTypeDescription
access_tokenstring
breakdownstring
levelstring
object_idstring
time_range

debug_image_download

Debug image download issues and report detailed diagnostics. Args: access_token: Meta API access token (optional - 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)

ParameterTypeDescription
access_tokenstring
ad_idstring
urlstring

save_ad_image_via_api

Try to save an ad image by using the Marketing API's attachment endpoints. This is an alternative approach when direct image download fails. Args: access_token: Meta API access token (optional - will use cached token if not provided) ad_id: Meta Ads ad ID

ParameterTypeDescription
access_tokenstring
ad_idstring

search_ads_archive

Search the Facebook Ads Library archive. Args: access_token: Meta API access token (optional - will use cached token if not provided). search_terms: The search query for ads. ad_type: Type of ads to search for (e.g., POLITICAL_AND_ISSUE_ADS, HOUSING_ADS, ALL). ad_reached_countries: List of country codes (e.g., ["US", "GB"]). limit: Maximum number of ads to return. fields: Comma-separated string of fields to retrieve for each ad. Example Usage via curl equivalent: curl -G \ -d "search_terms='california'" \ -d…

ParameterTypeDescription
access_tokenstring
ad_reached_countriesarray
ad_typestring
fieldsstring
limitinteger
search_termsstring

create_budget_schedule

Create a budget schedule for a Meta Ads campaign. Allows scheduling budget increases based on anticipated high-demand periods. The times should be provided as Unix timestamps. Args: campaign_id: Meta Ads campaign ID. budget_value: Amount of budget increase. Interpreted based on budget_value_type. 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: Meta…

ParameterTypeDescription
budget_value *integer
budget_value_type *string
campaign_id *string
time_end *integer
time_start *integer
access_tokenstring