Meta Marketing API

v1.0.0Marketing & SEOstable

Enables AI assistants to manage Facebook and Instagram advertising via the Meta Marketing API. It provides comprehensive tools for campaign lifecycle management, performance analytics, audience targeting, and creative optimization.

ads-mcpfacebook-adsfacebook-mcpmcpmcp-server
Share:
176
Stars
0
Downloads
0
Weekly
0/5

What is Meta Marketing API?

Meta Marketing API is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to enables ai assistants to manage facebook and instagram advertising via the meta marketing api. it provides comprehensive tools for campaign lifecycle management, performance analytics, audience target...

Enables AI assistants to manage Facebook and Instagram advertising via the Meta Marketing API. It provides comprehensive tools for campaign lifecycle management, performance analytics, audience targeting, and creative optimization.

This server falls under the Marketing & SEO category on MCPgee, the world's largest MCP server directory with 33,000+ servers.

Features

  • Enables AI assistants to manage Facebook and Instagram adver

Use Cases

Manage Facebook and Instagram advertising campaigns.
Optimize ad performance and audience targeting.
Create and monitor ads through natural language.
brijr

Maintainer

LicenseMIT License
Languagetypescript
Versionv1.0.0
UpdatedMay 18, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx meta-marketing-api-mcp-server

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

How to Set Up and Use Meta Marketing API

The Meta Marketing API MCP Server brings Facebook and Instagram advertising management directly into AI assistants through the Meta Marketing API. It registers 39 tools covering the full ad lifecycle — from account setup and campaign creation through audience targeting, creative management, and performance reporting. Deployed as a Cloudflare Worker with D1 and KV storage, it handles OAuth2 authentication with Meta on behalf of each workspace, so AI assistants can manage campaigns, pull spend analytics, and optimize ads through natural language without requiring direct API access. Marketers and growth engineers use it to automate campaign reporting and make ad changes conversationally.

Prerequisites

  • A Meta Developer account with an approved app that has `ads_management` and `business_management` OAuth scopes
  • A Cloudflare account with Workers, D1 database, and KV namespace provisioned
  • Meta App ID (`META_APP_ID`) and App Secret (`META_APP_SECRET`) from your Meta Developer dashboard
  • A JWT secret (`JWT_SECRET`) or JWKS URL for API authentication
  • An MCP-compatible client such as Claude Desktop or a custom agent
1

Clone the repository and install dependencies

Clone the meta-mcp repository and install Node.js dependencies using pnpm.

git clone https://github.com/brijr/meta-mcp.git
cd meta-mcp
pnpm install
2

Configure Cloudflare bindings

Create a D1 database and KV namespace in your Cloudflare account. Bind them to the Worker as `META_DB` (D1) and `META_OAUTH_STATE` (KV) in your `wrangler.toml`.

npx wrangler d1 create meta-db
npx wrangler kv:namespace create META_OAUTH_STATE
3

Set required secrets in Cloudflare

Push your Meta app credentials and encryption keys as Cloudflare Worker secrets so they are available at runtime without being stored in code.

npx wrangler secret put META_APP_ID
npx wrangler secret put META_APP_SECRET
npx wrangler secret put META_TOKEN_ENCRYPTION_KEY
npx wrangler secret put JWT_SECRET
npx wrangler secret put APP_UI_PASSWORD
4

Deploy the Cloudflare Worker

Run the development server locally to test or deploy to Cloudflare production.

pnpm dev
# or for production:
pnpm deploy
5

Authenticate a workspace with Meta OAuth

Generate a JWT for your workspace and initiate the Meta OAuth flow to grant the Worker access to your ad accounts. Replace `$TOKEN` with a valid JWT signed with your `JWT_SECRET`.

curl -H "Authorization: Bearer $TOKEN" \
  "https://<worker-host>/oauth/meta/start?workspace_id=workspace_test"
6

Connect your MCP client to the Worker endpoint

Add the deployed Worker URL as an MCP server in your AI client configuration. The Worker exposes a `/mcp` endpoint that handles all 39 ad management tools.

{
  "mcpServers": {
    "meta-marketing-api": {
      "url": "https://<your-worker>.workers.dev/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_JWT_TOKEN"
      }
    }
  }
}

Meta Marketing API Examples

Client configuration

MCP client configuration for connecting to the deployed Meta Marketing API Worker. Uses HTTP transport with JWT authorization.

{
  "mcpServers": {
    "meta-marketing-api": {
      "url": "https://<your-worker-subdomain>.workers.dev/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_JWT_TOKEN"
      }
    }
  }
}

Prompts to try

Example prompts to use with the Meta Marketing API server once an ad account has been authenticated via OAuth.

- "List all my active Facebook ad campaigns and their current spend"
- "Create a new campaign called 'Summer Sale 2025' with a $500 daily budget targeting US users aged 25-44"
- "Show me the performance report for last week broken down by ad set"
- "Pause all ad sets that have a cost-per-click above $2.00"
- "What audiences do I have saved in my ad account?"

Troubleshooting Meta Marketing API

OAuth flow fails or Meta access token not stored

Verify that `META_APP_ID`, `META_APP_SECRET`, and `META_REDIRECT_URI` are correctly set as Worker secrets, and that your Meta app's OAuth redirect URI matches the Worker URL. Check that the `META_OAUTH_STATE` KV namespace is properly bound.

Tool calls return 401 Unauthorized

Ensure your client is sending a valid JWT in the Authorization header. The JWT must be signed with the same `JWT_SECRET` (or verified by the `JWT_JWKS_URL`) configured in the Worker.

D1 database errors on first run

Run the D1 migration scripts to initialize the database schema before deploying. Check `wrangler.toml` to confirm the `META_DB` binding name matches the D1 database you created.

Frequently Asked Questions about Meta Marketing API

What is Meta Marketing API?

Meta Marketing API is a Model Context Protocol (MCP) server that enables ai assistants to manage facebook and instagram advertising via the meta marketing api. it provides comprehensive tools for campaign lifecycle management, performance analytics, audience targeting, and creative optimization. It connects AI assistants to external tools and data sources through a standardized interface.

How do I install Meta Marketing API?

Follow the installation instructions on the Meta Marketing API GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.

Which AI clients work with Meta Marketing API?

Meta Marketing API works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.

Is Meta Marketing API free to use?

Yes, Meta Marketing API is open source and available under the MIT License license. You can use it freely in both personal and commercial projects.

Browse More Marketing & SEO MCP Servers

Explore all marketing & seo servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.

Quick Config Preview

{ "mcpServers": { "meta-marketing-api-mcp-server": { "command": "npx", "args": ["-y", "meta-marketing-api-mcp-server"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

Ready to use Meta Marketing API?

Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.

33,000+ ServersFree & Open SourceStep-by-Step Guides