Skip to main content
LiveProduct

Codex integration

Search and draft ads from the Codex CLI or desktop agent.

Codex supports Model Context Protocol servers over HTTP. Point Codex at TexoAI's MCP endpoint with a project token and the six tools become available to your Codex sessions. Everything is scoped to one project; there is no advertising-account access.

Connection methods

MCPAvailable

The server answers initialize, notifications/initialized, tools/list and tools/call over HTTPS POST (JSON-RPC 2.0). Notifications return an empty 202; the same tools are always callable as a plain API.

Setup

  1. Create a token
    In Developer settings, create a project token and choose the scopes you need (ads:read, boards:read, monitors:read, jobs:read, clones:submit). Copy the one-time mad_ value.
  2. Add the MCP server
    Add the server to your Codex config so Codex can reach the endpoint.
    Codex · Setup
    [mcp_servers.meta-ads]
    url = "https://<your-site>/api/developer/mcp"
    http_headers = { Authorization = "Bearer mad_..." }
  3. Restart and test
    Restart Codex so the server loads, then ask it to list the available tools or search the ad library.

Try it

With the server connected, a quick smoke check:

codex exec "list the tools available through the meta-ads MCP server"
codex exec "search the ad library for running ads"

Available tools

ads.search
Read
ads:read
ads.get
Read
ads:read
ads.live_search_start
Write
ads:live
ads.live_search_get
Read
ads:read
boards.list
Read
boards:read
monitors.list
Read
monitors:read
jobs.get
Read
jobs:read
clones.submit
Write
Approved draft-only static job; never publishes to an ad account.

Common errors

Failures come back as HTTP 400 with a JSON-RPC error object (code + message), not as HTTP 401/403/429.

-32001 — invalid or missing token
tools/call requires a valid Authorization: Bearer mad_... header. Missing and invalid tokens both return JSON-RPC -32001 (HTTP 400). initialize, notifications/initialized and tools/list do not need a token.
-32003 — insufficient scope
The token is valid but lacks the scope the tool requires. Returned as JSON-RPC -32003 (HTTP 400). Change the token scopes in Developer settings, or call a read-only tool.
-32003 — rate limit exceeded
The token's one-minute window is exhausted. Returned as the same JSON-RPC -32003 (HTTP 400). Wait for the reset or raise the rate limit in Developer settings.
-32603 — tool failed
The tool call failed on the server. The HTTP status is still 400; check the JSON-RPC id and message for details.

FAQ