Research & Benchmarks Optimization AI Ads Analytics Why Madgicx? About Us Blog Careers Case Studies Events Glossary Guides Answers Pricing Login Try for Free

Meta Ads CLI: Run Meta Ads From Your Terminal With AI Agents

Category
AI Marketing
Date updated
Nov 12, 2026
Reading time
30 mins
Meta Ads CLI: Run Meta Ads From Your Terminal With AI Agents

Meta's Ads CLI manages campaigns from a terminal with a system user token. This guide covers what it does, who it suits, and the MCP route that needs one command and a browser sign-in.

Yes, you can run Meta ads from your terminal with an AI agent, and there are two routes. Meta's Ads CLI is a command-line program you install and authenticate with a system user access token. The other route is an MCP server: you add the Madgicx MCP for Meta ads to Claude Code, Codex or Cursor with one command or one config line, sign in through your browser, and ask for what you want in plain language. This guide covers what Meta's Ads CLI does, who it suits, and how the second route compares.

Work on your Meta ads from the terminal

Add the Madgicx MCP to Claude Code, Codex or Cursor with one line, sign in and ask in plain words. Every change waits for your confirmation. Included in the 7-day free trial.

Start your 7-day free trial

What is Meta's Ads CLI?

Meta's Ads CLI is a command-line tool for managing Meta ad campaigns from a terminal. Meta announced it on April 29, 2026 alongside its ads MCP server, as part of Meta's ads AI connectors, which Meta calls an open beta. It wraps Meta's Marketing API, so you can create, edit and analyze campaigns without writing custom code. Meta describes its commands as predictable and structured, which is what makes it a good fit for scripts, automated workflows and AI agents that run shell commands.

The command is meta. According to Meta's Ads CLI overview, it covers:

  • Campaigns, ad sets and ads: list, get, create, update and delete.
  • Creatives: create and manage the creatives that ads use, including image uploads.
  • Insights: performance numbers such as spend, impressions, CTR and ROAS for a date range.
  • Catalogs, product items, product sets and product feeds.
  • Datasets (pixels): list, create, connect to an ad account or catalog, and assign users.
  • Reference data: ad accounts and Pages.

Every command needs an ad account ID. Output comes as a table, JSON or plain tab-separated text, and the program returns exit codes that a script can check.

Two safeguards built in

Per Meta's documentation, new campaigns, ad sets and ads are created paused by default, so nothing goes live until you update the status to active. Interactive prompts also appear by default. Flags such as --no-input and --force switch the prompts off for unattended runs, which is useful in a pipeline and worth remembering if an agent is the one typing the commands.

How to install and sign in

The Ads CLI get started page lists macOS or Linux as the supported systems. Install with Homebrew, which Meta recommends:

brew tap facebook/fb
brew trust facebook/fb
brew install facebook/fb/meta-ads

Or with pip, which needs Python 3.12 or newer:

pip install meta-ads
meta --version

Authentication uses a system user access token. In Meta's setup, you do this in Business Settings:

  1. Create a system user with the Admin or Employee role.
  2. Add the system user to your app with a role such as Full Access.
  3. Add the system user to each ad account, and assign any pixels, Pages or catalogs it needs.
  4. Generate a token for that system user and grant the permissions Meta lists, including ads_management, business_management and read_insights.

Then put the token, app ID, app secret and ad account ID in a .env file in the directory you run from, or export the token as an environment variable. Check the setup with meta auth status, and list your accounts with meta ads adaccount list.

Example commands from Meta's documentation

# list campaigns
meta ads campaign list

# pull performance numbers
meta ads insights get --fields spend,impressions,ctr,cpc

# list the Pages the account can use
meta ads page list

# turn a campaign on (it was created paused)
meta ads campaign update CAMPAIGN_ID --status ACTIVE

Meta's announcement also shows meta ads campaign create, meta ads adset create and meta ads ad create for building a campaign step by step. Check Meta's command reference for the flags and the budget units before you run a create command.

