Skip to main content
Glama
Douyin AI Agent MCP Server

Douyin AI Agent MCP Server

Douyin AI Agent — 视觉大模型 + ADB + MCP 移动端短视频自动化运营引擎

CI Python 3.10+ License: MIT

一套面向 Android 真机与模拟器的 AI 视觉驱动短视频自动化运营 Agent 框架。通过 ADB + uiautomator2 控件树定位 + 视觉大模型(GLM-4V / OpenAI 兼容)截屏决策 + 拟人化防风控行为模拟,打通视频提取分析、AI 生成文案、批量防重发布、模拟养号与私信智能回复全链路,并原生封装为 MCP / Hermes / WorkBuddy 多 Agent 协议适配器。


系统架构

flowchart LR
    Agent["外部 AI Agent<br/>(Claude / Codex / Hermes / WorkBuddy)"]
    subgraph Adapters["多协议适配层 agent_adapters/"]
        MCP["MCP Adapter<br/>(7 标准工具)"]
        Hermes["Hermes Adapter & SKILL.md"]
        WB["WorkBuddy Adapter"]
    end
    subgraph Core["核心能力层 core/"]
        Pub["PublishService<br/>自动选片 / 批量防重轮发"]
        Msg["MessageService<br/>私信巡检 / AI 自动回复"]
        Vid["VideoService<br/>视频提取 / 抽帧分析"]
        Vision["VisionLLMClient<br/>视觉理解 + 标题文案生成"]
        Human["Humanize Engine<br/>随机坐标偏移 / 贝塞尔速度滑动"]
    end
    Device["Android 真机 / 模拟器<br/>(ADB + uiautomator2 跨分辨率控件树)"]

    Agent --> Adapters --> Core --> Device
    Core --> Vision

Related MCP server: ghost-in-the-droid

核心特性

  • 视觉大模型 + UI 控件树双保险:结合 uiautomator2 跨设备分辨率控件查找与多模态视觉模型(支持 GLM-4V 及任意 OpenAI 兼容视觉接口)兜底识别复杂弹窗与页面状态。

  • 拟人化防风控引擎 (core/humanize.py):内置随机坐标抖动点击、自然滑动速度与距离随机化、区间随机延迟,降低机械操作风控风险。

  • 全链路运营能力 (core/capabilities/ & skills/):

    • auto-publish / batch-publish:相册智能接续防重发布 & 本地目录批量轮发;

    • douyin_video:本地缓存提取、视频下载、多帧视觉内容分析与爆款标题/描述/标签生成流水线;

    • check-messages / auto-reply:自动巡检未读私信并基于上下文生成拟人回复;

    • browse:模拟真人刷视频浏览养号。

  • 原生多 Agent 生态接入 (agent_adapters/):内置 MCP (Model Context Protocol) 7 大标准工具契约、HermesAdapter、WorkBuddyAdapter 及标准 SKILL.md 插件定义,开箱即作为外部 Agent 的移动端执行手脚。

  • 零密钥入库安全设计:配置加载器 (core/config_loader.py) 优先读取环境变量(DOUYIN_AI_API_KEY / GLM_API_KEY),本地 config/settings.yaml 自动被 .gitignore 忽略。


MCP 标准工具清单

工具名

功能说明

核心输出

auto_publish

相册自动选片 + AI 文案生成 + 发布

success, title, video_id

check_unread_messages

检测私信未读状态与发送人列表

has_unread, unread_count, senders

read_messages

读取指定联系人私信与上下文截图

messages, context_screenshot

send_reply

向指定用户发送回复消息

success, message_id

browse_douyin

拟人化刷视频养号

scroll_count

scroll_up / scroll_down

拟人化页面上下滚动

success


快速开始

1. 安装依赖

git clone https://github.com/yuanZhang7777777/douyin-ai-agent.git
cd douyin-ai-agent
python -m venv .venv
# Windows: .venv\Scripts\activate  |  macOS/Linux: source .venv/bin/activate
pip install -r requirements.txt

2. 配置密钥与设备

推荐使用环境变量(避免密钥写入文件):

cp .env.example .env
# 或直接设置环境变量
export DOUYIN_AI_API_KEY="your_api_key"
export DOUYIN_DEVICE_SERIAL="127.0.0.1:5555"   # 可选,不填则自动发现

也可以复制 config/settings.yaml.example 为 config/settings.yaml 按需微调。

3. 检查设备并运行

# 验证 ADB 与在线设备
python check_devices.py

# 查看设备信息
python main.py device-info -D emulator

# 自动发布(相册防重接续)
python main.py auto-publish -D emulator

# 批量发布本地目录视频(间隔 60 秒)
python main.py batch-publish -v ./videos -n 5 -i 60 -D emulator

# 私信自动巡检与 AI 回复
python main.py check-messages -D phone
python main.py auto-reply -D phone

# 模拟真人浏览养号 60 秒
python main.py browse -d 60 -D phone

运行单元测试

pip install pytest
pytest -v

免责声明

本项目仅用于技术学习、AI Agent 移动端交互研究及合规账号运营效率工具探索,请严格遵守相关平台服务协议与法律法规,切勿用于违规刷量或骚扰行为。

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables full Android control from any AI agent via 7 MCP tools, including screen capture, touch interaction, app management, and system control.
      35 PyPI
      MIT
    • A
      license
      B
      quality
      B
      maintenance
      Give any LLM agent a real Android or iPhone. 62 MCP tools: tap, swipe, type, screenshot, screen-tree reading, app launch, camera, TTS, crash reports, batched execution. Android via ADB, iPhone via WebDriverAgent, on-device inference, Docker+KVM emulators. Works with Claude Code, Cursor, LangChain, LlamaIndex, and any MCP client. MIT.
      66
      178 PyPI
      430
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      An Android UI automation MCP server that exposes 30+ ADB-backed tools, letting AI agents control phones or emulators to detect elements, tap, type, and orchestrate the full ticket-purchasing flow. It targets ticket-grabbing on Damai, Maoyan, and Fliggy, with millisecond-precision waiting and automatic failure screenshots.
      8
      MIT