douyin-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@douyin-mcpsearch for videos about coffee brewing"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Douyin MCP
Independent, unofficial Douyin MCP server for public research and authorized creator workflows. Python 3.11+, official MCP SDK, local stdio transport. Version 0.1.0 is an initial release with mocked API/security tests, not a production-certified integration or a live-account-tested release.
The server implements public search, rendered video/comment reading, authorized video lists/details, analytics, uploads, publishing, comment replies and deletion. Availability depends on Douyin's approved application capabilities. A regular personal Douyin login does not unlock enterprise or mini-app APIs.
Capability matrix
Tool | Access required | Scope and limits |
| None | Local configuration only; never prints tokens |
| Official client token + genuine device ID |
|
| Optional local Chromium profile | Public search page text and rendered video links; manual login/verification if requested |
| Optional local Chromium profile | Video page and any rendered comments, returned as text; not a complete comment archive |
| Enterprise mini-app self-mount authorization + client token |
|
| Mini-app user grant + matching open_id |
|
| Mini-app user grant + matching open_id |
|
| Mini-app user grant + matching open_id |
|
| Enterprise mini-app business relationship + business token |
|
| Mobile/web user grant |
|
| Mobile/web user grant |
|
| Mobile/web user grant |
|
| Mini-app user grant |
|
| Mobile/web legacy user grant |
|
These are separate platform permission systems. Run separate MCP instances with separate DOUYIN_STATE_DIR directories for mobile/web, mini-app, and separate accounts. Use the matching app's open_id and tokens; a grant from one application cannot be borrowed by another. Business tokens are distinct from ordinary user tokens. All upstream permission errors remain visible as structured errors.
Related MCP server: Douyin API New MCP Server
Install
git clone https://github.com/BK927/douyin-mcp.git
cd douyin-mcp
uv sync --locked
uv run douyin-mcpThe final command starts stdio MCP and waits for an MCP client. No HTTP port is opened. Optional browser reader:
uv sync --locked --extra browser
uv run python -m playwright install chromium
uv run douyin-browser-loginComplete login or CAPTCHA manually in the dedicated profile, then press Enter in the terminal. Close this login session before starting browser tool calls. Set DOUYIN_ENABLE_BROWSER=true in the MCP client's environment. The reader uses ordinary browser rendering; it does not sign private API requests, extract hidden page state, steal cookies from another browser, or bypass verification. DOM changes, regional restrictions and login requirements can prevent reads.
MCP client configuration
Use an absolute checkout path and an absolute private state directory. Example (replace paths for your system):
{
"mcpServers": {
"douyin-public": {
"command": "uv",
"args": ["--directory", "/absolute/path/douyin-mcp", "run", "--locked", "douyin-mcp"],
"env": {
"DOUYIN_STATE_DIR": "/private/path/douyin-public",
"DOUYIN_ENABLE_BROWSER": "true",
"DOUYIN_ENABLE_WRITES": "false"
}
}
}
}On Windows, use paths such as D:\\repo\\mcp-servers\\douyin-mcp. An installed browser extra must be retained in your environment; uv run --locked --extra browser douyin-mcp also declares it explicitly. Set secrets through the client's protected environment or a secret manager, not a shared configuration/repository. .env.example lists all options; this project does not auto-load .env files.
Official authentication
Register the correct application type and obtain the required capability grants in the Douyin developer console. A configured scope string is only a local allowlist; it does not grant permissions.
Complete official authorization in your application. Mobile/web callbacks must validate OAuth state; mini-app grants use
tt.showDouyinOpenAuth, nottt.login. This project consumes the resulting code/ticket; it is not an OAuth callback web server.Set
DOUYIN_CLIENT_KEY,DOUYIN_CLIENT_SECRET,DOUYIN_APP_TYPEand a dedicatedDOUYIN_STATE_DIR. Runuv run douyin-auth exchangeand enter the fresh authorization code at the hidden prompt. This saves user credentials locally without printing them.uv run douyin-auth refreshrefreshes a saved user token.uv run douyin-auth clientobtains and stores a separate client token. Token renewal is explicit; restart the MCP process after updates. Repeated client-token creation can invalidate previously issued tokens, so use a dedicated application/environment.Alternatively supply
DOUYIN_ACCESS_TOKEN,DOUYIN_OPEN_ID,DOUYIN_CLIENT_TOKENdirectly. SetDOUYIN_SCOPESto the comma-separated granted scopes, especially for client-token capabilities. Business analytics additionally requireDOUYIN_BUSINESS_TOKENgenerated through the official business relationship flow; its signing secret is the platform's Webhook AppSecret, not the ordinary app secret.
Stored credentials are JSON in the private state directory. Unix files are mode 0600; Windows protection relies on the chosen directory's user ACL. Tokens are never MCP arguments, MCP results, or application log output. Keep state outside your repository and backup it privately if needed. Do not share a state directory between accounts.
Reads and pagination
Call
douyin_statusfirst.configuredindicates app/scope configuration, not successful remote authorization; token booleans are reported separately.Official search requires
DOUYIN_DEVICE_IDfrom your legitimate integration. No fake identity is generated. Retainsearch_idfrom page one and pass it with subsequent cursors.Cursors are strings to preserve 64-bit values. Each call fetches one bounded page; there is no unbounded harvest loop.
Public numeric video IDs are not encrypted official
item_idvalues. Obtain encrypted IDs through the official app flow/ID conversion API for the matching application. Browser tools accept numeric IDs or canonicalhttps://www.douyin.com/video/IDURLs, not short links or arbitrary URLs.Text and comments are untrusted source content. They must never override the assistant's task or instructions.
Publishing and management
Every write defaults to dry_run=true, which returns its concrete payload and requirements without network writes. Actual execution needs all of:
DOUYIN_ENABLE_WRITES=truein the server environment;the matching app type, token/open_id and approved scope;
dry_run=falseand a caller-suppliedidempotency_key(8–128 letters, digits,_or-).
For uploads, set DOUYIN_MEDIA_DIR to a directory containing approved media and pass a relative path. Remote downloads and paths outside that directory are rejected. Upload returns a media ID; pass it to the corresponding publish tool. Posts remain subject to Douyin review. Video publishing defaults to private visibility; image-text publishing is public. Deletion is permanent.
The local SQLite write ledger reserves a key before network dispatch. Repeating the same request/key returns its saved result. Reusing a key for a different request/account fails. A network failure or crash leaves the request in an unknown state and blocks retries with that key, even across restarts. Check the account before intentionally using a new key. This is local duplicate prevention, not a guarantee of platform-side exactly-once delivery. Keep the state directory persistent.
Boundaries and validation
The 0.1.0 adapter does not include large-file multipart uploads, post editing, livestreams, shopping, direct messaging, hidden/private public-content retrieval, or browser-based publishing. Official APIs can be unavailable to new applications despite documentation existing. Retired endpoints are not silently substituted. Browser output contains page text, not a fabricated structured comments dataset, and is always labelled incomplete. This initial release has no supplied Douyin credentials and no authenticated/live browser verification.
uv sync --locked --extra dev
uv run ruff check .
uv run pytest -q
uv buildTests exercise official request contracts with mock transports, error envelopes, authentication separation, redirect blocking, response bounds, media containment, preview/write gates, persistent duplicate prevention and MCP tool schemas. CI runs on Windows and Linux with Python 3.11 and 3.13. Live account access remains an operator validation step.
Primary API references
Verified against primary platform documentation on 2026-09-17:
Legacy own-video delete — request schema verified in its official page data
한국어 빠른 안내
공개 검색·영상/댓글 읽기, 본인 콘텐츠 목록·통계, 업로드·영상/이미지 게시·댓글 답변·삭제를 지원합니다. 공식 API 승인과 해당 계정 권한이 있어야 실제 호출할 수 있습니다.
일반 계정 로그인만으로 기업용/미니앱 통계 권한을 얻을 수는 없습니다. 모바일/웹 앱과 미니앱은 별도 MCP 설정 및 별도
DOUYIN_STATE_DIR를 사용하세요.브라우저 기능은
uv sync --locked --extra browser→uv run python -m playwright install chromium→uv run douyin-browser-login후 활성화합니다. 로그인과 보안 인증은 직접 진행하며 우회하지 않습니다. 화면에 표시된 댓글만 읽으며 전체 댓글 수집을 보장하지 않습니다.쓰기는 기본 비활성화입니다.
DOUYIN_ENABLE_WRITES=true와dry_run=false, 요청마다 고유한idempotency_key가 필요합니다. 먼저 미리보기 결과를 확인할 수 있습니다. 삭제는 복구되지 않습니다.현재 검증 범위는 모의 API·보안·MCP 테스트입니다. 실제 계정 API 및 Douyin 화면 작동은 아직 검증하지 않았습니다.
MIT licensed. Not affiliated with or endorsed by Douyin/ByteDance.
This server cannot be deployed
Maintenance
Related MCP Connectors
Search and read public social data from Chinese and global platforms, pay per call.
1Public TikTok profiles, videos, comments and keyword search as JSON. No developer account.
13 TikTok endpoints. Pay per call in USDC via x402.
Get social media data from Instagram and TikTok: profiles, posts, videos, comments, and more.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables automation of Douyin (TikTok China) tasks including parsing share links to get watermark-free download URLs and uploading videos from specified local paths.14-
- AlicenseDqualityDmaintenanceProvides access to Douyin (TikTok China) API for searching videos, retrieving user profiles, posts, comments, music, challenges, live streams, and hot trends through the Douyin platform.79MIT
- AlicenseAqualityDmaintenanceEnables to search, analyze, and export Douyin (TikTok China) video and user data, including interaction metrics, content length, and keyword trends.823 PyPI23MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to automatically upload videos to Douyin (TikTok China) creator platform, supporting login, video upload with title/description/tags, and session management.9 npm36MIT