tiktok-viral-factory

tiktok-viral-factory

Enables automated generation and publishing of TikTok Shop Affiliate videos using 7 AI agents. Integrates research, script writing, video production, and publishing through the MCP protocol.

Category
访问服务器

README

<p align="center"> <img src="https://raw.githubusercontent.com/vanszs/tiktok-viral-factory/main/docs/banner.png" alt="TikTok Viral Factory" width="800"> </p>

<h1 align="center"> TikTok Viral Factory</h1>

<p align="center"> <b>Multi-Agent AI System that generates, produces, and publishes TikTok Shop Affiliate videos — fully automated.</b><br> <sub>7 AI Agents · LangGraph · Kling AI · ElevenLabs · MCP Protocol</sub> </p>

<p align="center"> <a href="https://github.com/vanszs/tiktok-viral-factory/stargazers"><img src="https://img.shields.io/github/stars/vanszs/tiktok-viral-factory?style=for-the-badge&color=FF0050&logo=github" alt="Stars"></a> <a href="https://github.com/vanszs/tiktok-viral-factory/network/members"><img src="https://img.shields.io/github/forks/vanszs/tiktok-viral-factory?style=for-the-badge&color=25F4EE&logo=github" alt="Forks"></a> <a href="https://github.com/vanszs/tiktok-viral-factory/blob/main/LICENSE"><img src="https://img.shields.io/github/license/vanszs/tiktok-viral-factory?style=for-the-badge&color=white" alt="License"></a> <a href="#"><img src="https://img.shields.io/badge/Python-3.11+-blue?style=for-the-badge&logo=python&logoColor=white" alt="Python"></a> <a href="#"><img src="https://img.shields.io/badge/LangGraph-Powered-orange?style=for-the-badge" alt="LangGraph"></a> </p>

<p align="center"> <a href="#-quick-start"><img src="https://img.shields.io/badge/Quick_Start-FF0050?style=for-the-badge" alt="Quick Start"></a> <a href="#-architecture"><img src="https://img.shields.io/badge/Architecture-25F4EE?style=for-the-badge" alt="Architecture"></a> <a href="plan.md"><img src="https://img.shields.io/badge/Full_Plan_(1200_lines)-white?style=for-the-badge" alt="Full Plan"></a> </p>


What is this?

A fully autonomous AI workforce that runs 7 specialized agents working together to:

  1. Research trending TikTok Shop products in Beauty & Personal Care
  2. Plan viral content strategies based on TikTok algorithm signals
  3. Write hook-optimized scripts with karaoke-style word timestamps
  4. Generate product hero shots using Kling AI (cinematic, not AI slop)
  5. Compose full videos with ElevenLabs voiceover, stock footage, text overlays, SFX
  6. Optimize SEO (hashtags, captions, posting time)
  7. Publish to TikTok via Content Posting API

You provide the API keys. It does everything else.

Input:  TikTok Shop product URL
Output: Ready-to-post 15-60s TikTok video + optimized caption + hashtags

[!NOTE] This is not a "type your prompt, get a video" wrapper. This is a multi-agent system with real market research, content strategy, deduplication, cost tracking, and TikTok compliance built in.


Why this exists

Problem Solution
Creating TikTok content manually = 2-4 hours/video 100 videos/month, fully automated
AI-generated videos get flagged as "AI slop" and throttled Mixed pipeline: stock footage + AI hero shots + text overlays = human-feeling
Most AI video tools produce generic, soulless content 7 specialized agents — each one does ONE thing well
TikTok Shop Affiliate is lucrative but hard to scale Beauty & Personal Care niche = #1 GMV category, 15-25% commission
GPU requirements block most developers Cloud APIs (Kling, ElevenLabs) — runs on any laptop

