Douyin MCP Server

Local setup required. This server has to be cloned and prepared on your machine before you register it in Claude Code.
1

Set the server up locally

Run this once to clone and prepare the server before adding it to Claude Code.

Run in terminal
cd douyin-mcp
npm install
2

Register it in Claude Code

After the local setup is done, run this command to point Claude Code at the built server.

Run in terminal
claude mcp add douyin-mcp -- node "<FULL_PATH_TO_DOUYIN_MCP>/dist/index.js"

Replace <FULL_PATH_TO_DOUYIN_MCP>/dist/index.js with the actual folder you prepared in step 1.

README.md

Automated Douyin video uploads and account management using Playwright.

Douyin MCP (Playwright 版)

基于 Playwright 模拟浏览器操作实现的抖音 (Douyin) MCP 服务器,支持视频上传功能。

特性

  • 扫码登录 - 使用抖音 App 扫码登录
  • 视频上传 - 模拟浏览器操作上传视频
  • 自动填表 - 自动填写标题、简介、标签
  • Cookie 持久化 - 登录状态自动保存
  • HTTP API - 提供 RESTful API 接口

目录结构

douyin-mcp/
├── server-playwright.js    # MCP HTTP 服务器 (端口 18062)
├── login-playwright.js     # 扫码登录工具
├── package.json            # 依赖配置
├── cookies.json            # 登录状态 (自动生成)
└── README.md               # 使用文档

安装

cd douyin-mcp
npm install

Playwright 浏览器会自动安装。

使用方法

1. 登录抖音

# 在 douyin-mcp 目录
npm run login

# 或
node login-playwright.js

运行后会打开浏览器窗口,显示二维码:

  1. 打开抖音 App
  2. 点击右上角扫描图标
  3. 扫描浏览器中的二维码
  4. 在手机上确认登录

登录成功后会自动保存 cookies。

2. 启动 MCP 服务器

# 在 douyin-mcp 目录
npm start

# 或
node server-playwright.js

服务器运行在 http://localhost:18062

3. 发布视频

使用 curl 调用 API:

curl -X POST http://localhost:18062/api/v1/publish \
  -H "Content-Type: application/json" \
  -d '{
    "title": "视频标题",
    "content": "视频简介",
    "video_path": "/path/to/video.mp4",
    "tags": ["标签 1", "标签 2"],
    "visibility": "public"
  }'

API 接口

健康检查

GET http://localhost:18062/health

检查登录状态

GET http://localhost:18062/api/v1/login/status

获取登录二维码

GET http://localhost:18062/api/v1/login/qrcode

发布视频

POST http://localhost:18062/api/v1/publish
Content-Type: application/json

{
  "title": "视频标题",
  "content": "视频简介",
  "video_path": "/path/to/video.mp4",
  "tags": ["标签 1", "标签 2"],
  "visibility": "public"
}

参数说明:

  • title - 视频标题
  • content - 视频简介
  • video_path - 本地视频文件绝对路径
  • tags - 标签数组
  • visibility - public(公开) 或 private(私密)

配置 MCP Client

在 MCP 配置中添加:

{
  "mcpServers": {
    "douyin": {
      "command": "node",
      "args": ["/path/to/douyin-mcp/server-playwright.js"]
    }
  }
}

常见问题

1. 登录过期

抖音 cookies 有一定的有效期,如果发布时提示未登录,需要重新运行登录工具:

node login-playwright.js

2. 浏览器窗口

  • 登录时会显示浏览器窗口(方便扫码)
  • 上传视频时无头模式运行(不显示窗口)

技术栈

参考

License

MIT

注意

本项目仅供学习和个人使用,请遵守抖音的使用条款和社区规范。

Tools (3)

publish_videoUploads a video to Douyin with specified metadata.
get_login_statusChecks the current authentication status of the Douyin account.
get_login_qrcodeRetrieves the QR code for Douyin app authentication.

Configuration

claude_desktop_config.json
{"mcpServers": {"douyin": {"command": "node", "args": ["/path/to/douyin-mcp/server-playwright.js"]}}}

Try it

Check if my Douyin account is currently logged in.
Get the QR code so I can log in to my Douyin account.
Upload the video at /path/to/my-video.mp4 to Douyin with the title 'My New Video' and tags 'tech', 'tutorial'.

Frequently Asked Questions

What are the key features of Douyin MCP?

QR code-based authentication via Douyin App. Automated video uploading using Playwright browser simulation. Automatic metadata handling including titles, descriptions, and tags. Cookie persistence for maintaining login sessions. RESTful API interface for programmatic video publishing.

What can I use Douyin MCP for?

Automating the workflow of publishing edited videos to Douyin. Managing multiple Douyin accounts through a centralized MCP interface. Integrating video content distribution pipelines with AI-assisted metadata generation.

How do I install Douyin MCP?

Install Douyin MCP by running: cd douyin-mcp && npm install

What MCP clients work with Douyin MCP?

Douyin MCP works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep Douyin MCP docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare