Sponsored by Deepsite.site

Tiktok Ads Mcp Server

Created By
AdsMCP3 months ago
TikTok Ads MCP Server – Model Context Protocol Server for TikTok Ads Marketing API Integration
Content

TikTok Ads MCP Server

A Model Context Protocol (MCP) server for TikTok Ads API integration. This server enables AI assistants like Claude to interact with TikTok advertising campaigns, providing comprehensive campaign management, analytics, and optimization capabilities.

Part of the AdsMCP project - MCP servers for advertising platforms.

Features

  • Campaign Management: Create, read, and update campaigns and ad groups
  • Performance Analytics: Retrieve detailed performance metrics and insights
  • Audience Management: Handle custom audiences and targeting options
  • Creative Management: Upload and manage ad creatives
  • Reporting: Generate and download custom performance reports

Installation

Prerequisites

  • Python 3.10+
  • TikTok For Business account with API access
  • TikTok Ads Developer account and app registration

Local Installation

# Clone the repository
git clone <repository-url>
cd adsmcp-server

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -e .
# Install with uv
uv sync

Configuration

Environment Variables

Create a .env file in the project root:

TIKTOK_APP_ID=your_app_id
TIKTOK_APP_SECRET=your_app_secret
TIKTOK_ACCESS_TOKEN=your_access_token
TIKTOK_ADVERTISER_ID=your_advertiser_id

MCP Client Configuration

Add to your MCP client configuration (e.g., Claude Desktop):

{
  "mcpServers": {
    "tiktok-ads": {
      "command": "python",
      "args": ["/path/to/adsmcp-server/run_server.py"],
      "env": {
        "TIKTOK_APP_ID": "your_app_id",
        "TIKTOK_APP_SECRET": "your_app_secret",
        "TIKTOK_ACCESS_TOKEN": "your_access_token",
        "TIKTOK_ADVERTISER_ID": "your_advertiser_id"
      }
    }
  }
}

Available Tools

Authentication

  • tiktok_ads_login - Start TikTok Ads OAuth authentication flow
  • tiktok_ads_complete_auth - Complete OAuth authentication with authorization code
  • tiktok_ads_auth_status - Check current authentication status
  • tiktok_ads_switch_ad_account - Switch to a different advertiser account

Campaign Management

  • tiktok_ads_get_campaigns - Retrieve all campaigns for the advertiser account
  • tiktok_ads_get_campaign_details - Get detailed information about a specific campaign
  • tiktok_ads_get_adgroups - Retrieve ad groups for a campaign

Performance & Analytics

  • tiktok_ads_get_campaign_performance - Get performance metrics for campaigns with detailed metrics support
  • tiktok_ads_get_adgroup_performance - Get performance metrics for ad groups with breakdowns

Authentication

TikTok Ads API Setup

  1. Register as Developer

  2. Get API Credentials

    • App ID and App Secret from your registered app
    • Generate access token through OAuth flow
    • Note your Advertiser ID
  3. OAuth Flow (for production)

    • Implement OAuth 2.0 flow for user authorization
    • Handle token refresh automatically
    • Store tokens securely

Development vs Production

  • Development: Use long-lived access tokens
  • Production: Implement full OAuth flow with refresh tokens

Security Best Practices

  • Never commit API credentials to version control
  • Use environment variables for sensitive data
  • Implement proper token rotation
  • Monitor API usage and rate limits
  • Use HTTPS for all communications

API Rate Limits

TikTok Ads API has the following limits:

  • 1000 requests per hour per app
  • 10 concurrent requests
  • Specific endpoint limits may apply

The server includes built-in rate limiting and retry logic.

Error Handling

The server provides comprehensive error handling:

  • API rate limit management
  • Token expiration handling
  • Network connectivity issues
  • Invalid parameter validation

Development

Running Tests

# Install dev dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Run with coverage
pytest --cov=tiktok_ads_mcp

Code Formatting

# Format code
black .
isort .

# Type checking
mypy .

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for new functionality
  5. Run the test suite
  6. Submit a pull request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

For issues and questions, please create an issue in this repository.

Changelog

v0.1.0 (Initial Release)

  • Basic TikTok Ads API integration
  • Campaign and ad group management
  • Performance reporting
  • OAuth authentication support
Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
DeepChatYour AI Partner on Desktop
ChatWiseThe second fastest AI chatbot™
Tavily Mcp
WindsurfThe new purpose-built IDE to harness magic
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
Serper MCP ServerA Serper MCP Server
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
Playwright McpPlaywright MCP server
CursorThe AI Code Editor
Amap Maps高德地图官方 MCP Server