CapCutAPI-Complete MCP Server

CapCutAPI-Complete MCP Server

Enables video editing operations such as trimming, merging, adding audio/text/effects, and exporting via MCP protocol, leveraging CapCut core functionalities.

Category
Visit Server

README

CapCutAPI-Complete

🎬 CapCut API 完整版 - 功能强大的视频编辑API服务,基于剪映(CapCut/JianYing)核心功能实现

Python Flask Docker License

🚀 项目简介

CapCutAPI-Complete 是一个基于 Python 的完整视频编辑API服务,提供与剪映(CapCut/JianYing)类似的核心功能。通过HTTP API和MCP协议接口,您可以轻松实现:

  • 🎞️ 视频剪辑和合并
  • 🎵 音频处理和混音
  • 📝 文字和字幕添加
  • ✨ 特效和转场效果
  • 🖼️ 贴纸和装饰元素
  • 📦 批量处理和自动化

✨ 核心特性

🎯 视频处理

  • 多轨道编辑:支持无限视频轨道
  • 格式转换:支持MP4、AVI、MOV、MKV等主流格式
  • 分辨率适配:自动适配1080P、4K等分辨率
  • 帧率转换:24fps、30fps、60fps无缝切换
  • 视频压缩:智能压缩保持画质

🎵 音频处理

  • 音频提取:从视频中提取音频轨道
  • 音量调节:精确到毫秒级的音量控制
  • 淡入淡出:平滑的音频过渡效果
  • 音频混合:多轨道音频混音
  • 格式支持:MP3、WAV、AAC、FLAC等

📝 文字和字幕

  • 动态字幕:支持SRT、ASS字幕格式
  • 字体样式:丰富的字体和样式选项
  • 动画效果:文字入场和出场动画
  • 实时预览:即时查看字幕效果
  • 多语言支持:中英文等多语言字幕

✨ 特效和滤镜

  • 转场效果:100+种专业转场
  • 视觉滤镜:电影级调色滤镜
  • 动态特效:粒子、光效、模糊等
  • 自定义特效:支持自定义特效参数
  • 预设模板:一键应用专业模板

🖼️ 贴纸和装饰

  • 静态贴纸:PNG、JPG、SVG格式支持
  • 动态贴纸:GIF和WebP动画贴纸
  • 自定义贴纸:支持用户上传自定义贴纸
  • 位置控制:精确的位置和大小调整
  • 层级管理:灵活的图层顺序控制

🏗️ 架构设计

CapCutAPI-Complete/
├── capcut_server.py      # HTTP API服务器
├── mcp_server.py         # MCP协议服务器
├── create_draft.py       # 草稿管理
├── add_video_track.py    # 视频轨道管理
├── add_audio_track.py    # 音频轨道管理
├── add_text.py          # 文字和字幕管理
├── add_effects.py       # 特效和滤镜管理
├── add_stickers.py      # 贴纸和装饰管理
├── video_utils.py       # 视频处理工具
├── audio_utils.py       # 音频处理工具
├── image_utils.py       # 图像处理工具
├── utils.py             # 通用工具函数
├── Dockerfile           # Docker容器配置
├── docker-compose.yml   # 多服务编排
└── requirements.txt     # 依赖包列表

🚀 快速开始

📋 系统要求

  • Python: 3.8 或更高版本
  • FFmpeg: 最新版本
  • 操作系统: Windows 10+/macOS 10.14+/Ubuntu 18.04+
  • 内存: 最少4GB RAM(推荐8GB+)
  • 存储: 至少10GB可用空间

🔧 安装步骤

1. 克隆项目

git clone https://github.com/chenzhaohua11/CapCutAPI-Complete.git
cd CapCutAPI-Complete

2. 安装依赖

# 创建虚拟环境
python -m venv venv
source venv/bin/activate  # Linux/macOS
# 或
venv\Scripts\activate     # Windows

# 安装依赖
pip install -r requirements.txt

3. 安装FFmpeg

Ubuntu/Debian:

sudo apt update
sudo apt install ffmpeg

macOS:

brew install ffmpeg

Windows:

4. 启动服务

# 启动HTTP API服务器
python capcut_server.py

# 启动MCP服务器
python mcp_server.py

🐳 Docker部署

1. 使用Docker Compose

# 启动所有服务
docker-compose up -d

# 查看服务状态
docker-compose ps

# 查看日志
docker-compose logs -f capcut-api

2. 单独构建镜像

# 构建镜像
docker build -t capcut-api .

# 运行容器
docker run -p 5000:5000 -v $(pwd)/data:/app/data capcut-api

📖 API使用指南

🌐 HTTP API接口

创建项目草稿

curl -X POST http://localhost:5000/create_draft \
  -H "Content-Type: application/json" \
  -d '{
    "name": "我的第一个项目",
    "resolution": "1920x1080",
    "fps": 30,
    "duration": 60
  }'

添加视频

curl -X POST http://localhost:5000/add_video \
  -H "Content-Type: application/json" \
  -d '{
    "draft_id": "draft_123456",
    "video_url": "https://example.com/video.mp4",
    "start_time": 0,
    "duration": 10,
    "position": {"x": 0, "y": 0},
    "size": {"width": 1920, "height": 1080}
  }'

添加音频

curl -X POST http://localhost:5000/add_audio \
  -H "Content-Type: application/json" \
  -d '{
    "draft_id": "draft_123456",
    "audio_url": "https://example.com/audio.mp3",
    "start_time": 0,
    "duration": 10,
    "volume": 0.8
  }'

添加文字

curl -X POST http://localhost:5000/add_text \
  -H "Content-Type: application/json" \
  -d '{
    "draft_id": "draft_123456",
    "content": "Hello, CapCut API!",
    "start_time": 2,
    "duration": 5,
    "position": {"x": 100, "y": 100},
    "font_size": 48,
    "color": "#FFFFFF"
  }'

添加特效

curl -X POST http://localhost:5000/add_effect \
  -H "Content-Type: application/json" \
  -d '{
    "draft_id": "draft_123456",
    "effect_type": "fade_in",
    "start_time": 0,
    "duration": 2,
    "intensity": 0.8
  }'

导出视频

curl -X POST http://localhost:5000/export_video \
  -H "Content-Type: application/json" \
  -d '{
    "draft_id": "draft_123456",
    "format": "mp4",
    "quality": "high",
    "fps": 30
  }'

🔌 MCP协议接口

MCP (Media Control Protocol) 提供更高性能的接口:

from mcp_client import MCPClient

client = MCPClient("localhost", 5001)

# 创建项目
draft = client.create_draft(
    name="MCP项目",
    resolution="1920x1080",
    fps=30
)

# 添加媒体
video_id = client.add_video(draft.id, "video.mp4")
audio_id = client.add_audio(draft.id, "audio.mp3")
text_id = client.add_text(draft.id, "Hello World")

# 应用特效
client.add_transition(video_id, "fade_in")
client.add_filter(video_id, "vintage")

# 导出结果
output_path = client.export(draft.id, "final_video.mp4")

📁 项目结构

CapCutAPI-Complete/
├── 📁 项目根目录
├── 📁 data/                    # 数据存储目录
│   ├── 📁 uploads/            # 上传文件
│   ├── 📁 drafts/             # 项目草稿
│   ├── 📁 exports/            # 导出文件
│   └── 📁 cache/              # 缓存文件
├── 📁 templates/              # 模板文件
├── 📁 config/                 # 配置文件
├── 📁 logs/                   # 日志文件
├── 📁 tests/                  # 测试文件
└── 📁 docs/                   # 文档文件

📞 联系方式


<div align="center"> <p>⭐ 如果这个项目对你有帮助,请给我们一个星标!</p> <p><a href="https://github.com/chenzhaohua11/CapCutAPI-Complete">🌟 Star this repo</a></p> </div>

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured