| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
20 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,254 @@ | |||
| 1 | + # CapCut API MCP Server Documentation | ||
| 2 | + | ||
| 3 | + ## Overview | ||
| 4 | + | ||
| 5 | + The CapCut API MCP Server is a video editing service based on the Model Context Protocol (MCP), providing complete CapCut video editing functionality interfaces. Through the MCP protocol, you can easily integrate professional-grade video editing capabilities into various applications. | ||
| 6 | + | ||
| 7 | + ## Features | ||
| 8 | + | ||
| 9 | + ### 🎬 Core Capabilities | ||
| 10 | + - **Draft Management**: Create, save, and manage video projects | ||
| 11 | + - **Multimedia Support**: Video, audio, image, and text processing | ||
| 12 | + - **Advanced Effects**: Effects, animations, transitions, and filters | ||
| 13 | + - **Precise Control**: Timeline, keyframes, and layer management | ||
| 14 | + | ||
| 15 | + ### 🛠️ Available Tools (11 Tools) | ||
| 16 | + | ||
| 17 | + | Tool Name | Description | Key Parameters | | ||
| 18 | + |-----------|-------------|----------------| | ||
| 19 | + | `create_draft` | Create new video draft project | width, height | | ||
| 20 | + | `add_text` | Add text elements | text, font_size, color, shadow, background | | ||
| 21 | + | `add_video` | Add video track | video_url, start, end, transform, volume | | ||
| 22 | + | `add_audio` | Add audio track | audio_url, volume, speed, effects | | ||
| 23 | + | `add_image` | Add image assets | image_url, transform, animation, transition | | ||
| 24 | + | `add_subtitle` | Add subtitle files | srt_path, font_style, position | | ||
| 25 | + | `add_effect` | Add visual effects | effect_type, parameters, duration | | ||
| 26 | + | `add_sticker` | Add sticker elements | resource_id, position, scale, rotation | | ||
| 27 | + | `add_video_keyframe` | Add keyframe animations | property_types, times, values | | ||
| 28 | + | `get_video_duration` | Get video duration | video_url | | ||
| 29 | + | `save_draft` | Save draft project | draft_id | | ||
| 30 | + | ||
| 31 | + ## Installation & Setup | ||
| 32 | + | ||
| 33 | + ### Requirements | ||
| 34 | + - Python 3.10+ | ||
| 35 | + - CapCut Application (macOS/Windows) | ||
| 36 | + - MCP Client Support | ||
| 37 | + | ||
| 38 | + ### Dependencies Installation | ||
| 39 | + ```bash | ||
| 40 | + # Create virtual environment | ||
| 41 | + python3.10 -m venv venv-mcp | ||
| 42 | + source venv-mcp/bin/activate # macOS/Linux | ||
| 43 | + # or venv-mcp\Scripts\activate # Windows | ||
| 44 | + | ||
| 45 | + # Install dependencies | ||
| 46 | + pip install -r requirements-mcp.txt | ||
| 47 | + ``` | ||
| 48 | + | ||
| 49 | + ### MCP Configuration | ||
| 50 | + Create or update `mcp_config.json` file: | ||
| 51 | + | ||
| 52 | + ```json | ||
| 53 | + { | ||
| 54 | + "mcpServers": { | ||
| 55 | + "capcut-api": { | ||
| 56 | + "command": "python3.10", | ||
| 57 | + "args": ["mcp_server.py"], | ||
| 58 | + "cwd": "/path/to/CapCutAPI-dev", | ||
| 59 | + "env": { | ||
| 60 | + "PYTHONPATH": "/path/to/CapCutAPI-dev" | ||
| 61 | + } | ||
| 62 | + } | ||
| 63 | + } | ||
| 64 | + } | ||
| 65 | + ``` | ||
| 66 | + | ||
| 67 | + ## Usage Guide | ||
| 68 | + | ||
| 69 | + ### Basic Workflow | ||
| 70 | + | ||
| 71 | + #### 1. Create Draft | ||
| 72 | + ```python | ||
| 73 | + # Create 1080x1920 portrait project | ||
| 74 | + result = mcp_client.call_tool("create_draft", { | ||
| 75 | + "width": 1080, | ||
| 76 | + "height": 1920 | ||
| 77 | + }) | ||
| 78 | + draft_id = result["draft_id"] | ||
| 79 | + ``` | ||
| 80 | + | ||
| 81 | + #### 2. Add Content | ||
| 82 | + ```python | ||
| 83 | + # Add title text | ||
| 84 | + mcp_client.call_tool("add_text", { | ||
| 85 | + "text": "My Video Title", | ||
| 86 | + "start": 0, | ||
| 87 | + "end": 5, | ||
| 88 | + "draft_id": draft_id, | ||
| 89 | + "font_size": 48, | ||
| 90 | + "font_color": "#FFFFFF" | ||
| 91 | + }) | ||
| 92 | + | ||
| 93 | + # Add background video | ||
| 94 | + mcp_client.call_tool("add_video", { | ||
| 95 | + "video_url": "https://example.com/video.mp4", | ||
| 96 | + "draft_id": draft_id, | ||
| 97 | + "start": 0, | ||
| 98 | + "end": 10, | ||
| 99 | + "volume": 0.8 | ||
| 100 | + }) | ||
| 101 | + ``` | ||
| 102 | + | ||
| 103 | + #### 3. Save Project | ||
| 104 | + ```python | ||
| 105 | + # Save draft | ||
| 106 | + result = mcp_client.call_tool("save_draft", { | ||
| 107 | + "draft_id": draft_id | ||
| 108 | + }) | ||
| 109 | + ``` | ||
| 110 | + | ||
| 111 | + ### Advanced Features | ||
| 112 | + | ||
| 113 | + #### Text Styling | ||
| 114 | + ```python | ||
| 115 | + # Text with shadow and background | ||
| 116 | + mcp_client.call_tool("add_text", { | ||
| 117 | + "text": "Advanced Text Effects", | ||
| 118 | + "draft_id": draft_id, | ||
| 119 | + "font_size": 56, | ||
| 120 | + "font_color": "#FFD700", | ||
| 121 | + "shadow_enabled": True, | ||
| 122 | + "shadow_color": "#000000", | ||
| 123 | + "shadow_alpha": 0.8, | ||
| 124 | + "background_color": "#1E1E1E", | ||
| 125 | + "background_alpha": 0.7, | ||
| 126 | + "background_round_radius": 15 | ||
| 127 | + }) | ||
| 128 | + ``` | ||
| 129 | + | ||
| 130 | + #### Keyframe Animation | ||
| 131 | + ```python | ||
| 132 | + # Scale and opacity animation | ||
| 133 | + mcp_client.call_tool("add_video_keyframe", { | ||
| 134 | + "draft_id": draft_id, | ||
| 135 | + "track_name": "video_main", | ||
| 136 | + "property_types": ["scale_x", "scale_y", "alpha"], | ||
| 137 | + "times": [0, 2, 4], | ||
| 138 | + "values": ["1.0", "1.5", "0.5"] | ||
| 139 | + }) | ||
| 140 | + ``` | ||
| 141 | + | ||
| 142 | + #### Multi-Style Text | ||
| 143 | + ```python | ||
| 144 | + # Different colored text segments | ||
| 145 | + mcp_client.call_tool("add_text", { | ||
| 146 | + "text": "Colorful Text Effect", | ||
| 147 | + "draft_id": draft_id, | ||
| 148 | + "text_styles": [ | ||
| 149 | + {"start": 0, "end": 2, "font_color": "#FF0000"}, | ||
| 150 | + {"start": 2, "end": 4, "font_color": "#00FF00"} | ||
| 151 | + ] | ||
| 152 | + }) | ||
| 153 | + ``` | ||
| 154 | + | ||
| 155 | + ## Testing & Validation | ||
| 156 | + | ||
| 157 | + ### Using Test Client | ||
| 158 | + ```bash | ||
| 159 | + # Run test client | ||
| 160 | + python test_mcp_client.py | ||
| 161 | + ``` | ||
| 162 | + | ||
| 163 | + ### Functionality Checklist | ||
| 164 | + - [ ] Server starts successfully | ||
| 165 | + - [ ] Tool list retrieval works | ||
| 166 | + - [ ] Draft creation functionality | ||
| 167 | + - [ ] Text addition functionality | ||
| 168 | + - [ ] Video/audio/image addition | ||
| 169 | + - [ ] Effects and animation functionality | ||
| 170 | + - [ ] Draft saving functionality | ||
| 171 | + | ||
| 172 | + ## Troubleshooting | ||
| 173 | + | ||
| 174 | + ### Common Issues | ||
| 175 | + | ||
| 176 | + #### 1. "CapCut modules not available" | ||
| 177 | + **Solution**: | ||
| 178 | + - Confirm CapCut application is installed | ||
| 179 | + - Check Python path configuration | ||
| 180 | + - Verify dependency package installation | ||
| 181 | + | ||
| 182 | + #### 2. Server startup failure | ||
| 183 | + **Solution**: | ||
| 184 | + - Check virtual environment activation | ||
| 185 | + - Verify configuration file paths | ||
| 186 | + - Review error logs | ||
| 187 | + | ||
| 188 | + #### 3. Tool call errors | ||
| 189 | + **Solution**: | ||
| 190 | + - Check parameter format | ||
| 191 | + - Verify media file URLs | ||
| 192 | + - Confirm time range settings | ||
| 193 | + | ||
| 194 | + ### Debug Mode | ||
| 195 | + ```bash | ||
| 196 | + # Enable verbose logging | ||
| 197 | + export DEBUG=1 | ||
| 198 | + python mcp_server.py | ||
| 199 | + ``` | ||
| 200 | + | ||
| 201 | + ## Best Practices | ||
| 202 | + | ||
| 203 | + ### Performance Optimization | ||
| 204 | + 1. **Media Files**: Use compressed formats, avoid oversized files | ||
| 205 | + 2. **Time Management**: Plan element timelines reasonably, avoid overlaps | ||
| 206 | + 3. **Memory Usage**: Save drafts promptly, clean temporary files | ||
| 207 | + | ||
| 208 | + ### Error Handling | ||
| 209 | + 1. **Parameter Validation**: Check required parameters before calling | ||
| 210 | + 2. **Exception Catching**: Handle network and file errors | ||
| 211 | + 3. **Retry Mechanism**: Retry on temporary failures | ||
| 212 | + | ||
| 213 | + ## API Reference | ||
| 214 | + | ||
| 215 | + ### Common Parameters | ||
| 216 | + - `draft_id`: Unique draft identifier | ||
| 217 | + - `start/end`: Time range (seconds) | ||
| 218 | + - `width/height`: Project dimensions | ||
| 219 | + - `transform_x/y`: Position coordinates | ||
| 220 | + - `scale_x/y`: Scale ratios | ||
| 221 | + | ||
| 222 | + ### Response Format | ||
| 223 | + ```json | ||
| 224 | + { | ||
| 225 | + "success": true, | ||
| 226 | + "result": { | ||
| 227 | + "draft_id": "dfd_cat_xxx", | ||
| 228 | + "draft_url": "https://..." | ||
| 229 | + }, | ||
| 230 | + "features_used": { | ||
| 231 | + "shadow": false, | ||
| 232 | + "background": false, | ||
| 233 | + "multi_style": false | ||
| 234 | + } | ||
| 235 | + } | ||
| 236 | + ``` | ||
| 237 | + | ||
| 238 | + ## Changelog | ||
| 239 | + | ||
| 240 | + ### v1.0.0 | ||
| 241 | + - Initial release | ||
| 242 | + - Support for 11 core tools | ||
| 243 | + - Complete MCP protocol implementation | ||
| 244 | + | ||
| 245 | + ## Technical Support | ||
| 246 | + | ||
| 247 | + For questions or suggestions, please contact us through: | ||
| 248 | + - GitHub Issues | ||
| 249 | + - Technical Documentation | ||
| 250 | + - Community Forums | ||
| 251 | + | ||
| 252 | + --- | ||
| 253 | + | ||
| 254 | + *This documentation is continuously updated. Please follow the latest version.* | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments