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.
npx -y @AdsMCP/tiktok-ads-mcp-serverOverview
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:
# Build and run
Run locally (Node.js):
# Copy env template and edit
# Edit .env and set TIKTOK_APP_ID, TIKTOK_APP_SECRET, TIKTOK_ACCESS_TOKEN, MCP_API_KEY
.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):
| Path | Method | Description |
|---|---|---|
| /mcp/execute | POST | Execute an MCP-style command payload (recommended for LLM orchestration) |
| /api/campaigns | GET/POST | List or create campaigns |
| /api/campaigns/{id} | GET/PATCH/DELETE | Manage a single campaign |
| /api/ads | GET/POST | Manage ad groups / ads |
| /api/metrics | GET | Query aggregated performance metrics |
| /api/audiences | GET/POST | Create or list audiences |
| /api/creatives | POST | Upload creative assets |
| /api/reports | POST | Generate custom reports (CSV/JSON) |
Authentication: include your MCP API key in Authorization header:
Authorization: Bearer <MCP_API_KEY>
Example: create a campaign (curl)
MCP execute example (context-driven request):
POST /mcp/execute
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
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.
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.
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.
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.
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.