TI

TikTok Ads MCP Server for Campaign Management

Manage TikTok Ads with an MCP server to streamline campaign management, performance analytics, audience targeting, creative assets, and custom reporting.

Quick Install
npx -y @AdsMCP/tiktok-ads-mcp-server

Overview

The TikTok Ads MCP Server is a Model Context Protocol (MCP)–compatible backend that centralizes TikTok Ads account operations for campaign management, analytics, audience segmentation, creative handling, and reporting. It abstracts TikTok Ads API calls into higher-level MCP actions so LLM-based agents or automation pipelines can coordinate ad lifecycle tasks with context-aware commands.

This server is useful when you want a single integration point for programmatic campaign orchestration and analytics ingestion. It handles authentication, rate-limiting, and common operations (create/update campaigns, pull performance metrics, upload creatives, build audiences, export reports), and exposes a simple HTTP API and OpenAPI spec so developer tools, notebooks, and low-code platforms can interact reliably.

Features

  • MCP-compatible endpoint for context-driven model interactions
  • CRUD operations for campaigns, ad groups, and creatives
  • Performance metrics ingestion and aggregation (daily/hourly)
  • Audience management and lookalike segmentation utilities
  • Creative asset uploads and version control
  • Custom report generation and CSV/JSON export
  • OpenAPI / Postman collection for rapid integration
  • Dockerized deployment and environment variable configuration
  • Rate limit handling and retry logic for TikTok Ads API

Installation / Configuration

Prerequisites:

  • Docker (recommended) or Node.js (16+) and npm
  • TikTok Ads developer credentials (app id, app secret, access token)

Clone and run with Docker:

git clone https://github.com/AdsMCP/tiktok-ads-mcp-server.git
cd tiktok-ads-mcp-server

# Build and run
docker build -t tiktok-ads-mcp-server .
docker run -e TIKTOK_APP_ID=your_app_id \
           -e TIKTOK_APP_SECRET=your_app_secret \
           -e TIKTOK_ACCESS_TOKEN=your_access_token \
           -e MCP_API_KEY=your_mcp_key \
           -p 8080:8080 \
           tiktok-ads-mcp-server

Run locally (Node.js):

git clone https://github.com/AdsMCP/tiktok-ads-mcp-server.git
cd tiktok-ads-mcp-server
npm install

# Copy env template and edit
cp .env.example .env
# Edit .env and set TIKTOK_APP_ID, TIKTOK_APP_SECRET, TIKTOK_ACCESS_TOKEN, MCP_API_KEY

npm start

.env example:

MCP_PORT=8080
MCP_API_KEY=changeme
TIKTOK_APP_ID=your_app_id
TIKTOK_APP_SECRET=your_app_secret
TIKTOK_ACCESS_TOKEN=your_access_token
DATABASE_URL=postgres://user:pass@db:5432/mcp

API Endpoints

Common endpoints exposed by the server (OpenAPI available at /openapi.json):

PathMethodDescription
/mcp/executePOSTExecute an MCP-style command payload (recommended for LLM orchestration)
/api/campaignsGET/POSTList or create campaigns
/api/campaigns/{id}GET/PATCH/DELETEManage a single campaign
/api/adsGET/POSTManage ad groups / ads
/api/metricsGETQuery aggregated performance metrics
/api/audiencesGET/POSTCreate or list audiences
/api/creativesPOSTUpload creative assets
/api/reportsPOSTGenerate custom reports (CSV/JSON)

Authentication: include your MCP API key in Authorization header:

Authorization: Bearer <MCP_API_KEY>

Example: create a campaign (curl)

curl -X POST http://localhost:8080/api/campaigns \
  -H "Authorization: Bearer $MCP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name":"Brand Awareness - Spring",
    "objective":"TRAFFIC",
    "budget":10000,
    "status":"PAUSED"
  }'

MCP execute example (context-driven request):

POST /mcp/execute
{
  "session_id": "agent-123",
  "context": {"account_id":"act_456"},
  "command": {
    "type": "create_campaign",
    "payload": {"name":"LLM-driven", "objective":"CONVERSIONS", "budget":5000}
  }
}

Available Resources

  • OpenAPI specification: /openapi.json (served by the server)
  • Postman collection: included in repo /postman/TikTok-Ads-MCP.postman_collection.json
  • Example notebooks: /examples (Python and JavaScript snippets for common flows)
  • SDK examples: minimal Node.js helper in /sdk and Python helper in /py_sdk
  • Dockerfile and Kubernetes YAML for containerized deployments
  • Logging and metrics: Prometheus-compatible metrics at /metrics

Use Cases

  1. Automated campaign creation from an LLM assistant

    • An agent uses /mcp/execute to ask the server to create campaigns with targeting and budget parameters derived from a chat conversation. The server validates fields, calls TikTok Ads API, and returns a normalized result.
  2. Scheduled performance reports for stakeholders

    • A scheduler calls /api/reports to generate daily summaries (CTR, CPC, conversions) and exports CSVs to an S3 bucket or sends them via email/webhook.
  3. Audience orchestration and lookalike generation

    • Use /api/audiences to build custom audiences from first-party user lists, then request the server to generate lookalike segments and attach them to new ad groups.
  4. Creative asset pipeline

    • Upload creatives via /api/creatives. The server handles file storage, registers assets with TikTok, and keeps a versioned catalog for reuse across campaigns.
  5. Data export for BI tools

    • Pull aggregated metrics from /api/metrics to feed into analytics platforms (BigQuery, Snowflake) or visualization tools for cross-channel analysis.

Notes and Best Practices

  • Rotate TikTok credentials periodically and store secrets in a secure vault.
  • Test new endpoints in a sandbox TikTok Ads account before using production budgets.
  • Monitor /metrics and TikTok API rate limits to avoid throttling; the server includes retry/backoff logic but follow rate guidance.
  • Use the OpenAPI spec and Postman collection to generate client SDKs or to bootstrap integrations.