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.
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 - Full read access to campaigns, ad sets, ads, 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 stored in Supabase Vault (encrypted at rest)
- If refresh fails, you get a notification to re-authenticate
You never think about tokens again.
Security and Permissions
Read-only by default. Claude can analyze your campaigns but cannot create ads, change budgets, or modify targeting.
OAuth security:
- Tokens encrypted in Supabase Vault
- Signed URLs with HMAC-SHA256 (5-minute expiry)
- No credentials stored on your machine
- Revoke access anytime from Cogny or Facebook settings
Tool permissions:
- Read tools auto-approved (insights, reporting, listing)
- Write tools require explicit opt-in
- Per-tool blacklisting available
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?
Not by default. Read-only tools are enabled. Write operations require explicit configuration.
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 servers for 12+ marketing and business platforms. All servers include OAuth handling, token management, and enterprise-grade security. Built by the team behind AI optimization systems for Netflix, Zalando, and Momondo at Campanja.
Last Updated: April 2026
Try Cogny free
Connect your marketing platforms to Claude Code in under 2 minutes. No credit card required.