How to Connect Claude Code to Meta Ads via MCP (2026)
Connect Claude Code to Facebook and Instagram Ads in under 2 minutes using Cogny's managed MCP server. OAuth handled for you — no app review, no developer setup, no self-hosting.
Add Cogny as an MCP server in Claude (claude mcp add --transport http cogny https://app.cogny.com/mcp, or as a connector in Claude.ai), authorise it, and connect Meta Ads in Cogny. Claude can then read insights and change campaigns, ad sets, budgets, audiences and ads. Claude asks before each write; Cogny logs every write with who authorised it, and a launch or budget change becomes a ticket measured three days later.
How do I let Claude manage my Meta ads?
Install Cogny in Claude Code with claude mcp add --transport http cogny https://app.cogny.com/mcp, or add it as a connector in Claude.ai, and authorise in the browser. Then connect your Meta ad account in Cogny with Meta's own sign-in. Claude can now read campaign insights, pause or resume campaigns, ad sets and ads, change budgets, targeting and placements, create campaigns and ads, and build custom or lookalike audiences.
Does Claude ask before it changes a campaign?
Yes. Over MCP your AI client is the approval step: Claude asks before it runs a tool that writes, unless you have allowed that tool in advance. Cogny does not hold the write for a second approval, but it logs every write with the tool, the time, the result and who authorised it. Any tool can be set to blocked in Cogny, and a blocked tool is refused.
How do I see whether the change worked?
A launch, or a budget, bid, status or targeting change made through Cogny, becomes a ticket on its own; for other changes Claude offers to register them. Three days later Cogny reads the result in your Meta Ads data, compares it with the days before, and closes the ticket as worked, partial, didn't work or inconclusive. Misses stay on the record, on every plan, Free included.
TL;DR
Cogny provides a managed, remote MCP server for Meta Ads (Facebook + Instagram) with built-in OAuth. Connect Claude Code to your ad accounts without creating a Facebook app, going through app review, or hosting anything yourself.
What you get:
- Single federated MCP server at
app.cogny.com/mcp— tools determined by connected accounts - Read and write access to campaigns, ad sets, ads, audiences and creative assets
- Performance metrics, audience data, and conversion tracking
- Long-lived token management (automatic refresh, no 60-day expiry headaches)
- Works with Claude Code, Claude Desktop, Cursor, Windsurf, and any MCP client
Time required: 2 minutes | Difficulty: Beginner | Prerequisites: Meta Business Manager, ad account access
Why Use a Managed MCP Server?
Building your own Meta Ads MCP server means:
- Creating a Facebook app in the developer portal
- Going through Meta's app review process (weeks of waiting)
- Managing short-lived tokens → long-lived token exchange
- Handling the 60-day token expiry cycle
- Hosting a server and keeping it running
- Dealing with Meta's frequently changing API versions
Cogny handles all of this. Sign in with Facebook, authorize your ad accounts, and get a working MCP endpoint immediately.
What Is MCP?
The Model Context Protocol (MCP) is an open standard that gives AI agents like Claude structured access to external platforms. Instead of exporting CSVs or screenshots, Claude connects directly to your Meta Ads data through a standardized protocol.
With MCP, Claude can:
- Pull campaign, ad set, and ad-level performance data
- Analyze creative effectiveness across placements
- Identify audience overlap and fatigue issues
- Compare performance across time periods
- Generate actionable optimization recommendations
Step 1: Create a Cogny Account
Go to cogny.com and sign up.
Create a warehouse for your data connections.
Time: 30 seconds
Step 2: Connect Meta Ads
In your dashboard, find Meta Ads under the channels list and click connect.
Sign in with your Facebook account that has Business Manager access. Select which ad accounts to connect.
Step 3: Add to Claude Code
In your Cogny dashboard, generate an API key. Then add the Cogny MCP server to your Claude Code config. This is the same endpoint for all Cogny integrations — the tools available are determined by which accounts you've connected.
{
"mcpServers": {
"cogny": {
"type": "http",
"url": "https://app.cogny.com/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_KEY"
}
}
}
}
Done. Claude now has access to your Meta Ads data — and any other platforms you connect through Cogny.
Step 4: Start Using Meta Ads in Claude
Once connected, ask Claude to analyze your Meta Ads data:
Example prompts:
- "Show me my top-performing ad sets this month by ROAS"
- "Which ads have frequency above 3 and declining CTR?"
- "Compare Instagram Reels vs Facebook Feed placement performance"
- "Find ad sets with audience overlap issues"
- "What's my cost per acquisition trend over the last 4 weeks?"
- "Which creative formats are driving the most conversions?"
Claude accesses your Meta Ads data through the MCP server's tools for campaigns, ad sets, ads, insights, and audience management.
Works With Any MCP Client
Cogny's managed MCP server works with every MCP-compatible client:
- Claude Code (CLI)
- Claude Desktop (Mac/Windows)
- Cursor (AI code editor)
- Windsurf (AI code editor)
- Continue (VS Code extension)
- Any custom MCP client built with the MCP SDK
Standard HTTP+SSE transport. No proprietary protocols.
The Token Problem Cogny Solves
Meta's OAuth flow is notoriously complex for AI agent use:
- Short-lived tokens expire in 1-2 hours
- Must be exchanged for long-lived tokens (60-day expiry)
- Long-lived tokens need refreshing before they expire
- If a token expires, user must re-authenticate manually
Cogny handles this entire lifecycle:
- Automatic short-to-long-lived token exchange on first connect
- Proactive token refresh before expiry
- Tokens encrypted at rest
- If refresh fails, you get a notification to re-authenticate
You never think about tokens again.
Security and Permissions
Claude asks before a write. Over MCP your AI client is the approval step: Claude asks before it runs a tool that creates ads, changes budgets or modifies targeting, unless you have allowed that tool in advance.
OAuth security:
- Sign in with Meta's own OAuth; no credentials stored on your machine
- Revoke access anytime from Cogny or Facebook settings
Tool permissions:
- Every write is logged with the tool, time, result and who authorised it
- Any tool can be set to blocked in Cogny, and a blocked tool is refused
Compared to Self-Hosted
| Feature | Cogny Managed MCP | Self-Hosted MCP |
|---|---|---|
| Setup time | 2 minutes | Days to weeks |
| Facebook app required | No | Yes |
| App review required | No | Yes (for production) |
| Token management | Automatic | You build it |
| 60-day token refresh | Handled | You implement |
| API versioning | Managed | You update |
| Server hosting | Managed | You host |
| Cost | Included in Cogny | Infrastructure + dev time |
Common Questions
Q: Do I need to create a Facebook developer app?
No. Cogny's managed server provides the OAuth flow. You just sign in and authorize.
Q: What about Meta's app review process?
Not needed. Cogny's app is already approved for the Marketing API. You connect through Cogny.
Q: Can Claude create or modify my ads?
Yes, when you approve it. Claude asks before each write, Cogny logs it, and you can block any write tool in Cogny.
Q: Does this cover Instagram too?
Yes. Meta Ads Manager handles both Facebook and Instagram. All placements and formats are accessible.
Q: What about WhatsApp and Messenger ad data?
Included. All Meta placement data is available through the same MCP server.
Q: How do I handle multiple ad accounts?
Connect all accounts through Cogny. They're accessible through a single MCP server endpoint.
Next Steps
- Connect Google Ads via MCP — cross-channel analysis
- Connect Google Analytics 4 via MCP — post-click behavior
- Meta Ads AI Automation Playbook — optimization strategies
- Instagram Creative Testing Playbook — systematic creative analysis
About Cogny MCP Servers
Cogny provides managed, remote MCP access to the marketing and business platforms listed at cogny.com/integrations/tools, with OAuth handling and token management included. It is built by the founders of Campanja.
Last Updated: April 2026