Connect Facebook and Google Ads to OpenAI Codex with AdChat
Add AdChat to the Codex CLI, IDE extension or ChatGPT desktop app with one URL and a browser sign-in. Ask about your Meta and Google ads from the terminal.

Try AdChat free for 7 days, no card. Start your trial
OpenAI Codex can connect to remote MCP servers, so you can ask it about your Facebook and Instagram ads, export numbers, or build reports while you work. This guide shows how to add AdChat to the Codex CLI. The same setup also works in the Codex IDE extension and the ChatGPT desktop app, because all three share one config file.
Google Ads too. The same AdChat link covers Google Ads. Connect Google in your AdChat account, when you sign in or later from your dashboard, and Codex sees your Facebook and Google ad accounts through this one server. There's nothing extra to add.
What you need
- Codex installed (CLI, IDE extension or ChatGPT desktop app).
- An AdChat account. Sign up. You can connect Facebook now or when you sign in from Codex.
How Codex connects
Codex supports remote "Streamable HTTP" MCP servers, which is what AdChat is. You add AdChat's URL, then sign in once in your browser. There's no key to copy.
Step 1: Add AdChat
Run:
codex mcp add adchat --url https://mcp.adchat.appOr open ~/.codex/config.toml (create it if it doesn't exist) and add:
[mcp_servers.adchat]
url = "https://mcp.adchat.app"If you only want AdChat in one project, put the same block in .codex/config.toml inside that project instead. Codex only reads project config for projects you've marked as trusted.
Step 2: Sign in
Run:
codex mcp login adchatA browser window opens. Sign in to AdChat, connect Facebook if you haven't yet, and click Allow. You only do this once. Codex stays connected as long as you use AdChat at least once every 90 days.
Step 3: Optional safety setting
Codex lets you decide when it should ask before using a server's tools. This setting makes it ask before any tool that isn't marked read-only:
[mcp_servers.adchat]
url = "https://mcp.adchat.app"
default_tools_approval_mode = "writes"Combined with AdChat's read-only default, that gives you two layers of protection.
Step 4: Check the connection
Run:
codex mcp listAdChat should appear in the list. Inside the Codex terminal app, type /mcp to see your active servers.
Try it on your own account. Connect your Meta and Google ads to Claude, ChatGPT or the built-in chat. 7-day free trial of everything, no credit card (built-in chat: 10 messages; unlimited in your own Claude or ChatGPT). Then from $29/month. Cancel anytime.
Start free trialStep 5: Ask a question
Start codex and try:
Use AdChat to show my active Facebook campaigns with spend, results and cost per result for the last 7 days.
Or:
With AdChat, pull daily spend for my ad account over the last 30 days and write it to a CSV.
More ideas are in Your first 10 questions to ask.
Using the IDE extension or ChatGPT desktop app
Both read the same ~/.codex/config.toml, so if you did the steps above, AdChat is already there. You can also add it through the app:
- Open settings (the gear menu in the IDE extension, Settings in the desktop app) and select MCP servers.
- Click Add server, name it
adchat, choose Streamable HTTP, and enterhttps://mcp.adchat.app. - Save, then restart the extension or app and sign in when asked.
Can't sign in? Use your key as a bearer token
Signing in is the way to go. If it doesn't work where you run Codex, you can send your AdChat key as a header instead. Your key is in the dashboard and starts with adchat_. Save it in your shell profile (for example ~/.zshrc):
export ADCHAT_KEY="adchat_..."Then point Codex at it:
[mcp_servers.adchat]
url = "https://mcp.adchat.app"
bearer_token_env_var = "ADCHAT_KEY"Codex then sends Authorization: Bearer <your key> with each request. Treat the key like a password. If it ever leaks, roll it in the dashboard and update ADCHAT_KEY.
Troubleshooting
AdChat isn't listed. Check the table name is exactly [mcp_servers.adchat] (with an underscore) and that the TOML is valid.
AdChat is listed but calls fail with an auth error. Check the URL is exactly https://mcp.adchat.app. The old AdChat address no longer works. Update the URL, then run codex mcp login adchat again. If you use the bearer token instead, run echo $ADCHAT_KEY in the same terminal to check the variable is set.
"Your AdChat free trial has ended". After the 7-day trial, AdChat needs a plan. Pick Weekly or Daily on the pricing page. On every plan, Codex asks you yes or no before each change. See How AdChat confirms changes.
Requests get slowed down. Use through your own AI apps is unlimited, with a limit of 120 requests per minute.
FAQ
Is this the same as ChatGPT on the web? No. ChatGPT web uses its own Plugins setup. See Connect AdChat to ChatGPT.
What if my key leaks?
This only matters if you use the bearer token. Click Roll API key in the API key section of the Claude & ChatGPT page. The old key stops working right away. Update ADCHAT_KEY with the new one.
Get going
Start your 7-day free trial. No credit card needed. Questions? Email [email protected].
Try it on your own ad account
Connect your Meta and Google ads to Claude, ChatGPT or our built-in chat in about a minute.
Questions? Email me at [email protected]
More in Get started
Part of All guides. New to connecting AI to your ads? Start with the Meta Ads MCP guide, which compares every option.
Use AdChat Without Claude or ChatGPT (Built-in Chat)
No AI subscription? Ask about your Facebook and Instagram ads in AdChat's own chat at adchat.app. Nothing to install, nothing to configure.
How to Connect Facebook and Google Ads to Claude with AdChat
Add AdChat to Claude as a custom connector in about two minutes. Paste one URL, sign in, and ask Claude about your Meta and Google ads in plain English.
How to Connect Facebook and Google Ads to ChatGPT with AdChat
Add AdChat to ChatGPT as a custom MCP server so you can ask about your Meta and Google ads in plain English. Covers plans, sign-in options and common errors.