首页 AI Codex config.toml for the TikTok for Business MCP Server (2026): OAuth Login, Access-Token Headers, Tool Allowlists and Write Approvals

Codex config.toml for the TikTok for Business MCP Server (2026): OAuth Login, Access-Token Headers, Tool Allowlists and Write Approvals

Configure Codex for TikTok’s hosted ads MCP server: codex mcp add and login, flat vs layer URLs, enabled/disabled tools, writes approval mode and Access-Token.

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 tools

TikTok’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

KeyUse with TikTokWhy
urltt-ads-mcp-layer or tt-ads-mcp-flatLayer 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 toolsAlways ask for money-moving calls
disabled_toolsBusiness Center, payment and member toolsRemove account-level risk entirely
enabled_toolsRead tools only, for CI profilesHeadless jobs cannot write
env_http_headers{“Access-Token” = “TIKTOK_ACCESS_TOKEN”}Token path without OAuth; value from env
tool_timeout_sec120Large reports can be slow
Codex config.toml keys for the TikTok for Business MCP server

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

ProfileAuthToolsApproval
Interactive (buyer’s laptop)OAuth via codex mcp login (30 days)All except disabled listwrites + prompt on budget/status
Nightly CIAccess-Token header from a secretRead tools onlyprompt (never reached)
Script developmentNone (no MCP)—Codex writes code; tests mock the API
Three Codex profiles for TikTok ads work

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 /mcp in 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

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

PandaWM WeChat QR code szcwh99

Official sources

All official pages checked on 2026-11-16. API versions, tool names and permission requirements change; the official pages prevail.

本文来自网络,不代表熊猫出海立场。转载请注明出处: https://www.pandawm.com/blog/codex-tiktok-ads-mcp-config-toml-approval-en.html
上一篇
下一篇

作者: 熊猫出海编辑团队

熊猫出海(PandaWM)编辑团队,来自香港出海服务商熊猫出海,专注 Facebook、TikTok、Google 等海外广告开户与代投,以及 GEO/AI 搜索优化、多语言独立站建设。有Facebook白名单牌照户、TikTok加白户、Google G2认证户等核心资源 。

为您推荐

发表回复

联系我们

联系我们

工作时间:周一至周五,9:00-17:30,节假日休息

关注微信
微信扫一扫关注我们

微信扫一扫关注我们

关注微博
返回顶部