tiktok-organic-mcp
Enables AI assistants to access TikTok organic analytics including video performance, engagement metrics, and profile insights via the TikTok Developer API.
README
tiktok-organic-mcp
MCP server for TikTok organic analytics — video performance, engagement metrics, and profile insights via the TikTok Developer API.
Built for Claude Code and any MCP-compatible AI tool. Gives your AI assistant direct access to your TikTok account data — videos, views, likes, comments, shares, and follower stats.
Part of The SEO Engine toolkit by Rex Jones — AI-powered SEO and social media tooling for agencies and businesses.
Why this exists
- No open-source TikTok organic MCP existed. Ads MCPs exist. Organic analytics? Nobody built one.
- Paid alternatives cost money. The commercial options require monthly subscriptions. This is free and open source.
- Your AI should see your TikTok data. Ask "how are my TikTok videos performing?" and get a real answer.
Quick start
Option 1: npx (no install)
Single account:
{
"mcpServers": {
"tiktok-organic": {
"command": "npx",
"args": ["-y", "tiktok-organic-mcp"],
"env": {
"TIKTOK_ACCESS_TOKEN": "your_access_token"
}
}
}
}
Multiple accounts:
{
"mcpServers": {
"tiktok-organic": {
"command": "npx",
"args": ["-y", "tiktok-organic-mcp"],
"env": {
"TIKTOK_ACCOUNTS": "[{\"name\":\"mybrand\",\"access_token\":\"act.xxx\",\"client_key\":\"abc123\",\"refresh_token\":\"rft.xxx\"},{\"name\":\"otherbrand\",\"access_token\":\"act.yyy\",\"client_key\":\"def456\",\"refresh_token\":\"rft.yyy\"}]"
}
}
}
}
Option 2: Clone and build
git clone https://github.com/lanternrow/tiktok-organic-mcp.git
cd tiktok-organic-mcp
npm install
npm run build
Then add to your Claude Code MCP settings:
{
"mcpServers": {
"tiktok-organic": {
"command": "node",
"args": ["/path/to/tiktok-organic-mcp/dist/index.js"],
"env": {
"TIKTOK_ACCESS_TOKEN": "your_access_token"
}
}
}
}
Getting your TikTok Access Token
Step 1: Create a TikTok Developer App
- Go to the TikTok Developer Portal and log in
- Click Manage apps → Connect an app
- Fill in your app details and submit for review
Step 2: Add Login Kit and request scopes
- In your app dashboard, add the Login Kit product
- Request these scopes:
user.info.basic— profile name, avataruser.info.profile— bio, verification statususer.info.stats— follower/following counts, total likesvideo.list— access to video listing and metrics
Step 3: Complete the OAuth flow
- Direct users to TikTok's authorization URL:
https://www.tiktok.com/v2/auth/authorize/ ?client_key={your_client_key} &scope=user.info.basic,user.info.profile,user.info.stats,video.list &response_type=code &redirect_uri={your_redirect_uri} - Exchange the authorization code for tokens:
POST https://open.tiktokapis.com/v2/oauth/token/ Content-Type: application/x-www-form-urlencoded client_key={client_key} &client_secret={client_secret} &code={auth_code} &grant_type=authorization_code &redirect_uri={redirect_uri} - Save the
access_tokenandrefresh_tokenfrom the response
Tip: Access tokens expire after 24 hours. Use the
refresh_tokentool or setTIKTOK_REFRESH_TOKENto enable automatic renewal.
Multi-account support
Monitor multiple TikTok accounts from a single MCP server. Set the TIKTOK_ACCOUNTS environment variable as a JSON array:
[
{
"name": "mybrand",
"access_token": "act.xxx",
"client_key": "abc123",
"refresh_token": "rft.xxx"
},
{
"name": "otherbrand",
"access_token": "act.yyy",
"client_key": "def456",
"refresh_token": "rft.yyy"
}
]
Each account object requires:
name— a unique label you pick (used in tool calls)access_token— the OAuth access token
Optional:
client_key— needed for token refreshrefresh_token— needed for token refresh
Using accounts in tools: Every tool accepts an optional account parameter. If omitted, the first account in the array is used as default.
get_user_info(account: "mybrand")
get_videos(account: "otherbrand", max_count: 10)
Backward compatible: If you only have one account, the legacy single-env-var format (TIKTOK_ACCESS_TOKEN) still works. It creates a default account named "default".
Tools
Account tools
| Tool | Description |
|---|---|
list_accounts |
List all configured TikTok accounts and the default |
Read tools
| Tool | Description |
|---|---|
get_user_info |
Profile metadata: username, bio, follower/following counts, total likes, video count, verification status |
get_videos |
Paginated list of public videos with engagement metrics (views, likes, comments, shares) |
get_video_details |
Detailed metrics for specific video IDs (batch up to 20) |
Utility tools
| Tool | Description |
|---|---|
refresh_token |
Exchange refresh token for a new access token (requires client_key and refresh_token in account config) |
All read and utility tools accept an optional account parameter to target a specific account.
Architecture
src/
index.ts # MCP server entry point, tool registration
accounts.ts # Multi-account resolution and configuration
client.ts # TikTok API HTTP client (native fetch, no dependencies)
types.ts # TypeScript interfaces for API responses
tools/
user.ts # get_user_info
videos.ts # get_videos, get_video_details
utils.ts # refresh_token
- Zero external HTTP dependencies — uses Node 18+ native
fetch - Multi-account support — monitor multiple TikTok accounts from one server
- Backward compatible — single-token env var still works
- Cursor-based pagination — video listing supports pagination via cursor
- Zod validation — all tool inputs validated with descriptive error messages
- Batch video queries — get details for up to 20 videos in one request
Environment variables
Multi-account (recommended)
| Variable | Required | Description |
|---|---|---|
TIKTOK_ACCOUNTS |
Yes | JSON array of account objects (see Multi-account support section) |
Single account (legacy)
| Variable | Required | Description |
|---|---|---|
TIKTOK_ACCESS_TOKEN |
Yes | OAuth access token from Login Kit flow |
TIKTOK_CLIENT_KEY |
For refresh | App Client Key (needed for token refresh) |
TIKTOK_REFRESH_TOKEN |
For refresh | Refresh token (needed for token refresh) |
Development
npm run dev # Watch mode — recompiles on save
npm run build # Production build
npm start # Run the server
Contributing
Issues and PRs welcome. If TikTok changes their API, please open an issue.
License
MIT — see LICENSE.
Built as part of The SEO Engine by Rex Jones.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。