Architecture

                        YOU (CLI)
                            │
                ┌───────────▼───────────┐
                │   SUPERVISOR          │
                │   (Marketing Director)│
                │   Routes + monitors   │
                └───────────┬───────────┘
                            │
         ┌──────────────────┼──────────────────┐
         │                  │                  │
         ▼                  ▼                  ▼
    RESEARCH          STRATEGY           ANALYTICS
    Market Intel      Content Plan       Performance
         │                  │
         │           ┌──────┴──────┐
         │           ▼             ▼
         │      SCRIPT         SEO AGENT
         │      WRITER         (Hashtags,
         │                     Captions)
         │           │
         └───────────▼
                PRODUCER
             (Video Engine)
             Kling AI + Stock +
             ElevenLabs + FFmpeg
                   │
                   ▼
               PUBLISHER
            (Upload to TikTok)

    ┌────────────────────────────────┐
    │        MCP BRIDGE              │
    │   Client ↔ Server              │
    │   Connect external tools       │
    │   Expose agents as MCP tools   │
    └────────────────────────────────┘

7 Agents

Agent Role Tools
Supervisor Marketing Director — routes tasks, monitors quality LLM + Router
Research Trending products, competitor analysis, market intel LLM + TikTok Research
Strategy Content calendar, hook library, posting schedule LLM + Trend DB
Script Writer 15-60s scripts with word timestamps, hook optimization LLM
SEO Hashtags, captions, posting time, TikTok algorithm signals LLM
Producer Video generation — Kling AI + stock footage + ElevenLabs TTS + FFmpeg Kling, Pixabay, Pexels, ElevenLabs, FFmpeg
Publisher Upload to TikTok, or export package for manual upload TikTok API
Analytics Track views, engagement, revenue, optimize strategy LLM + Analytics DB

Video Pipeline (Mixed Approach)

The key insight: pure AI-generated videos get throttled by TikTok. Our mixed approach feels human:

Stock Footage (60%)          AI Product Shots (20%)      Overlays (20%)
─────────────────────────    ────────────────────────    ─────────────────────
Pixabay/Pexels               Kling AI 2.5 Turbo Pro      FFmpeg
"woman applying cream"       "serum bottle, slow-mo      Text overlays
"close-up skincare routine"   cinematic, 9:16"           Subtitles (karaoke)
"glowing skin result"        $0.07/sec via fal.ai       SFX (whoosh, ding)

Video Output Example

[0-3s]   HOOK:   Stock footage + bold text overlay + whoosh SFX
[3-8s]   PROBLEM: Stock footage + voiceover "Punya masalah kulit kusam?"
[8-18s]  PRODUCT: Kling AI hero shot + ingredient callouts + voiceover
[18-25s] PROOF:   Stock "glowing skin" + voiceover "Coba ini..."
[25-30s] CTA:    Text overlay "Link di bio!" + product image + sparkle SFX

Tech Stack

Layer Technology Why
Framework LangGraph Supervisor pattern, native streaming, persistence
LLM OpenAI-compatible API Works with any provider (OpenAI, Groq, Together, local)
AI Video Kling 2.5 Turbo Pro (fal.ai) Best e-commerce product shots, $0.07/sec
Stock Footage Pixabay + Pexels FREE, HD, 100+ req/min
Voice ElevenLabs eleven_multilingual_v2 Natural voice, Indonesian support, word timestamps
Video Engine FFmpeg + moviepy Text overlays, composition, SFX, subtitles
Image Tools rembg Background removal for product photos
Protocol MCP (Model Context Protocol) Connect to any MCP server, expose agents as tools
Config Pydantic Settings Type-safe, .env driven

Cost Breakdown (100 videos/month)

Service Cost Notes
Kling AI ~$35/mo 5 sec product shots × 100 videos
ElevenLabs ~$10/mo 30s voiceover × 100 videos
LLM API ~$5/mo OpenAI-compatible, varies by provider
Stock Footage FREE Pixabay + Pexels
Total ~$50/month

Quick Start

Prerequisites

  • Python 3.11+
  • FFmpeg installed (apt install ffmpeg / brew install ffmpeg)
  • API keys: OpenAI-compatible LLM, fal.ai (Kling), ElevenLabs, Pixabay, Pexels

1. Clone & Install

git clone https://github.com/vanszs/tiktok-viral-factory.git
cd tiktok-viral-factory
pip install -r requirements.txt

