Skip to content
Meta Ads + Claude Code-10 min read-English

Connect Meta Ads to Claude Code

Step-by-step guide to connect your Meta ad account to Claude Code via MCP Server. Pull campaign data, analyze performance, and get recommendations - directly from your terminal. No Pipeboard, no third party. Direct connection to the Meta Marketing API.

What you'll learn

Contents

  1. 01.Why Connect Meta to Claude Code
  2. 02.Create a Meta Developer App
  3. 03.Generate a System User Token
  4. 04.Install the Meta Ads MCP Server
  5. 05.Connect to Claude Code
  6. 06.Verify It Works
  7. 07.Permissions - Basic vs Advanced
  8. 08.What You Get After Connecting
  9. 09.Troubleshooting
PART 01

Why Connect Meta to Claude Code

ChatGPT can write ad copy for you. But it can't log into your Meta account, pull real numbers, and tell you which campaign to kill.

Claude Code with MCP can. It connects directly to the Meta Marketing API, pulls live data (CPM, CPC, CTR, ROAS), analyzes performance, and gives recommendations based on real data - not made-up numbers.

The connection runs locally on your machine. No proxy server, no third party, no subscription fees. Data flows directly from Meta to you.

PART 02

Create a Meta Developer App

If you already have a Meta developer app, skip to the next section.

PART 03

Generate a System User Token (safe + permanent)

This is the most important step. Instead of generating a personal token that expires in 1-2 hours, we'll create a System User Token that never expires and isn't tied to your personal Facebook account.

Why System User?

  • Never expires - unlike personal tokens that expire in 1-2 hours
  • Read-only option - ads_read can't modify or delete anything
  • Not tied to your personal account - separate from your Facebook profile
  • Revocable anytime from Business Manager
PART 04

Install the Meta Ads MCP Server

Run in your terminal:

git clone https://github.com/brijr/meta-mcp.git meta-ads-mcp
cd meta-ads-mcp
npm install @modelcontextprotocol/sdk@1.25.2 --save-exact
npm install

Important: You must pin the SDK version to 1.25.2 - newer versions break the server due to schema format changes.

PART 05

Connect to Claude Code

Run in your terminal (replace YOUR_TOKEN with the token you copied):

claude mcp add meta-ads --scope user \
  -e META_ACCESS_TOKEN=YOUR_TOKEN \
  -- npx tsx /path/to/meta-ads-mcp/src/index.ts

Replace /path/to/ with the full path to where you cloned the project. After running the command, restart Claude Code.

PART 06

Verify It Works

After restarting Claude Code, ask:

"Show me all my ad accounts"

If everything is working, you'll see a list of your ad accounts with name, currency, and timezone.

More things you can ask:

"List my active campaigns"
"Analyze last week's performance"
"What's the ROAS for each campaign?"
"Which campaign is most profitable and which should I kill?"
"Compare campaign A vs campaign B"
"Show me audience breakdown by age and gender"
PART 07

Permissions - Basic vs Advanced

When generating the token, you choose which permissions to grant. Three tiers:

TierPermissionsWhat You Get
Ads onlyads_readView campaigns, analyze performance, reports, breakdowns
Ads + Instagram (recommended for dashboard)ads_read + business_management + pages_show_list + pages_read_engagement + instagram_basic + instagram_manage_insightsEverything above + Instagram post analytics, stories, reels, reach, followers
Full (management)All above + ads_management + pages_manage_adsAlso manage campaigns, create audiences, upload creatives

For the workshop dashboard: use the second tier (Ads + Instagram) for the full picture.

PART 08

What You Get After Connecting

53 tools available via the MCP:

Everything runs locally. Data flows directly from Meta API to your machine. No third party, no proxy server, no subscription fees.

PART 09

Troubleshooting

Run claude mcp list and look for meta-ads:

"Invalid token" error:The token expired or isn't authorized. Go back to Business Manager > System Users > Generate Token and create a new one.

SDK error:If you see errors about "Zod schema" or "ToolAnnotations", the SDK version is wrong. Run npm install @modelcontextprotocol/sdk@1.25.2 --save-exact.

Want more guides like this?

Tutorials on Claude Code, AI agents, automation, and more.

All Guides