Skip to main content
Glama
meta-ads-mcp

meta-ads-mcp

by 1nc0gn30

meta-ads-mcp

Live Web Workbench & 24-Tool Playground: https://ads-mcp-workbench.netlify.app

Model Context Protocol (MCP) server for the Meta Marketing API (v22.0) — manage Facebook & Instagram ad accounts, ODAX campaigns, ad sets, targeting, creatives, insights, custom audiences, pixels, and automated account performance audits directly from Claude Desktop, Cursor, Windsurf, or Antigravity.

Highlights

  • 24 MCP Tools covering Account Discovery, Campaigns, Ad Sets & Targeting, Ads & Creatives, Insights & Automated Audits, Custom Audiences, and Pixels.

  • 2 MCP Resources & 2 MCP Prompts (meta-ads://config/status, meta-ads://reference/objectives, audit-ad-account, draft-campaign-plan).

  • Spend Safety Guardrails:

    • New campaigns, ad sets, and ads default to status: "PAUSED".

    • Every mutating tool supports dry_run: true to inspect the exact Graph API endpoint and payload without touching live spend.

  • Production HTTP Client:

    • Automatic act_ account ID normalization (123456 → act_123456).

    • Automatic cursor pagination (fetchAllPages).

    • Exponential backoff retries on transient Meta rate-limit/server error codes (1, 2, 4, 17, 32, 613, 80000, 80004).

    • Rate-limit header telemetry (x-app-usage, x-ad-account-usage, x-business-use-case-usage).

    • Detailed Meta error reporting (error_user_title, error_user_msg, code, error_subcode, fbtrace_id).

  • Built-in Demo Mode: Set META_ADS_DEMO_MODE=true to test every tool with realistic mock ad accounts and insights before adding a live token.


Related MCP server: meta-ads-mcp-server

Quick Start

1. Clone & Build

git clone https://github.com/1nc0gn30/meta-ads-mcp.git
cd meta-ads-mcp
npm install
npm run build

2. Configure Your MCP Client

Claude Desktop (claude_desktop_config.json) / Cursor / Antigravity

{
  "mcpServers": {
    "meta-ads": {
      "command": "node",
      "args": ["/absolute/path/to/meta-ads-mcp/dist/index.js"],
      "env": {
        "META_ACCESS_TOKEN": "EAAB...",
        "META_AD_ACCOUNT_ID": "act_1234567890",
        "META_API_VERSION": "v22.0"
      }
    }
  }
}

Test Without a Token (Demo Mode)

{
  "mcpServers": {
    "meta-ads": {
      "command": "node",
      "args": ["/absolute/path/to/meta-ads-mcp/dist/index.js"],
      "env": {
        "META_ADS_DEMO_MODE": "true"
      }
    }
  }
}

Environment Variables

Variable

Required

Default

Description

META_ACCESS_TOKEN

Yes (live)

—

Meta System User or User Access Token (ads_read, ads_management, business_management, pages_read_engagement)

META_AD_ACCOUNT_ID

No

—

Default Ad Account ID (with or without act_ prefix)

META_API_VERSION

No

v22.0

Meta Graph / Marketing API version

META_API_BASE_URL

No

https://graph.facebook.com

Override Graph API base URL (proxies / testing)

META_ADS_DEMO_MODE

No

false

Set true to run with mock datasets without a Meta token

META_API_TIMEOUT_MS

No

30000

HTTP timeout per request in milliseconds


Tool Reference (24 Tools)

Auth & Account Discovery

Tool

Description

meta_check_auth

Verify token validity, granted permissions, API version, and rate limits

meta_list_ad_accounts

List accessible ad accounts with status, currency, spend cap, and business info

meta_get_ad_account

Fetch full metadata, balance, spend cap, and funding details for an account

meta_list_pages

List Facebook Pages and linked Instagram Business Accounts

Campaigns

Tool

Description

meta_list_campaigns

List campaigns with effective_status filter and pagination

meta_get_campaign

Get full configuration and budget details for a campaign

meta_create_campaign

Create an ODAX campaign (defaults to PAUSED, supports dry_run)

meta_update_campaign

Update campaign name, status, budget, or bid strategy (supports dry_run)

Ad Sets & Targeting

Tool

Description

meta_list_adsets

List ad sets by ad account or campaign

meta_get_adset

Get full ad set details including targeting spec and schedule

meta_create_adset

Create an ad set (defaults to PAUSED, supports dry_run)

meta_update_adset

Update ad set status, budget, bid amount, end time, or targeting (supports dry_run)

meta_search_targeting

Search interests, geos, employers, job titles, or locales

meta_estimate_reach

Estimate potential audience reach for a targeting spec

Ads & Creatives

Tool

Description

meta_list_ads

List ads by account, campaign, or ad set

meta_get_ad

Get ad details and linked creative metadata

meta_create_ad_creative

Create a link/image ad creative (object_story_spec, supports dry_run)

meta_create_ad

Create an ad inside an ad set (defaults to PAUSED, supports dry_run)

meta_update_ad

Update ad name, status, or creative (supports dry_run)

meta_list_ad_images

List uploaded ad images and their hash values

Insights, Audits, Audiences & Pixels

Tool

Description

meta_get_insights

Pull account/campaign/adset/ad insights with breakdowns and blended ROAS/CPA/CTR summary

meta_audit_account_performance

Automated audit flagging creative fatigue, zero-conversion spend bleed, low CTR, and scaling winners

meta_list_custom_audiences

List custom and lookalike audiences with approximate size and delivery status

meta_list_pixels

List Meta Pixels / Datasets attached to an ad account


Development & Testing

npm run typecheck
npm run build
npm test

The test suite runs unit tests for the HTTP client (retry/backoff, pagination, rate-limit header capture, error parsing), analytics/audit checks, and full end-to-end stdio MCP client tests in both Demo Mode and Live HTTP Mode against a local mock Graph API server.


Support

This project is 100% free and open-source under the MIT License. If it saves you time:


Engineered by Neal Frazier Tech (@1nc0gn30) • NullAI Platform

Available Tools

24 tools
meta_audit_account_performanceB
Read-only

Run an automated performance audit on a Meta Ad Account: computes blended ROAS/CPA/CTR/CPM, flags creative fatigue (high frequency), zero-conversion spend bleed, low-CTR ads, and scaling winners.

Inputs: level, date_preset, ad_account_id, min_scale_roas, +3 more.

meta_check_authA
Read-only

Verify Meta Marketing API access token, granted permissions, API version, default ad account, and rate limit telemetry.

Inputs: no named parameters.

meta_create_adA

Create an ad inside an ad set referencing an existing creative ID. Defaults to PAUSED and supports dry_run=true.

Inputs: name (required), adset_id (required), creative_id (required), status, +2 more.

meta_create_ad_creativeC

Create a Meta link/image ad creative using object_story_spec. Supports dry_run=true.

Inputs: link (required), name (required), message (required), page_id (required), +7 more.

meta_create_adsetB

Create an ad set inside a campaign. Defaults to PAUSED for safety and supports dry_run=true.

Inputs: name (required), targeting (required), campaign_id (required), status, +10 more.

meta_create_campaignA

Create a new Meta Ads ODAX campaign. Defaults to PAUSED for spend safety. Supports dry_run=true to preview the API payload without creating a live campaign.

Inputs: name (required), objective (required), status, dry_run, +5 more.

meta_estimate_reachB
Read-only

Estimate potential audience size for a given Meta targeting specification before launching an ad set.

Inputs: targeting_spec (required), ad_account_id.

meta_get_adB
Read-only

Get full details and creative metadata for a specific ad ID.

Inputs: ad_id (required).

meta_get_ad_accountA
Read-only

Fetch detailed metadata, spend caps, balance, and funding status for a specific Meta Ad Account.

Inputs: ad_account_id.

meta_get_adsetA
Read-only

Get full details for a single ad set including targeting spec, optimization goal, schedule, and budget.

Inputs: adset_id (required).

meta_get_campaignA
Read-only

Retrieve full configuration and budget details for a single Meta campaign by ID.

Inputs: campaign_id (required).

meta_get_insightsC
Read-only

Fetch Meta Ads performance insights at account, campaign, adset, or ad level with optional breakdowns, attribution windows, and automatic blended ROAS/CPA/CTR summary.

Inputs: level, limit, since, until, +6 more.

meta_list_ad_accountsB
Read-only

List all Meta Ad Accounts accessible to the configured token, including currency, status, timezone, spend cap, and business owner.

Inputs: limit, max_pages.

meta_list_ad_imagesB
Read-only

List uploaded ad images and their hashes for an ad account.

Inputs: limit, ad_account_id.

meta_list_adsB
Read-only

List ads across an ad account, a specific campaign, or a specific ad set.

Inputs: limit, adset_id, max_pages, campaign_id, +2 more.

meta_list_adsetsB
Read-only

List ad sets for an ad account or a specific campaign.

Inputs: limit, max_pages, campaign_id, ad_account_id, +1 more.

meta_list_campaignsB
Read-only

List campaigns in an ad account with optional effective_status filter and pagination.

Inputs: limit, max_pages, ad_account_id, effective_status.

meta_list_custom_audiencesC
Read-only

List custom audiences and lookalike audiences for an ad account.

Inputs: limit, ad_account_id.

meta_list_pagesA
Read-only

List Facebook Pages (and linked Instagram Business Accounts) accessible to the token for creating ad creatives.

Inputs: limit.

meta_list_pixelsB
Read-only

List Meta Pixels (Datasets) attached to an ad account for conversion tracking.

Inputs: limit, ad_account_id.

meta_search_targetingA
Read-only

Search Meta's targeting taxonomy for interests, geos, job titles, employers, or locales.

Inputs: query (required), type, limit, location_types.

meta_update_adB
Idempotent

Update an existing ad's name, status (ACTIVE/PAUSED/ARCHIVED), or creative_id. Supports dry_run=true.

Inputs: ad_id (required), name, status, dry_run, +1 more.

meta_update_adsetB
Idempotent

Update an ad set's name, status, daily/lifetime budget, bid_amount, end_time, or targeting spec. Supports dry_run=true.

Inputs: adset_id (required), name, status, dry_run, +5 more.

meta_update_campaignB
Idempotent

Update an existing campaign's name, status (ACTIVE/PAUSED/ARCHIVED), budget, or bid strategy. Supports dry_run=true.

Inputs: campaign_id (required), name, status, dry_run, +3 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 24 tools

    Disambiguation4/5

    Most tools have a clearly distinct resource and action, with strong separation between campaign, ad set, ad, creative, targeting, and insights operations. Minor overlap exists between meta_get_insights and meta_audit_account_performance, and between meta_create_ad_creative and meta_create_ad, but descriptions make the boundaries workable.

    Naming Consistency5/5

    All tools consistently use a meta_ prefix followed by a verb_noun pattern such as list_campaigns, get_ad, create_adset, update_campaign, and search_targeting. The convention is predictable throughout, with only natural variations like check_auth and audit_account_performance.

    Tool Count4/5

    Twenty-four tools is on the heavy side, but the breadth of Meta Ads management justifies separate operations for accounts, campaigns, ad sets, ads, creatives, targeting, insights, and auditing. Each tool maps to a meaningful API operation, though some auxiliary listing tools could potentially be consolidated.

    Completeness4/5

    The core lifecycle from account discovery through campaign, ad set, ad, creative, targeting, and performance insights is well covered. Gaps remain around explicit delete operations, creative retrieval/update beyond image listing, and creation of custom audiences or pixels, though archiving via status updates mitigates some of this.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      C
      quality
      D
      maintenance
      Enables managing Facebook ads campaigns, ad sets, ads, creatives, insights, and audience targeting via Meta's Marketing API.
      39
      -
    • A
      license
      A
      quality
      B
      maintenance
      Enables MCP clients to read and analyze Facebook (Meta) Ads marketing data, including campaigns, ad sets, ads, insights, and 190 metrics, with optional write tools that preview changes before applying.
      41
      2
      Apache 2.0
    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables managing Meta advertising accounts, campaigns, ad sets, creatives, audiences, reporting, and batch workflows through an authenticated MCP endpoint with per-workspace OAuth connections.
      39 npm
      MIT