Last updated: 16 November 2026. TikTok API for Business (v1.3), the TikTok for Business MCP Server, Anthropic and OpenAI documentation checked that day.
TikTok lists Codex among the ready-made agents that can connect to the TikTok for Business MCP Server without a developer app (connection guide). Connecting takes one command; making it safe takes a few lines of config.toml. This guide covers both.
Connect
# Codex CLI: add TikTok's hosted MCP server and sign in (OAuth, CIMD/DCR)
npm install -g @openai/codex
codex mcp add tiktok-ads --url https://business-api.tiktok.com/open_mcp/tt-ads-mcp-layer
codex mcp login tiktok-ads # opens TikTok for Business authorization in the browser
codex mcp list
# inside the codex TUI: /mcp shows the server and its toolsTikTok’s MCP server uses OAuth 2.0 with PKCE and supports CIMD or DCR client registration (custom agent guide). Codex supports both, so codex mcp login opens the TikTok for Business authorisation page directly (Codex MCP). Authorisation lasts 30 days.
The keys that matter
| Key | Use with TikTok | Why |
|---|---|---|
| url | tt-ads-mcp-layer or tt-ads-mcp-flat | Layer loads ~40 core tools; flat ~400 |
| default_tools_approval_mode | “writes” | Prompts for every tool not marked read-only |
| tools.<tool>.approval_mode | “prompt” on budget and status tools | Always ask for money-moving calls |
| disabled_tools | Business Center, payment and member tools | Remove account-level risk entirely |
| enabled_tools | Read tools only, for CI profiles | Headless jobs cannot write |
| env_http_headers | {“Access-Token” = “TIKTOK_ACCESS_TOKEN”} | Token path without OAuth; value from env |
| tool_timeout_sec | 120 | Large reports can be slow |

Interactive profile
# ~/.codex/config.toml (or a trusted project's .codex/config.toml)
[mcp_servers.tiktok-ads]
url = "https://business-api.tiktok.com/open_mcp/tt-ads-mcp-layer"
tool_timeout_sec = 120
default_tools_approval_mode = "writes" # prompt for every tool not marked read-only
disabled_tools = [
"bc_member_invite", "bc_asset_assign", "bc_transfer",
"payment_portfolio_credit_line_update", "advertiser_update",
]
[mcp_servers.tiktok-ads.tools.smart_plus_adgroup_budget_update]
approval_mode = "prompt" # always ask before budget edits
[mcp_servers.tiktok-ads.tools.campaign_status_update]
approval_mode = "prompt"The writes mode depends on servers marking read-only tools. TikTok’s tools carry the MCP readOnlyHint annotation, so reads run without prompts and everything else asks (config reference).
Headless profile with an access token
For unattended jobs, TikTok also accepts a Marketing API access token in an Access-Token header instead of OAuth; API rate limits then apply. Codex can read the header value from an environment variable:
# Path 2: Marketing API long-term access token instead of OAuth (headless jobs)
[mcp_servers.tiktok-ads-ci]
url = "https://business-api.tiktok.com/open_mcp/tt-ads-mcp-layer"
env_http_headers = { "Access-Token" = "TIKTOK_ACCESS_TOKEN" } # value read from env
enabled_tools = ["advertiser_info_get", "campaign_get", "adgroup_get",
"report_integrated_get", "report_task_create", "report_task_check"]
default_tools_approval_mode = "prompt"The token comes from the Marketing API authorisation flow; see Codex + TikTok Marketing API: Python Smart+ pipeline. Two tools, auth_advertiser_get and tto_oauth2_tcm_get, additionally need X-TT-ADS-MCP-APP-ID and X-TT-ADS-MCP-APP-SECRET headers when used with a token (tool list). Leave them out of CI profiles unless you need them.
Three profiles
| Profile | Auth | Tools | Approval |
|---|---|---|---|
| Interactive (buyer’s laptop) | OAuth via codex mcp login (30 days) | All except disabled list | writes + prompt on budget/status |
| Nightly CI | Access-Token header from a secret | Read tools only | prompt (never reached) |
| Script development | None (no MCP) | — | Codex writes code; tests mock the API |

