Meta Marketing API
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.
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
Maintainer
Works with
Installation
Manual Installation
npx meta-marketing-api-mcp-serverConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
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
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 installConfigure 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_STATESet 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_PASSWORDDeploy the Cloudflare Worker
Run the development server locally to test or deploy to Cloudflare production.
pnpm dev
# or for production:
pnpm deployAuthenticate 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"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.
Meta Marketing API Alternatives — Similar Marketing & SEO Servers
Looking for alternatives to Meta Marketing API? Here are other popular marketing & seo servers you can use with Claude, Cursor, and VS Code.
TopRank
★ 2.6kGoogle Ads analysis and operations — read performance, manage keywords, bids, and campaigns.
Open SEO
★ 2.1kOpen source alternative to Semrush and Ahrefs
ASO Skills
★ 1.4kAI agent skills for App Store Optimization (ASO) and app marketing. Built for indie developers, app marketers, and growth teams who want Cursor, Claude Code, or any Agent Skills-compatible AI assistant to help with keyword research, metadata optimiza
Google Meta Ads GA4
★ 994MCP server for Google Ads, Meta Ads & GA4 — works with ChatGPT, Claude, Cursor, n8n, Windsurf & more. 250+ tools for campaign management, analytics & optimization.
Meta Ads
★ 923A Model Context Protocol server that allows AI models to access, analyze, and manage Meta advertising campaigns, enabling LLMs to retrieve performance data, visualize ad creatives, and provide strategic insights for Facebook and Instagram platforms.
Google Search Console
★ 882Connects Google Search Console with Claude AI to enable SEO professionals to analyze their SEO data through natural language conversations, providing access to property information, search analytics, URL inspection, and sitemap management.
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.
Set Up Meta Marketing API in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
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.