tiktok-viral-factory
Generates natural-sounding voiceovers in multiple languages using ElevenLabs' text-to-speech API, supporting word-level timestamps for subtitles.
Provides language model capabilities for content research, script writing, strategy, and SEO optimization using OpenAI-compatible APIs.
Searches and retrieves free stock video footage from Pexels for video composition.
Searches and retrieves free stock video footage and images from Pixabay for video composition.
Publishes generated videos directly to TikTok Shop Affiliate account via the Content Posting API.
What is this?
A fully autonomous AI workforce that runs 7 specialized agents working together to:
Research trending TikTok Shop products in Beauty & Personal Care
Plan viral content strategies based on TikTok algorithm signals
Write hook-optimized scripts with karaoke-style word timestamps
Generate product hero shots using Kling AI (cinematic, not AI slop)
Compose full videos with ElevenLabs voiceover, stock footage, text overlays, SFX
Optimize SEO (hashtags, captions, posting time)
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 + hashtagsThis isnot 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.
Related MCP server: Scavio
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 SFXTech 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 | 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.txt2. Configure
cp .env.example .env
# Edit .env with your API keys3. 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.json4. 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 thumbnailProject 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 documentedKey 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
Architecture & PRD (1200+ lines)
Data models (22 Pydantic schemas)
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.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Vanszs/tiktok-viral-factory'
If you have feedback or need assistance with the MCP directory API, please join our Discord server