Rules Codex reads every time
# AGENTS.md (repo root) - rules Codex reads before every task
## TikTok ads automation rules
- Only touch advertiser IDs listed in accounts.allowlist (our own / client-authorised,
assigned in the client's Business Center).
- Read TIKTOK_APP_ID, TIKTOK_APP_SECRET and TIKTOK_ACCESS_TOKEN from env vars.
Never print, log or commit them, never put them in prompts.
- Create every campaign, ad group and ad with operation_status = "DISABLE".
Never send "ENABLE". A media buyer turns delivery on in Ads Manager.
- Generate request_id once per create call (string of a 64-bit int) and reuse it
on retries so TikTok de-duplicates.
- Budgets are floats in account currency. Never raise a budget >20% in one change.
- Respect rate limits: on code 40100/40016 back off; after a QPM hit wait 5 minutes.
- Upgraded Smart+ ads: max one create/update/status call per ad every 5 seconds.
- Do not build new non-Search Legacy Manual campaigns (unsupported from 2027-01-01).
- Run `pytest -q` and `python -m scripts.dry_run` before proposing changes.
- Flag finance, health, gambling/games, dating and AIGC creatives for human policy review.Checks after setup
- Run
/mcpin the Codex TUI and confirm the tools you expect are listed and the disabled ones are not. - Ask Codex to create a test Smart+ campaign and confirm it prompts, sends DISABLE and returns an ID you can see paused in Ads Manager.
- Remember per-tool limits: 6 QPS per tool per user, and one call per Smart+ ad every 5 seconds (
- MCP overview
- ).
How PandaWM uses Claude, Codex and TikTok ad accounts to speed up client ad delivery
This guide focuses on Codex, but in day-to-day client work PandaWM combines Claude, Codex and TikTok ad accounts to help companies going global move faster through the repetitive loop of account and pixel/event setup → Smart+ campaign builds → creative upload and pre-review → reports and diagnosis → budget and rule changes, so media buyers spend their time on creative strategy, bidding judgement and scaling.
- Ad accounts: the client’s own TikTok ad account opened under its real business entity; accounts that need industry entry approval (games, finance and similar) go through TikTok’s industry entry process; accounts can also be opened through an authorised agency. Every account belongs to the client, is never rented or shared, and is managed in the client’s own Business Center.
- Claude: natural-language reporting, TikTok’s official diagnosis agent, creative organisation and Smart+ build plans through the official TikTok for Business MCP Server, with every write tool confirmed before it runs.
- Codex: Python scripts on Marketing API v1.3 (report pulls, rate-limit retries, Smart+ builds created as DISABLE with idempotent request_id) that run in a sandbox or on a schedule.
- Human sign-off: a media buyer approves turning delivery on, budget increases and bid changes, and a person makes the final call on TikTok advertising policy for creatives and landing pages.
This describes a service capability only. There are no prices or rebates here, and PandaWM is not an official partner of TikTok, Anthropic or OpenAI. See TikTok Ads account opening & management (PandaWM service page) for account opening and management.
FAQ
Flat or layer?
Layer for most Codex work: fewer tools in context and on-demand discovery. Flat when you need the full library visible.
Can I put the token in config.toml?
Avoid it. Use env_http_headers so the value stays in the environment or a secret store.
Does disabling tools hide them from the model?
Yes. disabled_tools removes them from what Codex can call.
Is Claude set up the same way?
Similar ideas, different files; see Claude Code guardrails for the TikTok Ads MCP server.
Compliance note: Use every workflow in this guide only on TikTok ad accounts (including accounts assigned to you in a Business Center) that your company owns or is formally authorised to manage, through TikTok’s official TikTok API for Business, the TikTok for Business MCP Server or TikTok Ads Manager. Follow TikTok’s advertising policies, industry entry requirements and API rate limits, and keep a human review step before anything that can spend money. PandaWM does not sell, rent, share or transfer ad accounts, Business Centers or API credentials, does not help anyone bypass ad review, industry entry, regional restrictions or identity verification, and is not an official partner of TikTok, Anthropic or OpenAI. Claude and OpenAI services are only offered in their supported countries and regions; the account holder should be an entity legitimately established and operating in a supported region.
Related guides
- TikTok Ads account opening & management (PandaWM service page)
- Overseas AI Token service: account setup + API access (PandaWM)
- Codex + TikTok Marketing API: Python Smart+ pipeline
- Claude Code guardrails for the TikTok Ads MCP server
- How to connect Claude to TikTok Ads (step by step)
- TikTok Ads MCP server: let AI agents run your ads
- Codex config.toml for Google Ads MCP (Google)
- Codex config.toml for Meta ads MCP: approvals and guardrails
- How to get an OpenAI API key
Talk to PandaWM: TikTok Ads accounts + AI-assisted delivery
Tell us where your company is registered, your industry (and whether it needs industry entry approval), target countries, landing page, app or TikTok Shop, and expected monthly budget, plus which part you want to automate first (reporting, creatives, Smart+ builds or rules). We pre-check eligibility and creatives, help you open your own TikTok ad account compliantly, and wire Claude / Codex into your workflow.
WhatsApp: +852 5904 8602Telegram: @PANDA0134WeChat: szcwh99

Official sources
- TikTok: How to connect a ready-made agent to TikTok for Business MCP Server
- TikTok: How to connect a custom agent to TikTok for Business MCP Server
- TikTok: Available tools in TikTok for Business MCP Server
- TikTok API for Business: TikTok for Business MCP Server overview
- OpenAI: Codex and MCP
- OpenAI: Codex configuration reference
- OpenAI: Custom instructions with AGENTS.md
- OpenAI: Supported countries and territories
All official pages checked on 2026-11-16. API versions, tool names and permission requirements change; the official pages prevail.

微信扫一扫打赏
支付宝扫一扫打赏
