All guides
Get started

Connect Facebook Ads to Claude Code with AdChat (CLI Setup)

Add AdChat to Claude Code with one claude mcp add command. Covers sign-in, scopes, checking status with /mcp, and common fixes.

Updated October 24, 2026

Claude Code is Anthropic's coding assistant that runs in your terminal. It can also use MCP servers, which means you can ask it about your Facebook and Instagram ads, pull numbers into a script, or build a quick report without leaving the command line. This guide shows you how to add AdChat in one command.

If you just want to chat about your ads, the Claude web and desktop setup is easier. Claude Code is a good fit if you already live in the terminal.

What you need

  • Claude Code installed and working.
  • An AdChat account. Sign up. You can connect Facebook now or during sign-in.

Step 1: Add AdChat with one command

Run this in your terminal:

bash
claude mcp add --transport http adchat https://mcp.adchat.app

What each part means:

  • --transport http tells Claude Code that AdChat is a remote server reached over HTTP.
  • adchat is the name you'll see in Claude Code.
  • https://mcp.adchat.app is AdChat's server URL. There's no key in it. You sign in instead.

Step 2: Choose a scope (optional)

By default, Claude Code adds the server with local scope: it's only available in the project folder where you ran the command, and only to you. You can change that with --scope:

ScopeWhere it worksWhere it's saved
local (default)This project only, just you~/.claude.json
userAll your projects~/.claude.json
projectThis project, shared with your team.mcp.json in the project folder

For most people, user is the most convenient, so AdChat is there wherever you open Claude Code:

bash
claude mcp add --transport http adchat --scope user https://mcp.adchat.app

project scope is safe to share, because the config only holds the URL:

json
{
  "mcpServers": {
    "adchat": {
      "type": "http",
      "url": "https://mcp.adchat.app"
    }
  }
}

Each person then signs in with their own AdChat account and sees only their own ad accounts.

Step 3: Sign in

Start Claude Code and type:

/mcp

Pick adchat and choose to sign in. A browser window opens. Sign in to AdChat, connect Facebook if you haven't yet, and click Allow. You only do this once. Claude Code stays connected as long as you use AdChat at least once every 90 days.

Back in /mcp, AdChat should show as connected. From your regular terminal, claude mcp list shows the same list.

Step 4: Ask a question

In Claude Code, try:

Use AdChat to list my ad accounts, then show spend, clicks and cost per result for each active campaign over the last 7 days as a table.

Or something more hands-on:

Pull last month's daily spend and results for my top campaign with AdChat and save it as a CSV file called spend.csv.

Claude Code asks for permission before it uses a new tool, so you stay in control. More prompt ideas are in Your first 10 questions to ask.

Can't sign in? Use your key as a header

Signing in is the way to go. If you're running Claude Code somewhere a browser can't open, you can send your AdChat key as a header instead. Your key is in the dashboard and starts with adchat_:

bash
claude mcp add --transport http adchat --scope user https://mcp.adchat.app \
  --header "Authorization: Bearer adchat_..."

Treat your key like a password. Don't put it in a .mcp.json that gets committed to git. If it ever leaks, roll it in the dashboard and the old key stops working.

Removing or changing it

To remove AdChat, or to re-add it:

bash
claude mcp remove adchat --scope user

Use the same scope you added it with.

Troubleshooting

AdChat shows as failed in /mcp. Check the URL is exactly https://mcp.adchat.app. The old AdChat address no longer works. Remove AdChat, add it again with the new URL, then run /mcp and sign in. If you use the header instead, the key must start with adchat_ and come right after Bearer (with one space).

It works in one folder but not another. You used the default local scope. Remove it and add it again with --scope user.

"Write access is not enabled". AdChat is read-only by default. Turn on Write Access in your dashboard if you want Claude Code to make changes. Read Turn on write access first.

Rate limit errors. Use through your own AI apps is unlimited, but capped at 30 requests per minute. Long loops can hit that. Ask Claude Code to slow down or batch its requests.

FAQ

Does my Facebook token ever reach Claude Code? No. Claude Code only gets an AdChat sign-in, never your Facebook token. AdChat keeps your Facebook token encrypted on its side and calls Meta for you.

Can I use AdChat in Claude Code and Cursor? Yes. Add the same URL in each app and sign in once per app. See Cursor and other MCP clients.

Start now

Try it free for 7 days. No credit card needed. Questions? Email [email protected].

Try it on your own ad account

Connect your Meta ads to Claude, ChatGPT or our built-in chat in about a minute.

Start free for 7 daysNo credit card needed. Then $19/month. Cancel anytime.

Questions? Email me at [email protected]