Meta Marketing API MCP Server

1

Add it to Claude Code

Run this in a terminal.

Run in terminal
claude mcp add -e "META_ACCESS_TOKEN=${META_ACCESS_TOKEN}" meta-marketing-api -- npx -y meta-ads-mcp
Required:META_ACCESS_TOKEN+ 4 optional
README.md

Manage Facebook and Instagram advertising data through the Meta Marketing API.

Meta Marketing API MCP Server

A comprehensive Model Context Protocol (MCP) server that enables AI assistants like Claude to interact with Facebook/Instagram advertising data through the Meta Marketing API. This server provides full campaign lifecycle management, analytics, audience targeting, and creative optimization capabilities.

โšก Quick Start

1) Install

npm install -g meta-ads-mcp

2) Configure (Claude Desktop / Cursor)

Create or edit your MCP config:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

Minimal config:

{
  "mcpServers": {
    "meta-ads": {
      "command": "npx",
      "args": ["-y", "meta-ads-mcp"],
      "env": {
        "META_ACCESS_TOKEN": "your_access_token_here"
      }
    }
  }
}

If your app requires appsecret_proof, add META_APP_SECRET:

{
  "mcpServers": {
    "meta-ads": {
      "command": "npx",
      "args": ["-y", "meta-ads-mcp"],
      "env": {
        "META_ACCESS_TOKEN": "your_access_token_here",
        "META_APP_SECRET": "your_app_secret"
      }
    }
  }
}

3) Restart your client

  • Claude Desktop: quit and reopen
  • Cursor: restart the IDE

4) Verify

npm run health-check

๐Ÿš€ Features

**Campaign Management**

  • โœ… Create, update, pause, resume, and delete campaigns
  • โœ… Support for all campaign objectives (traffic, conversions, awareness, etc.)
  • โœ… Budget management and scheduling
  • โœ… Ad set creation with advanced targeting
  • โœ… Individual ad management

**Analytics & Reporting**

  • ๐Ÿ“Š Performance insights with customizable date ranges
  • ๐Ÿ“ˆ Multi-object performance comparison
  • ๐Ÿ“‹ Data export in CSV/JSON formats
  • ๐ŸŽฏ Attribution modeling and conversion tracking
  • ๐Ÿ“… Daily performance trends analysis

**Audience Management**

  • ๐Ÿ‘ฅ Custom audience creation and management
  • ๐ŸŽฏ Lookalike audience generation
  • ๐Ÿ“ Audience size estimation
  • ๐Ÿ” Targeting recommendations and insights
  • ๐Ÿฅ Audience health monitoring

**Creative Management**

  • ๐ŸŽจ Ad creative creation and management
  • ๐Ÿ‘๏ธ Cross-platform ad previews
  • ๐Ÿงช A/B testing setup and guidance
  • ๐Ÿ“ธ Creative performance analysis

**Enterprise Features**

  • ๐Ÿ” Secure OAuth 2.0 authentication
  • โšก Automatic rate limiting with exponential backoff
  • ๐Ÿ”„ Pagination support for large datasets
  • ๐Ÿ›ก๏ธ Comprehensive error handling
  • ๐Ÿ“š Rich MCP resources for contextual data access
  • ๐ŸŒ Multi-account support

๐Ÿ“ฆ Installation & Setup

Option 1: Direct Installation (Recommended)

npm install -g meta-ads-mcp

Option 2: From Source

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

Option 3: Automated Setup (Easiest)

# Clone the repository first
git clone https://github.com/wipsoft/meta-mcp.git
cd meta-ads-mcp

# Run the interactive setup
npm run setup

The setup script will:

  • โœ… Check system requirements
  • โœ… Validate your Meta access token
  • โœ… Create Claude Desktop configuration
  • โœ… Install dependencies
  • โœ… Test the connection

๐Ÿ”ง Configuration Guide

Step 1: Get Meta Access Token

  1. Create a Meta App at developers.facebook.com
  2. Add Marketing API product
  3. Generate an access token with ads_read and ads_management permissions
  4. If your app requires appsecret_proof, set META_APP_SECRET (see below)
  5. (Optional) Set up OAuth for automatic token refresh

CleanShot 2025-06-17 at 15 52 35@2x

Step 2: Configure Claude Desktop

Find your configuration file:
  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

If the file doesn't exist, create it with the following content:

Basic Configuration (Token-based):
{
  "mcpServers": {
    "meta-ads": {
      "command": "npx",
      "args": ["-y", "meta-ads-mcp"],
      "env": {
        "META_ACCESS_TOKEN": "your_access_token_here"
      }
    }
  }
}
Advanced Configuration (with OAuth + appsecret_proof):
{
  "mcpServers": {
    "meta-ads": {
      "command": "npx",
      "args": ["-y", "meta-ads-mcp"],
      "env": {
        "META_ACCESS_TOKEN": "your_access_token_here",
        "META_APP_ID": "your_app_id",
        "META_APP_SECRET": "your_app_secret",
        "META_AUTO_REFRESH": "true",
        "META_BUSINESS_ID": "your_business_id"
      }
    }
  }
}
Local Development Configuration:

If you've cloned the repository locally:

{
  "mcpServers": {
    "meta-ads": {
      "command": "node",
      "args": ["/absolute/path/to/meta-ads-mcp/build/index.js"],
      "env": {
        "META_ACCESS_TOKEN": "your_access_token_here"
      }

Tools (4)

campaign_managementCreate, update, pause, resume, and delete advertising campaigns.
analytics_reportingRetrieve performance insights and daily trends with customizable date ranges.
audience_managementCreate and manage custom audiences, lookalike audiences, and estimate audience sizes.
creative_managementManage ad creatives and set up A/B testing.

Environment Variables

META_ACCESS_TOKENrequiredAccess token with ads_read and ads_management permissions
META_APP_SECRETApp secret for appsecret_proof validation
META_APP_IDMeta application ID
META_BUSINESS_IDMeta business account ID
META_AUTO_REFRESHEnable automatic token refresh

Configuration

claude_desktop_config.json
{"mcpServers": {"meta-ads": {"command": "npx", "args": ["-y", "meta-ads-mcp"], "env": {"META_ACCESS_TOKEN": "your_access_token_here"}}}}

Try it

โ†’Create a new traffic campaign with a daily budget of $50.
โ†’Show me the performance report for my active campaigns over the last 30 days.
โ†’Create a lookalike audience based on my existing high-value customer list.
โ†’Pause all ad sets that have a CPA higher than $10.
โ†’Compare the performance of my two latest ad creatives.

Frequently Asked Questions

What are the key features of Meta Marketing API?

Full campaign lifecycle management including creation, updates, and scheduling. Performance analytics with customizable date ranges and data export. Audience management for custom and lookalike audience generation. Creative management with support for A/B testing setup. Enterprise features including OAuth 2.0, rate limiting, and multi-account support.

What can I use Meta Marketing API for?

Automating daily campaign budget adjustments based on performance metrics. Generating weekly performance reports for stakeholders in CSV or JSON format. Streamlining the creation of ad sets with standardized targeting criteria. Monitoring audience health and targeting effectiveness for ongoing campaigns.

How do I install Meta Marketing API?

Install Meta Marketing API by running: npm install -g meta-ads-mcp

What MCP clients work with Meta Marketing API?

Meta Marketing API works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep Meta Marketing API docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare