Skip to main content

TikTok GMV Max MCP

A read-only Model Context Protocol server for the TikTok Business (Marketing) API, with first-class GMV Max support. Ask your assistant how your GMV Max campaigns, regular ads, and Business Center budgets are doing, and get answers in your shop's timezone and in USD.

It runs daily in production behind a multi-shop TikTok Shop reporting stack, so most of the code beyond plain API wrappers handles things the raw API gets wrong. Report days are realigned from the ad account's timezone to the shop's. Non-USD accounts are converted at that day's rate. TikTok's transient 51010 timeouts are retried.

The Python import package tiktok_ads_mcp has the same name as the one in the tiktok-ads-mcp PyPI distribution, so don't install both into the same environment.

Tools (24, all read-only)

GMV Max

Tool What it returns
get_gmvmax_campaigns_tool GMV Max campaigns with status and ROI-protection info
get_gmvmax_campaign_info_tool Budget, bid, products and schedule for one campaign
get_gmvmax_reports_tool GMV Max performance reports (/gmv_max/report/get/)
get_gmvmax_report_aligned_tool One shop-timezone day, rebuilt from hourly data: cost, gross revenue, orders, ROI
get_gmvmax_range_report_tool Aggregate cost / GMV / orders / ROI for a date range
get_gmvmax_videos_tool Videos available to GMV Max for a store
get_gmvmax_store_list_tool Stores linked to a GMV Max advertiser

Accounts, campaigns and ads

Tool What it returns
get_business_centers_tool Business Centers visible to the token
get_authorized_ad_accounts_tool All authorized advertiser accounts
get_campaigns_tool / get_ad_groups_tool / get_ads_tool Campaign, ad group and ad lists with filtering
get_identities_tool TikTok identities (creator accounts) authorized to an advertiser
get_video_info_tool Video asset URL, poster and duration by video ID

Reporting

Tool What it returns
get_reports_tool Integrated reports with custom dimensions and metrics
get_ads_report_aligned_tool Manual-bid ads, one shop-timezone day: cost, GMV, orders, ROAS
get_ads_range_report_tool Manual-bid ads aggregate for a date range
get_creative_report_tool Creative-level video insights (engagement, play metrics)

Business Center finance

Tool What it returns
get_advertiser_balance_tool Balance and basic info per advertiser (≤100 IDs per call)
get_bc_balance_tool Business Center available funds
get_bc_account_cost_tool Spend per ad account under a BC for a date range
get_bc_transactions_tool Top-ups and deductions at BC or advertiser level
get_bc_budget_changelog_tool Who changed an advertiser's budget, and when

Discovery

Tool What it returns
get_trending_list_tool Trending hashtags by country (7 or 30 days), optional daily history

Install

Requires Python 3.10+.

uvx tiktok-gmvmax-mcp          # run without installing
# or
pip install tiktok-gmvmax-mcp  # provides the `tiktok-gmvmax-mcp` command

Configure

Create an app in the TikTok for Business developer portal, grant it read permissions for the endpoints you need (ad accounts, campaigns and ads, reporting, GMV Max, Business Center), and generate a long-lived access token.

Variable Required Meaning
TIKTOK_APP_ID yes App ID
TIKTOK_SECRET yes App secret
TIKTOK_ACCESS_TOKEN yes Access token
TIKTOK_ACCESS_TOKEN_2 no Second token (e.g. another Business Center), tried on permission errors
TIKTOK_ADVERTISER_ID no Default advertiser
TIKTOK_SANDBOX no true to use the sandbox API
TIKTOK_REQUEST_TIMEOUT no Seconds, default 30
TIKTOK_ADS_PROXY no Proxy URL used only for Business API calls
LARK_BOT_CACHE_DIR no Where FX rates are cached (default ~/.cache/lark-bot)

Versions before 0.2 read the token from TIKTOK_ACCESS_TOKEN_XINCHENG / TIKTOK_ACCESS_TOKEN_ZECHENG. Those names still work.

Claude Desktop / Claude Code (mcpServers):

{
  "mcpServers": {
    "tiktok-gmvmax": {
      "command": "uvx",
      "args": ["tiktok-gmvmax-mcp"],
      "env": {
        "TIKTOK_APP_ID": "your_app_id",
        "TIKTOK_SECRET": "your_secret",
        "TIKTOK_ACCESS_TOKEN": "your_access_token"
      }
    }
  }
}

Behavior worth knowing

  • Timezones. TikTok reports days in the ad account's timezone. The *_aligned_tools fetch hourly rows and re-aggregate them into a day in the shop's timezone, so ad spend lines up with shop orders.
  • Currency. Cost and revenue from non-USD accounts are converted to USD at that day's ECB midpoint rate (Frankfurter). If the rate API is down, a small built-in table of approximate rates is used for that call only and never cached; any other currency is then returned unconverted (rate 1.0) with a logged error.
  • Retries. Code 51010 (TikTok backend timeout) is retried with backoff at the client layer. Rate-limit and 5xx errors are retried too.
  • mcp 1.x and 2.x. Both work: the server imports MCPServer (2.x) and falls back to FastMCP (1.x).

Development

git clone https://github.com/Buer2333/tiktok-gmvmax-mcp && cd tiktok-gmvmax-mcp
python -m venv .venv && .venv/bin/pip install -e ".[dev]"
.venv/bin/python -m pytest tests -q

Issues and PRs are welcome. Please include a test with any behavior change.

Changelog

0.2.1

  • Repository renamed to tiktok-gmvmax-mcp; package links updated.

0.2.0

  • Published as tiktok-gmvmax-mcp.
  • Generic TIKTOK_ACCESS_TOKEN / TIKTOK_ACCESS_TOKEN_2. The legacy names still work.
  • CLI logs go to stderr, so stdout stays clean for the stdio protocol.
  • FX: a fallback rate used during an API outage is no longer cached permanently.
  • 18 tools added since 0.1.x: GMV Max, aligned and range reports, creatives, Business Center finance, identities, trending. Also added: account discovery, 51010 retry, USD conversion, mcp 2.x compatibility.

0.1.x

  • Six core tools, async httpx client, FastMCP server.

License

MIT. See LICENSE.

Credits

The six core campaign/report tools are based on ysntony/tiktok-ads-mcp (MIT).

Metadata

Release files for tiktok-gmvmax-mcp 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tiktok-gmvmax-mcp 0.2.1
File Size Uploaded Provenance Actions
tiktok_gmvmax_mcp-0.2.1.tar.gz 66.8 kB Without provenance Details for tiktok_gmvmax_mcp-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tiktok-gmvmax-mcp 0.2.1
File Interpreter ABI Platform Actions
tiktok_gmvmax_mcp-0.2.1-py3-none-any.whl Python 3 none any Details for tiktok_gmvmax_mcp-0.2.1-py3-none-any.whl

Total release size: 156.5 kB

Release files / tiktok_gmvmax_mcp-0.2.1.tar.gz

Download URL tiktok_gmvmax_mcp-0.2.1.tar.gz
Size 66.8 kB
Tags Source
SHA-256 checksum
How to use checksums
e7b96c5abbac0a507c1b60ca9d4334bfd335ce71ee203548f99694044f844e12
BLAKE2b-256 checksum
How to use checksums
24a1e59a754c96492033945b8f6655865d908d98d97497263798a5b2998f80bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / tiktok_gmvmax_mcp-0.2.1-py3-none-any.whl

Download URL tiktok_gmvmax_mcp-0.2.1-py3-none-any.whl
Size 89.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
94e6280f3564229ad9577a36f6c342d55798e53a253e67740e0074024ea90862
BLAKE2b-256 checksum
How to use checksums
e8ab8e3621ea88b6b626660bd9061a6693aef30d1b279c4cb5f4fa41f2d9e534
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Security for tiktok-gmvmax-mcp 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page