๐ต TikTok MCP Server
The first complete TikTok MCP server with publish, interact, and browse
Search โข Download โข Publish โข Like โข Comment โข Follow โข Analyze Trends โ all from your AI assistant.
โก Why tiktok-mcp?
Most TikTok MCP servers only let you read data. This one lets you act.
- ๐ Browse โ Search videos, explore hashtags, scroll the For You Page
- ๐ฅ Download โ Save videos without watermark (HD when available)
- ๐ค Publish โ Upload videos directly to TikTok via Creator Center
- ๐ฌ Interact โ Like, comment, and follow โ all automated
- ๐ Analyze โ Cross-keyword trend analysis with top hashtags & creators
12 tools. One server. Full TikTok automation.
๐ ๏ธ All 12 Tools
| Tool | Description |
|---|---|
tiktok_search |
Search TikTok videos by keyword. Returns author, description, views, URL, hashtags. |
tiktok_trending |
Get trending/For You videos from TikTok's main feed. |
tiktok_feed |
Scroll the For You Page like a real user and collect video metadata. |
tiktok_user_videos |
Get all videos from a specific user's profile with their stats. |
tiktok_video_info |
Get detailed metadata for a specific video (stats, audio, hashtags, description). |
tiktok_hashtag |
Explore a hashtag โ view count, popular videos, and stats. |
tiktok_download |
Download a TikTok video without watermark (HD when available via tikwm). |
tiktok_publish |
Publish a video to TikTok with caption and hashtags via Creator Center. |
tiktok_interact |
Like, comment, or follow โ interact with any video or creator. |
tiktok_sounds |
Get trending sounds/music on TikTok. |
tiktok_session |
Manage your TikTok session: check login, refresh cookies, export session. |
tiktok_analyze_trend |
Multi-keyword trend analysis: top hashtags, top creators, posting patterns. |
๐ Installation (3 Steps)
1. Clone & Install
git clone https://github.com/follox42/tiktok-mcp.git
cd tiktok-mcp
pip install -e .
playwright install chromium
2. Get Your TikTok Cookies
You need authenticated cookies for publish/interact features. Two options:
Option A โ From TikSimPro (recommended):
# If you use TikSimPro, cookies are already at:
~/TikSimPro/tiktok_cookies.pkl
Option B โ Export manually:
- Log into TikTok in your browser
- Use a cookie export extension (e.g., "Get cookies.txt")
- Save as JSON:
[
{"name": "sessionid", "value": "xxx", "domain": ".tiktok.com", "path": "/"},
{"name": "sid_tt", "value": "xxx", "domain": ".tiktok.com", "path": "/"}
]
3. Set Environment Variables
export TIKTOK_COOKIES_PATH="/path/to/your/cookies.pkl" # or .json
export TIKTOK_HEADLESS=true # false to see the browser
export TIKTOK_MIN_INTERVAL=2.0 # rate limit between calls (seconds)
export TIKTOK_DOWNLOAD_DIR="./downloads"
โ๏ธ Configuration
Claude Desktop (claude_desktop_config.json)
{
"mcpServers": {
"tiktok": {
"command": "tiktok-mcp",
"env": {
"TIKTOK_COOKIES_PATH": "/home/you/TikSimPro/tiktok_cookies.pkl",
"TIKTOK_HEADLESS": "true"
}
}
}
}
mcporter
{
"servers": {
"tiktok": {
"command": "tiktok-mcp",
"env": {
"TIKTOK_COOKIES_PATH": "/home/you/TikSimPro/tiktok_cookies.pkl"
}
}
}
}
Direct (stdio)
tiktok-mcp
# or
python -m tiktok_mcp
๐ Usage Examples
๐ Search Videos
Use tiktok_search to find "AI productivity" videos
{"query": "AI productivity", "count": 10}
๐ Analyze a Niche
Analyze trends for "solopreneur" and "indie hacker" โ what hashtags and creators dominate?
{"keywords": ["solopreneur", "indie hacker", "build in public"], "count_per_keyword": 15}
๐ค Research a Creator
Get the last 20 videos from @garyvee
{"username": "garyvee", "count": 20}
๐ฅ Download a Video
Download this video without watermark: https://www.tiktok.com/@user/video/123456
{"video_url": "https://www.tiktok.com/@user/video/123456"}
๐ค Publish a Video
Publish my video with caption "Building in public day 47 ๐" and hashtags buildinpublic, startup, coding
{
"video_path": "/path/to/video.mp4",
"caption": "Building in public day 47 ๐",
"hashtags": ["buildinpublic", "startup", "coding"]
}
๐ฌ Interact (Like / Comment / Follow)
Like this video and leave a comment: "This is incredible! ๐ฅ"
{"action": "like", "video_url": "https://www.tiktok.com/@user/video/123456"}
{"action": "comment", "video_url": "https://www.tiktok.com/@user/video/123456", "text": "This is incredible! ๐ฅ"}
{"action": "follow", "video_url": "https://www.tiktok.com/@user/video/123456"}
๐ต Trending Sounds
What sounds are trending on TikTok right now?
{"count": 20}
๐ Session Management
Check if my TikTok session is still active
{"action": "check_login"}
{"action": "refresh_cookies"}
{"action": "export_session"}
๐ Comparison โ Why This One?
| Feature | tiktok-mcp | Other TikTok MCPs |
|---|---|---|
| Search videos | โ | โ |
| Trending feed | โ | โ ๏ธ Some |
| User profiles | โ | โ ๏ธ Some |
| Video details | โ | โ |
| Hashtag exploration | โ | โ |
| Download (no watermark) | โ | โ |
| Publish videos | โ | โ |
| Like / Comment / Follow | โ | โ |
| Trending sounds | โ | โ |
| Trend analysis | โ | โ |
| Session management | โ | โ |
| Stealth / anti-detection | โ | โ |
| Cookie auth (TikSimPro) | โ | โ |
| Total tools | 12 | 2-4 |
tiktok-mcp is the only MCP server that lets you publish and interact on TikTok.
๐ธ Demo
๐๏ธ Built With
- Playwright โ Browser automation with stealth capabilities
- playwright-stealth โ Anti-detection patches
- MCP SDK โ Model Context Protocol for AI integration
- TikSimPro โ Cookie management & TikTok session handling
- tikwm โ Watermark-free video downloads
- httpx โ Async HTTP client
๐ค Contributing
Contributions are welcome! Here's how:
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'feat: add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Ideas for contributions:
- ๐ฑ Mobile viewport support
- ๐ Multi-language support
- ๐ Advanced analytics (engagement rate, best posting times)
- ๐ Scheduled posting
- ๐ญ Multiple account support
๐ License
This project is licensed under the MIT License โ see the LICENSE file for details.
โญ Star this repo if you find it useful!
Made with โค๏ธ by follox42