2. Configure

cp .env.example .env
# Edit .env with your API keys

3. Run

# Generate a single video from a TikTok Shop product
python -m workflows.faceless --product-url "https://shop.tiktok.com/..."

# Batch generate from product list
python -m workflows.batch --input products.json --count 10

# Clip pipeline (transform existing content)
python -m workflows.clipping --source video.mp4

# Start MCP server (expose agents as tools)
python -m mcp_bridge.server

# Connect to external MCP tools
python -m mcp_bridge.client --config mcp_servers.json

4. Output

output/
├── video_20240115_143022.mp4     # Final video (1080x1920, 9:16)
├── video_20240115_143022.srt     # Subtitle file
├── metadata.json                  # Product data, SEO, timestamps
└── thumbnail.jpg                  # Auto-generated thumbnail

Project Structure

tiktok-viral-factory/
├── agents/              # 7 LangGraph agent nodes
├── config/
│   ├── prompts/         # System prompts for each agent
│   └── settings.py      # Pydantic settings (60+ config fields)
├── mcp_bridge/
│   ├── client.py        # Connect to external MCP servers
│   └── server.py        # Expose agents as MCP tools
├── models/
│   └── schemas.py       # 22 Pydantic models (state, products, videos)
├── tools/               # Image search, Kling, TTS, FFmpeg, SEO
├── utils/
│   └── llm.py           # OpenAI-compatible LLM factory
├── workflows/           # 3 pipelines: faceless, clipping, batch
├── fonts/               # Custom .ttf for text overlays
├── sfx/                 # Sound effects (whoosh, ding, sparkle)
├── output/              # Generated videos + metadata
├── plan.md              # Full 1200-line implementation plan
└── .env.example         # All config fields documented

Key Features

  • Anti-AI-Slop: Mixed pipeline (stock + AI hero shots + overlays) avoids TikTok's AI content throttling
  • Content Deduplication: Hash-based tracking prevents generating duplicate content across runs
  • Cost Tracking: Real-time budget monitoring per video and monthly cap ($50 default)
  • Kling AI Fallback: If AI video fails, automatically falls back to static product image with FFmpeg zoom + sparkle
  • Smart Stock Search: Searches vertical first → smart crop → letterbox → pan&scan for any orientation
  • Word-Level Subtitles: ElevenLabs timestamps enable karaoke-style subtitle sync
  • MCP Protocol: Full MCP Bridge — connect to any tool ecosystem, expose your agents to other systems
  • Multi-LLM: Works with OpenAI, Groq, Together AI, Ollama, or any OpenAI-compatible API

Roadmap

  • [x] Architecture & PRD (1200+ lines)
  • [x] Data models (22 Pydantic schemas)
  • [x] Configuration system (60+ typed settings)
  • [ ] MCP Bridge (Client + Server)
  • [ ] Tools layer (Kling, ElevenLabs, Pixabay, FFmpeg)
  • [ ] 7 Agents implementation
  • [ ] 3 Video pipelines (faceless, clipping, batch)
  • [ ] TikTok Content Posting API integration
  • [ ] Analytics dashboard
  • [ ] Batch mode (100 videos/month)
  • [ ] Multi-niche support (beyond Beauty & Personal Care)

Contributing

PRs welcome! Areas where help is most needed:

  • More niches: Extend beyond Beauty & Personal Care
  • More stock sources: Additional free stock footage APIs
  • Better prompts: Improve agent system prompts with real-world results
  • UI: Simple web dashboard for monitoring

License

MIT — do whatever you want with it. If you make money from it, that's the point.


<p align="center"> <b>If this helps you build your TikTok empire, drop a star.</b><br> <a href="https://github.com/vanszs/tiktok-viral-factory/stargazers"> <img src="https://img.shields.io/badge/Star_this_repo-FF0050?style=for-the-badge&logo=github" alt="Star"> </a> </p>

<p align="center"> <sub>Built with caffeine and LangGraph in Indonesia</sub> </p>

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选