Who Meta's Ads CLI suits

  • Developers and technical teams who already work in a terminal and are comfortable creating system users and tokens in Business Settings.
  • Scripts and pipelines that need the same operation to run the same way every time, including in CI.
  • Anyone who wants to create campaigns, ad sets, ads, creatives and catalogs from the command line rather than from Ads Manager.

If an AI agent is part of that workflow, the agent runs meta commands in your shell, using the token you configured. Review what it plans to run, and keep the prompts on.

Beta status and setup limits

Everything below comes from Meta's own pages, and Meta may update the setup details.

  • Open beta. Meta calls its ads AI connectors, the CLI included, an open beta.
  • macOS or Linux. Meta's get started page lists these as the requirements for installing the CLI.
  • System user token. Authentication needs a system user access token, which you create in Business Settings, then assign to your app and each ad account. Every command also needs an ad account ID.
  • Python 3.12 or newer for the pip route. Meta states no Python requirement for the Homebrew route.
  • Not stated. Meta's pages do not state a price or usage limits for the CLI.

The other route: an MCP server inside your terminal assistant

Claude Code, Codex and Cursor can all connect to MCP servers, which are connectors that give an AI assistant a list of actions on another service. That means you can work on your Meta ads from the same terminal session without learning a command syntax. The Madgicx Facebook Ads MCP is an MCP server, not a program you install, and it works like this:

  1. Add it with one command or one config line. In Claude Code, run claude mcp add --transport http madgicx https://mcp.madgicx.com/mcp. In Cursor, add an entry with that URL to mcp.json. In Codex, add a [mcp_servers.madgicx] block with the same URL to config.toml.
  2. Sign in with your browser. In Claude Code, run /mcp and follow the steps; in Codex, run codex mcp login madgicx. You log in with your Madgicx account and pick a team. There is no system user, token or app secret to manage, and your password is never shared with the assistant.
  3. Ask in plain language. The assistant picks the right action for your question.

The setup guides are in connect Facebook ads to Claude Code, connect Meta ads to Codex and connect Meta ads to Cursor. You need a Madgicx subscription or the 7-day free trial, which includes the MCP, and a Facebook ad account connected in Madgicx.

What it reads and what it changes

The Facebook Ads MCP reads your ad accounts, campaigns, ad sets, ads and creatives, your Facebook Pages and posts, the account change history, Event Match Quality, and results at account, campaign, ad set and ad level for the dates you pick. Results come as one total per period with Meta's own calculated rates, such as spend, results, cost per result, purchase ROAS, CTR and frequency, so to see a trend you ask for two periods.

It can pause and restart campaigns, ad sets and ads, raise or lower budgets, set or lower ad set bids and spending limits, and add, remove or replace text in names.

Every change waits for you. The assistant shows the exact change in the chat, such as the campaign, the old budget and the new one, and runs it only after you confirm.

Google Ads in the same session

Meta's tool covers Meta only. The Madgicx setup adds a second server, the Google Ads MCP, which uses the same Madgicx login. It reads your Google Ads accounts, campaigns, ad groups, ads and performance, and runs custom Google Ads queries for search terms, keywords and placements. It is read only: it changes nothing in a Google Ads account. With both servers connected, one terminal session can compare your Facebook and Google results.

Meta's Ads CLI and the Madgicx MCP, side by side

Meta's Ads CLI Madgicx MCP
Install Partly.Homebrew or pip (Python 3.12+), macOS or Linux Yes.One command or config line, nothing else to install
Sign-in Partly.System user access token from Business Settings Yes.Browser sign-in with your Madgicx login
What you type Partly.meta commands and flags Yes.Plain-language prompts
Google Ads No.Meta only Yes.Read-only Google Ads MCP, same login
Confirmation Yes.Interactive prompts by default; flags turn them off Yes.Every change shown, then run after you confirm

