Meta Marketing API MCP Server is an MCP server that connects AI clients directly to Facebook and Instagram advertising accounts through the Meta Marketing API. Built on xmcp and deployed as a Cloudflare Worker, the server allows media buyers, digital marketing teams, and developers to automate campaign management, reporting, and ad optimization using AI assistants. The server enables users to perform operational marketing actions such as inspecting ad accounts, creating and editing campaigns, organizing ad sets, tracking audience targeting, and retrieving performance insights without manually navigating Meta Ads Manager. Rather than using the official Meta SDK, the system uses direct Meta Graph API requests, encrypts stored Meta access tokens, and manages workspace connections inside Cloudflare D1 and KV namespaces. Because it operates as a multi-tenant service, every MCP request requires application-issued JSON Web Tokens with workspace context to enforce access controls. Teams can integrate the server into their existing cloud infrastructure or marketing dashboards to allow automated agents to manage batch advertising workflows safely.
Category: CRM, ERP & E-commerce
Tags: advertising, facebook, instagram, marketing, meta
Visit Meta Marketing API MCP Server
pnpm install. 2. Configure your Meta developer app by adding the Marketing API product, setting the Website platform URL, and configuring the redirect URI to your Worker callback path. 3. Create the required Cloudflare resources, binding a D1 database as META_DB and a KV namespace as META_OAUTH_STATE. 4. Initialize the database schema by executing pnpm wrangler d1 execute META_DB --remote --file schema.sql -y. 5. Set your Worker secrets, including JWT_SECRET (or JWT_JWKS_URL), META_APP_ID, META_APP_SECRET, and META_TOKEN_ENCRYPTION_KEY. 6. Deploy the Worker using pnpm deploy. 7. Authenticate a Meta account via the /oauth/meta/start endpoint or the built-in /app browser interface. 8. Connect your MCP client to the HTTP endpoint at https://<your-worker-host>/mcp using a Bearer JWT containing the appropriate workspace ID. For full setup options, see the GitHub repository.Part of MCP Servers
The server exposes 39 tools covering account setup, campaign management, ad set configuration, creatives, custom audience targeting, and reporting. It allows AI models to query advertising performance metrics, update campaign statuses, retrieve available ad accounts, and execute batch operations on Meta Ads data.
The server uses a multi-tenant authentication model powered by application-issued JSON Web Tokens. Each MCP request requires a bearer JWT specifying a user ID and workspace ID. Stored Meta OAuth access tokens are encrypted in Cloudflare D1, while temporary OAuth state is maintained in KV.
The server is designed for self-hosting on Cloudflare Workers. It uses Cloudflare D1 for storing workspace connections and ad account caches, along with Cloudflare KV for managing short-lived OAuth state during authorization with the Meta Graph API.
The server exposes a streamable HTTP MCP endpoint at /mcp. Any MCP client capable of connecting to remote HTTP endpoints with custom Bearer authorization headers can interact with the server once the deployment and token configuration are complete.