How to Connect Meta Ads to Claude: MCP and CLI Setup Guide
TL;DR: There are two ways to connect Meta Ads to Claude: the MCP server route (persistent connection, best for ongoing management) and the CLI route (quick commands, best for one-off tasks). Both require a Meta access token. This guide covers setup, permissions, safe workflows, and troubleshooting for each.
Managing Meta Ads through Claude turns campaign operations into conversational commands. Instead of clicking through Ads Manager, you describe what you want and Claude executes it. The setup takes about 15 minutes.
There are two connection methods. Choose based on how you work.
MCP vs CLI: Which Route to Choose
| Feature | MCP Server | CLI |
|---|---|---|
| Connection type | Persistent background process | Per-command execution |
| Best for | Ongoing campaign management, daily ops | One-off audits, quick pulls |
| Setup complexity | Moderate (config file + server) | Low (token + command) |
| Real-time data | Yes, maintains live connection | Fetches fresh on each call |
| Multi-account | Supports multiple accounts in config | One account per command |
| Recommended for | Brands/agencies managing daily | Brands running weekly check-ins |
Prerequisites
Before either setup, you need:
- A Meta Business Suite account with admin access to at least one ad account
- A Meta access token with the correct permissions
- Claude Code installed on your machine
Step 1: Generate Your Meta Access Token
- Go to developers.facebook.com
- Create a new app (type: Business)
- Navigate to Tools > Graph API Explorer
- Select your app from the dropdown
- Add these permissions:
ads_readads_managementbusiness_managementpages_read_engagement
- Generate the token
- For production use, exchange it for a long-lived token (60-day expiry)
Token Checklist
- Token has
ads_readpermission - Token has
ads_managementpermission (required for write operations) - Token has
business_managementpermission - Token is long-lived (not the default 1-hour token)
- Token is stored securely (environment variable, not hardcoded)
- You have noted your Ad Account ID (format:
act_XXXXXXXXXX)
Route A: MCP Server Setup
The MCP (Model Context Protocol) server creates a persistent connection between Claude and your Meta Ads account.
Install the MCP Server
npm install -g @anthropic/mcp-meta-ads
Configure the Connection
Create or edit your MCP config file:
{
"mcpServers": {
"meta-ads": {
"command": "mcp-meta-ads",
"env": {
"META_ACCESS_TOKEN": "your_token_here",
"META_AD_ACCOUNT_ID": "act_XXXXXXXXXX"
}
}
}
}
Start Claude with MCP
claude --mcp-config path/to/config.json
Once connected, you can talk to Claude naturally:
- "Show me all active campaigns and their ROAS for the last 7 days"
- "Pause any ad set spending more than $50 with ROAS below 1.5"
- "Create a new campaign with these settings..."
Route B: CLI Setup
The CLI route uses Claude Code skills to run Meta Ads commands directly.
Install the Ads Skill
claude install-skill /ads
Set Your Token
export META_ACCESS_TOKEN="your_token_here"
export META_AD_ACCOUNT_ID="act_XXXXXXXXXX"
Add these to your shell profile (.zshrc or .bashrc) for persistence.
Run Commands
claude "/ads meta show active campaigns"
claude "/ads meta get campaign performance --days 7"
Safe Workflow Practices
Connecting an AI to your ad account requires guardrails. Follow these rules:
Start read-only. Use
ads_readpermissions only for the first week. Get comfortable with the data pulls before enabling write access.Set budget limits in Meta. Configure account-level and campaign-level spending limits in Ads Manager. Claude cannot exceed limits set at the platform level.
Review before executing. When Claude suggests a write action (pause, create, adjust budget), review the proposed changes before confirming. Both MCP and CLI prompt for confirmation on write operations.
Use a test campaign first. Before running bulk operations, test on a single low-budget campaign to verify the connection works as expected.
Monitor token expiry. Long-lived tokens expire after 60 days. Set a calendar reminder to rotate your token before it lapses.
Never share your token. Treat it like a password. If compromised, revoke it immediately in Meta Business Settings.
Troubleshooting
"Invalid OAuth access token"
Your token has expired or was revoked. Generate a new one from the Graph API Explorer and update your config.
"Permission denied on ad account"
Your token does not have the required permissions for the requested action. Check that ads_read and ads_management are both granted, and that the token is associated with the correct ad account.
"MCP server not responding"
Restart the MCP server process. Check that the config file path is correct and the JSON is valid. Run mcp-meta-ads --health to verify the server is running.
"Ad account not found"
Verify your Ad Account ID includes the act_ prefix. The full format is act_XXXXXXXXXX.
"Rate limit exceeded"
Meta's API has rate limits. Space out bulk operations. The MCP server handles rate limiting automatically; the CLI route may require manual pacing for large data pulls.
What You Can Do Once Connected
With either route, Claude can:
- Pull campaign, ad set, and ad-level performance data
- Filter by date range, status, objective, or custom metrics
- Pause or activate campaigns and ad sets
- Adjust budgets and bids
- Create new campaigns with full targeting specs
- Generate performance reports in any format
- Cross-reference creative performance with spend data
If you would rather skip the setup and get ad creatives generated automatically, admade creates scroll-stopping ads from a product URL in under 2 minutes. No API tokens, no configuration, no prompt engineering.