# Douyin Mcp Server

> 抖音视频解析与下载工具，支持 MCP 协议

- **Type:** MCP server
- **Install:** `agentstack add mcp-yc-w-cn-douyin-mcp-server`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [yc-w-cn](https://agentstack.voostack.com/s/yc-w-cn)
- **Installs:** 0
- **Category:** [Integrations](https://agentstack.voostack.com/c/integrations)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [yc-w-cn](https://github.com/yc-w-cn)
- **Source:** https://github.com/yc-w-cn/douyin-mcp-server

## Install

```sh
agentstack add mcp-yc-w-cn-douyin-mcp-server
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# 抖音 MCP Server

一个基于抖音的视频解析与下载工具。支持 Model Context Protocol (MCP) 标准，提供抖音视频链接解析、无水印视频下载功能，适合自用或自动化工具集成。

## 功能亮点

* 🔍 **抖音链接智能解析**：自动识别分享链接，提取无水印视频地址
* 📥 **一键下载视频**：直接下载无水印视频文件到本地
* 📊 **实时进度显示**：控制台显示下载进度，清晰了解下载状态
* 🗑️ **自动文件管理**：文件保存在指定工作目录，便于管理

> 每个工具都会返回实际保存的文件名和视频信息，方便你集成到任何自动化流程！

## 安装使用

### NPX 方式（推荐）

```bash
pnpx @yc-w-cn/douyin-mcp-server
```

### 全局安装

```bash
pnpm install -g @yc-w-cn/douyin-mcp-server
douyin-mcp-server
```

## 配置要求

### 环境变量

在使用前，可以设置工作目录环境变量（可选）：

```bash
# 可选：自定义工作目录
export WORK_DIR="/path/to/your/data/directory"
```

或者使用默认工作目录 `.data`（无需设置环境变量）

## MCP 客户端配置

### Claude Desktop 配置

在 Claude Desktop 的配置文件中添加：

```json
{
  "mcpServers": {
    "douyin-mcp-server": {
      "command": "npx",
      "args": ["-y", "@yc-w-cn/douyin-mcp-server@latest"],
      "env": {
        "WORK_DIR": "/path/to/your/data/directory"
      }
    }
  }
}
```

配置文件位置：
- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`

### 其他 MCP 客户端

对于其他支持 MCP 的客户端，请参考其文档配置 stdio 传输方式。

## 可用工具与参数

每个工具处理后都会返回视频信息和保存的文件名，便于后续追踪或下载。

### 1. 获取无水印下载链接

* **工具名**: `get_douyin_download_link`
* **参数**:
  * `share_link`：抖音分享链接或包含链接的文本

### 2. 下载视频文件

* **工具名**: `download_douyin_video`
* **参数**:
  * `share_link`：抖音分享链接或包含链接的文本

### 3. 解析视频信息

* **工具名**: `parse_douyin_video_info`
* **参数**:
  * `share_link`：抖音分享链接或包含链接的文本

## 文件输出规范

所有生成文件均保存至工作目录，文件名规则如下：

* `{videoId}.mp4` - 下载的视频文件
* （你可以用工具返回值直接获取这些文件名）

## 使用流程示例

1. **获取下载链接**
   使用 `get_douyin_download_link` 工具获取无水印视频链接
2. **下载视频文件**
   用 `download_douyin_video` 工具直接下载视频文件
3. **查看视频信息**
   用 `parse_douyin_video_info` 工具查看视频基本信息

## 开发指南

### 本地开发

```bash
# 克隆项目
git clone https://github.com/yc-w-cn/douyin-mcp-server.git
cd douyin-mcp-server

# 安装依赖
pnpm install

# 开发模式运行
pnpm run dev

# 构建
pnpm run build

# 运行构建版本
pnpm start
```

### 项目结构

```
douyin-mcp-server/
├── src/                  # 源代码目录
│   ├── config/           # 配置文件
│   ├── services/         # 服务层
│   ├── tools/            # 工具定义
│   └── utils/            # 工具函数
├── dist/                 # 编译输出目录
├── package.json          # 项目配置
├── tsconfig.json         # TypeScript 配置
├── README.md             # 项目说明
└── .data/                # 默认工作目录
    └── {videoId}.mp4     # 下载的视频文件
```

### 自定义扩展

您可以根据需要扩展以下功能：

1. **批量处理**：支持批量处理多个抖音链接
2. **视频格式转换**：支持转换为其他视频格式
3. **音频提取**：从视频中提取音频文件
4. **缓存机制**：添加智能缓存以提高性能

## 技术栈

- **Node.js** >= 18.0.0
- **TypeScript** - 类型安全的JavaScript
- **Model Context Protocol** - 标准化的AI上下文协议
- **Axios** - HTTP 请求库
- **Zod** - 数据验证库

## 故障排除

### 常见问题

1. **视频下载失败**
   ```
   错误：下载失败: Request failed with status code 404
   解决：检查抖音链接是否正确，确保网络连接正常
   ```

2. **工作目录权限问题**
   ```
   错误：EACCES: permission denied
   解决：确保工作目录有写入权限，或设置 WORK_DIR 到有权限的目录
   ```

3. **链接解析失败**
   ```
   错误：未找到有效的分享链接
   解决：检查分享链接格式是否正确，确保链接未过期
   ```

### 日志调试

启用详细日志：
```bash
DEBUG=douyin-mcp-server pnpx @yc-w-cn/douyin-mcp-server
```

## 贡献指南

欢迎贡献代码！请遵循以下步骤：

1. Fork 本项目
2. 创建特性分支：`git checkout -b feature/amazing-feature`
3. 提交更改：`git commit -m 'Add amazing feature'`
4. 推送分支：`git push origin feature/amazing-feature`
5. 创建 Pull Request

### 开发规范

- 使用 TypeScript 进行类型安全开发
- 遵循 ESLint 代码规范
- 添加适当的错误处理
- 编写清晰的注释和文档

## 许可证

本项目采用 MIT 许可证。详情请见 [LICENSE](LICENSE) 文件。

## 作者信息

- **作者**: Yuchen Wang
- **邮箱**: contact@wangyuchen.cn
- **GitHub**: [https://github.com/yc-w-cn](https://github.com/yc-w-cn)

## 更新日志

### v1.0.0 (2025-01-15)

- ✨ 初始版本发布
- 🔍 支持抖音链接解析
- 📥 支持无水印视频下载
- 📊 支持实时下载进度显示
- � 支持视频信息获取

## 相关链接

- [Model Context Protocol](https://modelcontextprotocol.io/)
- [抖音官网](https://www.douyin.com/)
- [Claude Desktop](https://claude.ai/download)

## 支持

如果您觉得这个项目有用，请给它一个 ⭐！

如有问题或建议，请通过以下方式联系：

- 📧 邮箱：contact@wangyuchen.cn
- 🐛 GitHub Issues：[项目问题追踪](https://github.com/yc-w-cn/douyin-mcp-server/issues)
- 💬 GitHub Discussions：[项目讨论区](https://github.com/yc-w-cn/douyin-mcp-server/discussions)

## Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [yc-w-cn](https://github.com/yc-w-cn)
- **Source:** [yc-w-cn/douyin-mcp-server](https://github.com/yc-w-cn/douyin-mcp-server)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** yes
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/mcp-yc-w-cn-douyin-mcp-server
- Seller: https://agentstack.voostack.com/s/yc-w-cn
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