The two are not rivals in every case. A team can use Meta's tool for scripted campaign creation and the MCP route for the daily questions and adjustments.

Example prompts to paste into your terminal assistant

Once the server is connected, you ask for jobs instead of typing commands. These four each have a step-by-step page with what the assistant reads and what the answer looks like.

  • "Make a report for last week and compare it with the week before." You get a campaign table with spend, results, cost per result and ROAS. See how to make a Facebook ads report.
  • "Which ads spent over $100 in the last 14 days with no purchases?" The assistant lists them at ad level. See how to find wasted ad spend.
  • "My cost per purchase went up this week. What changed?" The assistant compares two periods and reads the change log. See why performance dropped.
  • "Pause the ads on that list." The assistant shows the exact ads and pauses them only when you say yes. See how to pause ads after you confirm.

Which route should you choose?

If you want to try an AI agent on your Meta ads today, start with the Madgicx 7-day free trial and add the MCP to the terminal assistant you already use. It takes a few minutes and needs no token setup. Meta's Ads CLI is the baseline from Meta itself: choose it when you need to create campaigns, ad sets, ads and catalogs from scripts, and you are comfortable setting up a system user.

For a wider look at the servers available, see our comparison of the best MCP for Meta ads. For background, read what a Facebook ads MCP is and how to connect AI assistants to Meta ads safely.

If you are still deciding how much to hand to AI, our guides on how top advertisers use AI for Meta campaigns, running Facebook ad diagnostics and vertical AI agents for Meta ads show what the work looks like, and the answer to can AI run Meta ads is short.

Frequently asked questions

Is there a Meta Ads CLI?

Yes. Meta released its Ads CLI on April 29, 2026, as part of its ads AI connectors, which Meta calls an open beta. It installs with Homebrew or pip and runs meta commands for campaigns, ad sets, ads, creatives, insights, catalogs and datasets.

Is there a Facebook Ads CLI?

Meta's Ads CLI is the same tool: it manages ads on Meta's platforms, Facebook and Instagram included, through the Marketing API. People searching for a Facebook ads CLI are usually looking for it.

Does Madgicx have a command-line tool?

No. Madgicx offers MCP servers, which are connectors that terminal assistants such as Claude Code, Codex and Cursor can use. You add one with a single command or config line and sign in through your browser.

Can an AI agent use Meta's Ads CLI?

Meta says the CLI's structured commands suit AI agents and tools. An agent that can run shell commands can call it with your configured token, so check what it plans to run, and note that the CLI creates new items paused by default.

Which AI assistants can use the Madgicx MCP in a terminal?

Claude Code, Codex and Cursor, with a setup guide for each. Any assistant that accepts a remote MCP server with sign-in can connect.

How do I use Meta's Ads CLI with Claude Code?

Install the CLI and set up your system user token as above, then ask Claude Code to run meta commands in your shell. Check what it plans to run before you approve it. Or skip the token and add the Madgicx MCP with claude mcp add --transport http madgicx https://mcp.madgicx.com/mcp; see connect Facebook ads to Claude Code.

Does the Meta Ads CLI work on Windows?

Meta's get started page lists macOS or Linux as the requirements. It does not describe a Windows install. The Madgicx MCP is a hosted server you connect from your assistant, so it does not depend on your operating system.

Meta ads MCP or CLI: which should I use?

If you want to try an AI agent on your Meta ads now, add the Madgicx MCP: one command or config line, a browser sign-in and plain-language prompts. Choose Meta's Ads CLI when you want scripted commands and are comfortable creating a system user token. The table above compares the two.

Will the Madgicx MCP change my ads without asking?

No. Every change, such as a pause or a budget change, is shown in full and runs only after you confirm it in the chat.

Can I use Google Ads in the same session?

Yes. Connect the Google Ads MCP next to the Meta one with the same Madgicx login. It analyzes Google Ads accounts and is read only.

You scrolled so far. You want this. Trust us.