---
title: 'Codex for Meta ads, with approvals | Plainrouter'
description: 'Connect Codex to Meta ads with an environment-held workspace key. Inspect synthetic results and approve supported changes through Plainrouter.'
canonical: 'https://plainrouter.com/agents/codex/meta'
last_updated: '2026-10-08'
---

# Codex for Meta ads, with your approval.

Codex can review Meta ads and prepare supported changes through Plainrouter. Sign up in Plainrouter, connect Meta and start with Read access.

[Start for free](/register) · [Try the sandbox](/docs/mcp/setup#start-in-test-mode)

## What can Codex do with Meta ads?

Codex can read account context, retained performance, the creative library and stored signal-health evidence, then explain the returned data alongside your development work. Ask it to state the reporting period and missing inputs rather than treating every stored read as fresh Meta data.

Connect Plainrouter’s remote MCP server within your existing Codex workflow, using an environment-held workspace key. Begin with Read access, then switch to Write when you want to prepare proposals for individual approval in Ask mode.

With Write access, supported actions include pauses and resumes for selected campaigns, ad sets and ads, eligible daily-budget changes, and creative tests. Preview a supported change before proposing it; new ad copies start paused and require a separate governed resume to activate. See the [shared Meta ads agent capabilities](/solutions/meta-ads-agent) for the supported workflow, not unrestricted API access.

## How do I connect Codex to Meta ads?

Connect Codex to the remote MCP endpoint in `~/.codex/config.toml`, starting with the account-free sandbox.

```toml
[mcp_servers.plainrouter_test]
url = "https://plainrouter.com/mcp/sandbox"
```

Run `codex mcp list` to check the entry, then ask Codex for an account-state read through `plainrouter_test`. A discovered server alone is not evidence of a successful read: inspect the returned `sandbox: true` field.

For production, sign up in Plainrouter, connect Meta and create a Read workspace key. Supply `PLAINROUTER_WORKSPACE_TOKEN` through your protected environment before launching Codex. Add a separate production entry:

```toml
[mcp_servers.plainrouter]
url = "https://plainrouter.com/mcp"
bearer_token_env_var = "PLAINROUTER_WORKSPACE_TOKEN"
```

The configuration stores the variable name, not the key. Never put the key in a Codex prompt, a committed file or a literal bearer-header example. Each entry has one endpoint; keeping separate names lets you ask explicitly for the test server while exploring synthetic data.

Run `codex mcp list` again and verify a production account read returns the intended workspace. Name the ad account if the workspace has several. Use the [Plainrouter connection reference](/docs/mcp/setup) and [Codex MCP configuration guide](https://learn.chatgpt.com/docs/extend/mcp) for full setup and client options.

## How do approvals work in Codex?

Codex’s approval to call an MCP tool is not Plainrouter’s approval to change an ad. You can allow a client tool call without approving the resulting Action.

Read access cannot preview or propose Actions; use it for the initial account review.

When ready for proposals, configure Write access and select Ask mode in Plainrouter. Ask Codex to preview a named change first, inspect the returned evaluations, then submit the proposal if appropriate. Codex displays tool results in its conversation; the proposal result is not a receipt that Meta executed the change. Review the specific proposal in Plainrouter’s Inbox and check its decision receipt.

Full mode queues policy-allowed changes automatically, regardless of a prompt asking Codex to wait. Both modes block rule violations. Plainrouter’s kill switch stops further changes, including queued work; it does not undo completed actions. Revoke the workspace key when removing the connection.

## What can’t Codex do through this connection?

Plainrouter’s focused workflow does not provide audience creation, lifetime-budget changes or unrestricted [Marketing API access](/library/meta-ads-api). A Codex recommendation cannot guarantee better ad performance, and a preview cannot authorize execution by itself.

Codex also needs the token in the environment of the process making the connection. A variable available in one terminal is not necessarily available in another launcher. If authentication fails, inspect that process environment and the workspace key instead of sharing the credential in the chat. The sandbox entry needs no token and cannot be used for production writes.

## Worked example: inspect a structured result

Codex can inspect synthetic account and performance fields to check which server answered. With `plainrouter_test` configured, ask:

> Read account state and performance from plainrouter_test only. Show the returned account identifier, data source and whether a Marketing API call happened. Do not propose or execute anything.

The synthetic tools return `sandbox: true`, account `act_SANDBOX`, `marketing_api_called: false`, `gateway_verified: 1264` and `meta_reported: 1189`.

The performance tool also reports `data_source: "stored_reconciliation_reports"`. The counts are fictional: 1,264 verified conversions and 1,189 Meta-reported conversions.

Ask Codex to point to those exact fields rather than simply report that setup succeeded. The tool output is the evidence. This checks server selection and your ability to inspect structured reads. It does not verify a real account, prove advertising performance or demonstrate an approval: the sandbox has no proposal or write tools.

## How does this differ from Meta’s official Ads MCP?

Plainrouter is an independent hosted server with its own policy, approval and conversion-check workflow. Meta’s official server is an alternative when you only need Meta’s own tools.

Compare the [Meta Ads MCP options](/library/meta-ads-mcp-options) rather than assuming both servers expose the same controls.

## Frequently asked questions

### Does Codex need an OAuth login for this setup?

This documented configuration uses a Plainrouter workspace key through `bearer_token_env_var`. It does not require pasting the key into the conversation.

### Can I keep sandbox and production configured together?

Yes, under separate MCP server names. State which one Codex should use, and inspect the returned workspace or `sandbox: true` before drawing conclusions.

### Can Codex change spend with a Read key?

No. Action previews and proposals require Write. A Read key covers account, creative and tracking reads; the optional ingestion diagnostic is a separate test-event operation.

### Are Codex costs included?

No. Your AI client’s charges are separate. Plainrouter includes MCP on every plan and does not meter MCP calls; see [current pricing](/pricing).

## Related guides

- [What your Meta ads agent can do](</solutions/meta-ads-agent>)
- [Hosted Meta Ads MCP overview](</solutions/meta-ads-mcp>)
- [AI agent safety checklist](</library/ai-agent-meta-ads-safety>)
- [Agents hub](</agents>)
- [Claude Code for Meta ads](</agents/claude/meta>)
- [ChatGPT for Meta ads](</agents/chatgpt/meta>)
- [Connection and workspace access](</docs/mcp/setup>)
