### Python Example: CapCut Video Creation Workflow Source: https://github.com/kritsanan1/capcut-mcp/blob/main/SMITHERY_INTEGRATION.md Demonstrates a Python-based workflow for creating a video using CapCut MCP tools. It shows sequential tool calls, passing draft IDs between operations, and handling return values. This example assumes an agent environment where tool calls are translated into API requests. ```python # Agent receives: "Create a video from URL with title and save it" # Agent executes workflow: 1. create_draft(draft_name="My Video Project") → Returns: draft_id="abc123" 2. add_video(video_url="https://...", draft_id="abc123") → Returns: video_track_id="track1" 3. add_text(text="My Title", start=0, end=3, draft_id="abc123") → Returns: text_element_id="text1" 4. save_draft(draft_id="abc123", draft_folder="/exports") → Returns: success, project_path ``` -------------------------------- ### Bash Example: Testing CapCut MCP API Tools Source: https://github.com/kritsanan1/capcut-mcp/blob/main/SMITHERY_INTEGRATION.md Demonstrates how to use `curl` commands to interact with the CapCut MCP API for testing purposes. Includes validating tool schemas, listing available tools, and executing a specific tool with parameters. ```bash # Validate tool schemas curl http://localhost:3000/tools/validate # List available tools curl http://localhost:3000/tools/list # Test tool execution curl -X POST http://localhost:3000/tools/execute \ -d '{"tool": "create_draft", "params": {"draft_name": "Test"}}' ``` -------------------------------- ### Tool Calling & Multi-Step Workflows Example Source: https://github.com/kritsanan1/capcut-mcp/blob/main/SMITHERY_INTEGRATION.md Demonstrates how an agent can execute a multi-step workflow by chaining MCP tool calls, using the `draft_id` to maintain state across operations. ```APIDOC ## Tool Calling & Multi-Step Workflows Example This example illustrates an agent executing a video creation workflow based on a natural language request. ### Scenario **Agent receives:** "Create a video from URL with title and save it" ### Agent Execution Steps 1. **`create_draft`** - **Purpose:** Initializes a new CapCut project. - **Parameters:** `draft_name` (string, required) - **Example Call:** `create_draft(draft_name="My Video Project")` - **Response:** `draft_id="abc123"` 2. **`add_video`** - **Purpose:** Inserts a video file into the project. - **Parameters:** `video_url` (string, required), `draft_id` (string, required) - **Example Call:** `add_video(video_url="https://...", draft_id="abc123")` - **Response:** `video_track_id="track1"` 3. **`add_text`** - **Purpose:** Adds a text overlay to the video. - **Parameters:** `text` (string, required), `start` (number, required), `end` (number, required), `draft_id` (string, required) - **Example Call:** `add_text(text="My Title", start=0, end=3, draft_id="abc123")` - **Response:** `text_element_id="text1"` 4. **`save_draft`** - **Purpose:** Exports and saves the completed project. - **Parameters:** `draft_id` (string, required), `draft_folder` (string, required) - **Example Call:** `save_draft(draft_id="abc123", draft_folder="/exports")` - **Response:** `success` (boolean), `project_path` (string) ### Tool Chaining Pattern Tools are chained together using the `draft_id` generated during the `create_draft` call. Subsequent tool calls reference this `draft_id` to operate on the same project. ``` Draft Creation ↓ add_video(draft_id) add_audio(draft_id) → All reference same draft add_text(draft_id) add_image(draft_id) ↓ save_draft(draft_id) → Finalize ``` ``` -------------------------------- ### Install Project Dependencies (Bash) Source: https://github.com/kritsanan1/capcut-mcp/blob/main/README.md This bash command installs all the necessary Python packages required by the CapCutAPI project. It reads the list of dependencies from the 'requirements.txt' file and installs them using pip. ```bash pip install -r requirements.txt ``` -------------------------------- ### Run CapCut API - Chinese Version Source: https://github.com/kritsanan1/capcut-mcp/blob/main/LANGUAGE_GUIDE.md Execute the CapCut API for the Chinese region. This involves copying an example configuration file to the default config file before running the main script. ```bash cp config.json.example config.json python main.py ``` -------------------------------- ### Multi-Language Support Source: https://github.com/kritsanan1/capcut-mcp/blob/main/SMITHERY_INTEGRATION.md Demonstrates how to specify language preferences for tools like `add_subtitle`, supporting multiple languages. ```APIDOC ## Multi-Language Support All tools that handle text or subtitles support multi-language parameters, allowing for content localization. ### Supported Languages - English (en) - Thai (th) - Vietnamese (vi) - Indonesian (id) - Malay (ms) ### Example: Adding Subtitles in Thai This example shows how to add subtitles with a specific language code. ```python add_subtitle( text="Hello World", language="th", # Specify Thai language start=0, end=3, draft_id="abc123" ) ``` **Parameters for `add_subtitle` (relevant to language):** - **`language`** (string) - Required - The language code for the subtitle (e.g., 'en', 'th', 'vi'). ``` -------------------------------- ### Local Development Server Commands (Shell) Source: https://github.com/kritsanan1/capcut-mcp/blob/main/attached_assets/content-1766325020639.md Provides shell commands for starting the Smithery development server locally. It includes options for running with an interactive playground or just the server, using either uv or poetry. ```shell # Start development server with interactive playground uv run playground # or poetry run playground # Or just run the server uv run dev # or poetry run dev ``` -------------------------------- ### Swagger Documentation Access Source: https://github.com/kritsanan1/capcut-mcp/blob/main/LANGUAGE_GUIDE.md Information on how to access the interactive API documentation via Swagger UI. ```APIDOC ## Swagger Documentation Access ### Description Access the Swagger UI to view all available endpoints, request/response schemas, and test API calls interactively. ### Endpoint `/docs` ### Example URL `http://localhost:5000/docs` ### Usage Navigate to the provided URL in your web browser. You can then explore the API documentation in the selected language, view detailed schemas, and use the "Try-it-out" feature to test endpoints directly. ``` -------------------------------- ### Testing Tools Source: https://github.com/kritsanan1/capcut-mcp/blob/main/SMITHERY_INTEGRATION.md Provides `curl` commands for testing the availability and functionality of the CapCut MCP tools. ```APIDOC ## Testing Tools You can use the following `curl` commands to test the CapCut MCP tools endpoints. ### Validate Tool Schemas This command checks if the tool definitions adhere to the expected schemas. ```bash curl http://localhost:3000/tools/validate ``` ### List Available Tools This command retrieves a list of all tools exposed by the CapCut MCP server. ```bash curl http://localhost:3000/tools/list ``` ### Test Tool Execution This command allows you to execute a specific tool with provided parameters. **Example: Testing `create_draft`** ```bash curl -X POST http://localhost:3000/tools/execute \ -H "Content-Type: application/json" \ -d '{"tool": "create_draft", "params": {"draft_name": "Test Draft"}}' ``` - **`tool`** (string) - Required - The name of the tool to execute. - **`params`** (object) - Required - An object containing the parameters for the specified tool. ``` -------------------------------- ### Python Example: Add Subtitle with Language Preference Source: https://github.com/kritsanan1/capcut-mcp/blob/main/SMITHERY_INTEGRATION.md Illustrates how to add subtitles to a CapCut draft with specific language settings. This function highlights the multi-language parameter support for tools like `add_subtitle`, enabling localized content creation. ```python add_subtitle( text="Hello World", language="th", # Thai language start=0, end=3, draft_id="abc123" ) ``` -------------------------------- ### Copy Configuration File (Bash) Source: https://github.com/kritsanan1/capcut-mcp/blob/main/README.md This bash command copies the example configuration file `config.json.example` to `config.json`. This is the first step in customizing the CapCutAPI's settings, allowing users to modify the new `config.json` file. ```bash cp config.json.example config.json ``` -------------------------------- ### JSON Example: CapCut Tool Execution Response Structure Source: https://github.com/kritsanan1/capcut-mcp/blob/main/SMITHERY_INTEGRATION.md Illustrates the standard JSON response format for CapCut MCP tool executions. It shows fields for success status, returned data, and any error objects, which agents can use for handling outcomes. ```json { "success": true, "data": {...}, "error": null } ``` -------------------------------- ### Run CapCut API - English Version (Default) Source: https://github.com/kritsanan1/capcut-mcp/blob/main/LANGUAGE_GUIDE.md Execute the default English version of the CapCut API. This command assumes the default configuration is already set up. ```bash python main.py ``` -------------------------------- ### Smithery.ai Configuration Source: https://github.com/kritsanan1/capcut-mcp/blob/main/SMITHERY_INTEGRATION.md Steps to configure the CapCut MCP server within the Smithery.ai platform, including server registration and agent configuration. ```APIDOC ## Smithery.ai Configuration To integrate the CapCut API as an MCP server with Smithery.ai, follow these configuration steps: ### 1. Register MCP Server Register the CapCut API server on the Smithery.ai platform. **Request Body Example:** ```json { "name": "CapCut API", "type": "http", "url": "http://your-replit-domain:3000/mcp", "description": "Video editing with CapCut API" } ``` - **`name`** (string) - Required - A human-readable name for the MCP server. - **`type`** (string) - Required - The type of server, typically 'http'. - **`url`** (string) - Required - The endpoint URL for the MCP server. - **`description`** (string) - Optional - A brief description of the server's functionality. ### 2. Add to Agent Configuration Configure your Smithery agent to recognize and use the CapCut MCP server. **Agent Configuration Snippet:** ```json { "mcpServers": { "capcut": { "type": "http", "url": "http://your-replit-domain:3000/mcp" } } } ``` - **`mcpServers`** (object) - Configuration for MCP servers. - **`capcut`** (object) - Specific configuration for the CapCut server. - **`type`** (string) - Required - The type of MCP server connection ('http'). - **`url`** (string) - Required - The URL to the CapCut MCP endpoint. ### 3. Define Agent Skills Ensure that the predefined agent skills (workflows) relevant to CapCut functionalities are added to your agent's skill configuration (e.g., in `agent_skills.json`). ``` -------------------------------- ### Error Handling Source: https://github.com/kritsanan1/capcut-mcp/blob/main/SMITHERY_INTEGRATION.md Describes the structure of error responses from MCP tools and how agents can handle these errors. ```APIDOC ## Error Handling MCP tools return structured responses that include error information. ### Tool Response Structure ```json { "success": true, // boolean: Indicates if the operation was successful "data": {...}, // object: Contains the result data if successful "error": null // object/null: Contains error details if an error occurred } ``` ### Agent Error Handling Strategies When an agent receives an error response from a tool, it can employ various strategies: - **Retry:** Attempt the operation again, possibly with adjusted parameters. - **Skip:** If the step is non-critical, the agent might skip it and proceed. - **Clarification:** Request more information or guidance from the user. - **Fallback:** Utilize alternative methods or tools if the primary approach fails. ``` -------------------------------- ### Agent Skills & Workflows Source: https://github.com/kritsanan1/capcut-mcp/blob/main/SMITHERY_INTEGRATION.md Predefined agent skills represent common video editing tasks that can be achieved by chaining MCP tools. ```APIDOC ## Agent Skills (Workflows) These are examples of predefined workflows for common video editing tasks. ### 1. Create Video with Text Overlay This workflow is used for adding text overlays to video content. **Workflow:** `create_draft` → `add_video` → `add_audio` → `add_text` → `save_draft` ### 2. Generate Subtitled Video This workflow is for creating subtitled content. **Workflow:** `create_draft` → `add_video` → `add_subtitle` → `add_effect` → `save_draft` ### 3. Create Image Slideshow This workflow is designed for creating image-based presentations. **Workflow:** `create_draft` → `add_image` (multiple) → `add_effect` → `add_audio` → `save_draft` ### 4. Create Multi-Language Video This workflow supports creating videos for different language regions. **Workflow:** `create_draft` → `add_video` → `add_subtitle` (multi-lang) → `add_text` → `save_draft` ``` -------------------------------- ### MCP Tools Available Source: https://github.com/kritsanan1/capcut-mcp/blob/main/SMITHERY_INTEGRATION.md The CapCut API exposes several core tools through the Model Context Protocol (MCP) for various video editing functionalities. ```APIDOC ## Core MCP Tools This section lists the primary tools available through the CapCut MCP API. ### Tools - **create_draft** - Description: Initialize a new CapCut project. - Method: POST - Endpoint: `/mcp/tools/create_draft` - **add_video** - Description: Insert video files with positioning and timing. - Method: POST - Endpoint: `/mcp/tools/add_video` - **add_audio** - Description: Add audio tracks with volume control. - Method: POST - Endpoint: `/mcp/tools/add_audio` - **add_text** - Description: Add text overlays with formatting. - Method: POST - Endpoint: `/mcp/tools/add_text` - **add_image** - Description: Insert images into projects. - Method: POST - Endpoint: `/mcp/tools/add_image` - **add_subtitle** - Description: Add captions and subtitles. - Method: POST - Endpoint: `/mcp/tools/add_subtitle` - **add_effect** - Description: Apply transitions, filters, and animations. - Method: POST - Endpoint: `/mcp/tools/add_effect` - **save_draft** - Description: Export and save projects. - Method: POST - Endpoint: `/mcp/tools/save_draft` ``` -------------------------------- ### Create New CapCut Draft Project Source: https://context7.com/kritsanan1/capcut-mcp/llms.txt Initializes a new CapCut draft project with specified canvas dimensions (width and height). This endpoint is crucial for starting any new video editing workflow. The response includes a unique draft ID and a preview URL. ```python import requests # Create a 1080x1920 portrait video draft response = requests.post("http://localhost:9000/create_draft", json={ "width": 1080, "height": 1920 }) result = response.json() if result["success"]: draft_id = result["output"]["draft_id"] draft_url = result["output"]["draft_url"] print(f"Draft created: {draft_id}") print(f"Preview URL: {draft_url}") else: print(f"Error: {result['error']}") # Expected output: # { # "success": true, # "output": { # "draft_id": "7234567890123456789", # "draft_url": "https://draft.example.com/preview?id=7234567890123456789" # }, # "error": null # } ``` ```bash # Using curl curl -X POST http://localhost:9000/create_draft \ -H "Content-Type: application/json" \ -d '{"width": 1920, "height": 1080}' ``` -------------------------------- ### API Rate Limiting Source: https://github.com/kritsanan1/capcut-mcp/blob/main/SMITHERY_INTEGRATION.md Details the default rate limits imposed on API requests to prevent abuse and ensure fair usage. ```APIDOC ## API Rate Limiting To ensure stable performance and prevent misuse, the CapCut API enforces rate limits on requests. ### Default Limits - **Per Minute:** 100 requests per minute per IP address. - **Per Hour:** 1000 requests per hour. ### Large File Uploads - Uploads exceeding 500MB are handled asynchronously to manage resources effectively. ``` -------------------------------- ### Run CapCut API - Indonesia Version Source: https://github.com/kritsanan1/capcut-mcp/blob/main/LANGUAGE_GUIDE.md Execute the CapCut API for the Indonesia region. This involves either running a specific script for Indonesia or copying the Indonesia configuration to the default config file before running the main script. ```bash python main_indonesia.py # or cp config_indonesia.json config.json python main.py ``` -------------------------------- ### Run CapCut API - Thailand Version Source: https://github.com/kritsanan1/capcut-mcp/blob/main/LANGUAGE_GUIDE.md Execute the CapCut API for the Thailand region. This involves either running a specific script for Thailand or copying the Thailand configuration to the default config file before running the main script. ```bash python main_thailand.py # or cp config_thailand.json config.json python main.py ``` -------------------------------- ### Add Sticker using Python Source: https://context7.com/kritsanan1/capcut-mcp/llms.txt Adds an animated sticker or overlay to the video. This requires the draft ID, a sticker ID, start and end times for its appearance, and transformation parameters like position (transform_x, transform_y), scale, rotation, and alpha. The operation is performed by POSTing to the /add_sticker endpoint. ```python import requests draft_id = "7234567890123456789" # Add animated sticker response = requests.post("http://localhost:9000/add_sticker", json={ "draft_id": draft_id, "sticker_id": "sticker_heart_001", "start": 1, "end": 4, "transform_x": 0.6, # Right side of screen "transform_y": -0.5, # Upper portion "scale_x": 0.8, "scale_y": 0.8, "rotation": 15.0, # Slight rotation in degrees "alpha": 1.0, # Fully opaque "flip_horizontal": False, "flip_vertical": False, "track_name": "sticker_01" }) result = response.json() if result["success"]: print("Sticker added successfully") else: print(f"Error: {result['error']}") ``` -------------------------------- ### Add Transition Effect using Python Source: https://context7.com/kritsanan1/capcut-mcp/llms.txt Applies a transition effect between two points in a video clip. Requires specifying effect type, start and end times, track name, and transition parameters. The effect is applied using a POST request to the /add_effect endpoint. ```python response = requests.post("http://localhost:9000/add_effect", json={ "draft_id": draft_id, "effect_type": "transition", "start": 9.5, # Apply at 9.5 seconds "end": 10.5, # 1 second transition "track_name": "effect_01", "params": [ { "name": "transition_style", "value": "wipe_right" }, { "name": "ease", "value": "ease_in_out" } ] }) result = response.json() if result["success"]: print("Effect added successfully") else: print(f"Error: {result['error']}") ``` -------------------------------- ### JSON Configuration for Smithery Agent MCP Server Addition Source: https://github.com/kritsanan1/capcut-mcp/blob/main/SMITHERY_INTEGRATION.md Shows the JSON format for adding the registered CapCut MCP server to a Smithery agent's configuration. This enables the agent to discover and utilize the CapCut API's tools. ```json { "mcpServers": { "capcut": { "type": "http", "url": "http://your-replit-domain:3000/mcp" } } } ``` -------------------------------- ### Create Weather Server with Session Configuration (Python) Source: https://github.com/kritsanan1/capcut-mcp/blob/main/attached_assets/content-1766325020639.md This snippet demonstrates how to create a FastMCP server instance using Smithery, defining a configuration schema for session-specific settings like temperature units. It shows how to access this configuration within a tool via the Context object. ```python from mcp.server.fastmcp import Context, FastMCP from smithery.decorators import smithery from pydantic import BaseModel, Field class ConfigSchema(BaseModel): unit: str = Field("celsius", description="Temperature unit (celsius or fahrenheit)") @smithery.server(config_schema=ConfigSchema) def create_server(): """Create and return a FastMCP server instance with session config.""" server = FastMCP(name="Weather Server") @server.tool() def get_weather(city: str, ctx: Context) -> str: """Get weather for a city.""" # Access session-specific config through context session_config = ctx.session_config # Use the configured temperature unit unit = session_config.unit formatted_temp = f"22°C" if unit == "celsius" else "72°F" return f"Weather in {city}: {formatted_temp}" return server ``` -------------------------------- ### CapCut API Endpoints Source: https://github.com/kritsanan1/capcut-mcp/blob/main/LANGUAGE_GUIDE.md This section details the available API endpoints and their translations for different languages. ```APIDOC ## CapCut API Endpoints ### Description Details the available API endpoints and their corresponding translations for supported languages. ### Method GET ### Endpoint `/add_video` ### Description Adds a video to the project. ### Request Example ```json { "video_path": "path/to/your/video.mp4" } ``` ### Response #### Success Response (200) - **message** (string) - Confirmation of video addition. #### Response Example ```json { "message": "Video added successfully." } ``` --- ### Method GET ### Endpoint `/add_text` ### Description Adds text to the project. ### Request Example ```json { "text": "Your text here", "position": { "x": 100, "y": 200 } } ``` ### Response #### Success Response (200) - **message** (string) - Confirmation of text addition. #### Response Example ```json { "message": "Text added successfully." } ``` ``` -------------------------------- ### Create Slideshow with Image Transitions (Python) Source: https://context7.com/kritsanan1/capcut-mcp/llms.txt Generates a slideshow by adding multiple images sequentially with specified transitions between them. Each image is added with its own timing and transition settings. Requires a valid draft ID and a list of image URLs. ```python images = [ "https://example.com/slide1.jpg", "https://example.com/slide2.jpg", "https://example.com/slide3.jpg" ] for i, image_url in enumerate(images): response = requests.post("http://localhost:9000/add_image", json={ "draft_id": draft_id, "image_url": image_url, "start": i * 4, # 4 seconds per slide "end": (i + 1) * 4, "transition": "dissolve", "transition_duration": 0.8, "track_name": f"image_slide_{i}" }) ``` -------------------------------- ### POST /create_draft Source: https://context7.com/kritsanan1/capcut-mcp/llms.txt Initializes a new CapCut draft project with specified canvas dimensions. ```APIDOC ## POST /create_draft ### Description Initializes a new CapCut draft project with specified canvas dimensions. ### Method POST ### Endpoint /create_draft ### Parameters #### Query Parameters - **width** (integer) - Required - The width of the canvas. - **height** (integer) - Required - The height of the canvas. ### Request Example ```json { "width": 1080, "height": 1920 } ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the operation was successful. - **output** (object) - Contains the draft ID and a preview URL. - **draft_id** (string) - The unique identifier for the created draft. - **draft_url** (string) - A URL to preview the draft. - **error** (null) - Null if the operation was successful. #### Response Example ```json { "success": true, "output": { "draft_id": "7234567890123456789", "draft_url": "https://draft.example.com/preview?id=7234567890123456789" }, "error": null } ``` ``` -------------------------------- ### Accessing Session Configuration in a Smithery Tool (Python) Source: https://github.com/kritsanan1/capcut-mcp/blob/main/attached_assets/content-1766325020639.md Illustrates how to access and utilize session-specific configuration within a Smithery tool. The configuration is passed via the `ctx.session_config` object, allowing for customized tool behavior based on user settings. ```python @server.tool() def my_tool(arg: str, ctx: Context) -> str: # Access user's session config config = ctx.session_config # Use config values to customize behavior if config.api_key: # Make authenticated API calls pass ``` -------------------------------- ### Troubleshooting Local Server Execution (Shell) Source: https://github.com/kritsanan1/capcut-mcp/blob/main/attached_assets/content-1766325020639.md A shell command to verify the local Smithery development server execution, often used as a troubleshooting step before deployment. ```shell uv run smithery dev ``` -------------------------------- ### Complete Video Project Workflow with Python Source: https://context7.com/kritsanan1/capcut-mcp/llms.txt This comprehensive Python script orchestrates the creation of a video project using the CapCut API. It covers creating a draft, adding video footage, background music, text overlays with animations, and subtitles from an SRT string. Finally, it saves the draft and polls for completion, providing the path to the saved project. ```python import requests import time BASE_URL = "http://localhost:9000" def create_video_project(): # 1. Create draft print("Creating draft...") response = requests.post(f"{BASE_URL}/create_draft", json={ "width": 1920, "height": 1080 }) draft_id = response.json()["output"]["draft_id"] print(f"Draft created: {draft_id}") # 2. Add main video print("Adding video...") requests.post(f"{BASE_URL}/add_video", json={ "draft_id": draft_id, "video_url": "https://example.com/main-footage.mp4", "start": 0, "end": 30, "width": 1920, "height": 1080 }) # 3. Add background music print("Adding audio...") requests.post(f"{BASE_URL}/add_audio", json={ "draft_id": draft_id, "audio_url": "https://example.com/music.mp3", "start": 0, "end": 30, "volume": 0.5 }) # 4. Add title print("Adding title text...") requests.post(f"{BASE_URL}/add_text", json={ "draft_id": draft_id, "text": "My Amazing Video", "start": 0, "end": 3, "font": "Arial", "font_size": 15.0, "font_color": "#FFFFFF", "transform_y": -0.6, "intro_animation": "zoom_in", "outro_animation": "fade_out" }) # 5. Add subtitles print("Adding subtitles...") srt = """1 00:00:05,000 --> 00:00:10,000 Welcome to our presentation 2 00:00:10,500 --> 00:00:15,000 Let's explore the key features """ requests.post(f"{BASE_URL}/add_subtitle", json={ "draft_id": draft_id, "srt": srt, "font_size": 5.0, "font_color": "#FFFFFF" }) # 6. Save draft print("Saving draft...") response = requests.post(f"{BASE_URL}/save_draft", json={ "draft_id": draft_id }) task_id = response.json()["output"]["task_id"] # 7. Wait for completion while True: response = requests.post(f"{BASE_URL}/query_draft_status", json={ "task_id": task_id }) status = response.json()["output"]["status"] if status == "completed": draft_path = response.json()["output"]["draft_path"] print(f"Draft completed: {draft_path}") print("Copy this folder to your CapCut drafts directory") break time.sleep(1) if __name__ == "__main__": create_video_project() ``` -------------------------------- ### Create Draft Source: https://context7.com/kritsanan1/capcut-mcp/llms.txt Creates a new, empty draft project. You can specify the dimensions for the new project. ```APIDOC ## POST /create_draft ### Description Creates a new, empty video draft project. You can specify the canvas dimensions for the draft. ### Method POST ### Endpoint `/create_draft` ### Parameters #### Request Body - **width** (integer) - Required - The width of the draft canvas in pixels. - **height** (integer) - Required - The height of the draft canvas in pixels. ### Request Example ```json { "width": 1920, "height": 1080 } ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the draft was created successfully. - **output** (object) - **draft_id** (string) - The unique identifier for the newly created draft. #### Response Example ```json { "success": true, "output": { "draft_id": "some_unique_draft_id" } } ``` ``` -------------------------------- ### Run CapCut API - Vietnam Version Source: https://github.com/kritsanan1/capcut-mcp/blob/main/LANGUAGE_GUIDE.md Execute the CapCut API for the Vietnam region. This involves either running a specific script for Vietnam or copying the Vietnam configuration to the default config file before running the main script. ```bash python main_vietnam.py # or cp config_vietnam.json config.json python main.py ``` -------------------------------- ### Run CapCut API - Malaysia Version Source: https://github.com/kritsanan1/capcut-mcp/blob/main/LANGUAGE_GUIDE.md Execute the CapCut API for the Malaysia region. This involves either running a specific script for Malaysia or copying the Malaysia configuration to the default config file before running the main script. ```bash python main_malaysia.py # or cp config_malaysia.json config.json python main.py ``` -------------------------------- ### Add a New Language to CapCut API Source: https://github.com/kritsanan1/capcut-mcp/blob/main/LANGUAGE_GUIDE.md Extends the CapCut API by adding support for a new language. This involves updating translation dictionaries, creating a new configuration file, and developing a new main entry file for the language. ```python # 1. Add translations to app/i18n.py under the TRANSLATIONS dictionary # Example: # TRANSLATIONS = { # "en": {"add_video": "Add Video"}, # "xx": {"add_video": "Translate Add Video"} # For new language 'xx' # } # 2. Create a new configuration file (e.g., config_newlang.json) # Example content: # { # "region": "New Region", # "timezone": "New Timezone" # } # 3. Create a new main entry file (e.g., main_newlang.py) # Example content: # from app import create_app # app = create_app(language="xx") # 'xx' is the code for the new language # if __name__ == "__main__": # app.run(debug=True) ``` -------------------------------- ### POST /add_audio Source: https://context7.com/kritsanan1/capcut-mcp/llms.txt Adds background music, sound effects, or voiceover with volume and timing control. ```APIDOC ## POST /add_audio ### Description Adds background music, sound effects, or voiceover with volume and timing control. ### Method POST ### Endpoint /add_audio ### Parameters #### Query Parameters - **draft_id** (string) - Required - The ID of the draft to add the audio to. - **audio_url** (string) - Required - The URL of the audio file. - **start** (integer) - Required - The start time in seconds of the audio segment to use. - **end** (integer) - Required - The end time in seconds of the audio segment to use. - **target_start** (integer) - Optional - The start time in seconds on the draft timeline. - **volume** (float) - Optional - Audio volume (0.0 to 1.0). - **speed** (float) - Optional - Playback speed. - **track_name** (string) - Optional - Name of the track. - **effect_type** (string) - Optional - Type of audio effect (e.g., "fade_in_out"). - **effect_params** (object) - Optional - Parameters for the audio effect. - **fade_in_duration** (float) - Optional - Duration of the fade-in effect. - **fade_out_duration** (float) - Optional - Duration of the fade-out effect. ### Request Example ```json { "draft_id": "7234567890123456789", "audio_url": "https://example.com/background-music.mp3", "start": 0, "end": 30, "target_start": 0, "volume": 0.6, "speed": 1.0, "track_name": "audio_main", "effect_type": "fade_in_out", "effect_params": { "fade_in_duration": 2.0, "fade_out_duration": 3.0 } } ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the operation was successful. - **output** (object) - Contains information about the added audio track. - **error** (null) - Null if the operation was successful. #### Response Example ```json { "success": true, "output": {}, "error": null } ``` ``` -------------------------------- ### POST /add_video Source: https://context7.com/kritsanan1/capcut-mcp/llms.txt Adds video content to a draft with precise timing, positioning, and optional effects. ```APIDOC ## POST /add_video ### Description Adds video content to a draft with precise timing, positioning, and optional effects. ### Method POST ### Endpoint /add_video ### Parameters #### Query Parameters - **draft_id** (string) - Required - The ID of the draft to add the video to. - **video_url** (string) - Required - The URL of the video file. - **start** (integer) - Required - The start time in seconds of the video segment to use. - **end** (integer) - Required - The end time in seconds of the video segment to use. - **target_start** (integer) - Optional - The start time in seconds on the draft timeline. - **width** (integer) - Optional - The width of the video on the canvas. - **height** (integer) - Optional - The height of the video on the canvas. - **transform_x** (float) - Optional - Horizontal position (-1 to 1). - **transform_y** (float) - Optional - Vertical position (-1 to 1). - **scale_x** (float) - Optional - Horizontal scaling factor. - **scale_y** (float) - Optional - Vertical scaling factor. - **speed** (float) - Optional - Playback speed. - **volume** (float) - Optional - Audio volume (0.0 to 1.0). - **track_name** (string) - Optional - Name of the track. - **transition** (string) - Optional - Type of transition (e.g., "fade"). - **transition_duration** (float) - Optional - Duration of the transition in seconds. - **mask_type** (string) - Optional - Type of mask (e.g., "circle"). - **mask_center_x** (float) - Optional - X-coordinate of the mask center. - **mask_center_y** (float) - Optional - Y-coordinate of the mask center. - **mask_size** (float) - Optional - Size of the mask. - **mask_feather** (float) - Optional - Feathering of the mask edge. - **mask_invert** (boolean) - Optional - Whether to invert the mask. ### Request Example ```json { "draft_id": "7234567890123456789", "video_url": "https://example.com/footage.mp4", "start": 0, "end": 10, "target_start": 0, "width": 1080, "height": 1920, "transform_x": 0.0, "transform_y": 0.0, "scale_x": 1.0, "scale_y": 1.0, "speed": 1.0, "volume": 0.8, "track_name": "video_main", "transition": "fade", "transition_duration": 0.5 } ``` ```json { "draft_id": "7234567890123456789", "video_url": "https://example.com/clip.mp4", "start": 0, "end": 5, "mask_type": "circle", "mask_center_x": 0.5, "mask_center_y": 0.5, "mask_size": 0.8, "mask_feather": 0.1, "mask_invert": false } ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the operation was successful. - **output** (object) - Contains information about the added video track. - **error** (null) - Null if the operation was successful. #### Response Example ```json { "success": true, "output": {}, "error": null } ``` ``` -------------------------------- ### JSON Configuration for Smithery.ai MCP Server Registration Source: https://github.com/kritsanan1/capcut-mcp/blob/main/SMITHERY_INTEGRATION.md Provides the JSON structure required to register the CapCut API as an MCP server within the Smithery.ai platform. This includes the server's name, type, URL endpoint, and a brief description. ```json { "name": "CapCut API", "type": "http", "url": "http://your-replit-domain:3000/mcp", "description": "Video editing with CapCut API" } ``` -------------------------------- ### POST /add_image Source: https://context7.com/kritsanan1/capcut-mcp/llms.txt Adds static images or image sequences to the video, supporting animations, transitions, and scaling. ```APIDOC ## POST /add_image ### Description Adds static images or image sequences to the video, supporting animations, transitions, and scaling. ### Method POST ### Endpoint /add_image ### Parameters #### Request Body - **draft_id** (string) - Required - The ID of the video draft. - **image_url** (string) - Required - The URL of the image file. - **start** (number) - Required - The start time of the image in seconds. - **end** (number) - Required - The end time of the image in seconds. - **width** (integer) - Optional - The width of the image in pixels. - **height** (integer) - Optional - The height of the image in pixels. - **transform_x** (number) - Optional - Horizontal position (-1.0 to 1.0). - **transform_y** (number) - Optional - Vertical position (-1.0 to 1.0). - **scale_x** (number) - Optional - Horizontal scaling factor (e.g., 0.5 for 50%). - **scale_y** (number) - Optional - Vertical scaling factor. - **intro_animation** (string) - Optional - Name of the intro animation. - **intro_animation_duration** (number) - Optional - Duration of the intro animation. - **outro_animation** (string) - Optional - Name of the outro animation. - **outro_animation_duration** (number) - Optional - Duration of the outro animation. - **transition** (string) - Optional - Name of the transition effect between images in a sequence. - **transition_duration** (number) - Optional - Duration of the transition effect. - **track_name** (string) - Optional - The name of the image track. ### Request Example (Single Image) ```json { "draft_id": "7234567890123456789", "image_url": "https://example.com/logo.png", "start": 0, "end": 3, "width": 1080, "height": 1920, "transform_x": 0.5, "transform_y": 0.0, "scale_x": 0.5, "scale_y": 0.5, "intro_animation": "zoom_in", "intro_animation_duration": 0.5, "outro_animation": "fade_out", "outro_animation_duration": 0.5, "track_name": "image_logo" } ``` ### Request Example (Slideshow Sequence) ```python # Assuming draft_id is defined images = [ "https://example.com/slide1.jpg", "https://example.com/slide2.jpg", "https://example.com/slide3.jpg" ] for i, image_url in enumerate(images): response = requests.post("http://localhost:9000/add_image", json={ "draft_id": draft_id, "image_url": image_url, "start": i * 4, # 4 seconds per slide "end": (i + 1) * 4, "transition": "dissolve", "transition_duration": 0.8, "track_name": f"image_slide_{i}" }) ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the operation was successful. - **message** (string) - A confirmation message. #### Response Example ```json { "success": true, "message": "Image added successfully" } ``` ``` -------------------------------- ### Add Image with Animations and Transitions (Python) Source: https://context7.com/kritsanan1/capcut-mcp/llms.txt Adds a static image to the draft with specified URL, timing, dimensions, and position. Supports intro and outro animations. Requires a valid draft ID and image URL. ```python response = requests.post("http://localhost:9000/add_image", json={ "draft_id": draft_id, "image_url": "https://example.com/logo.png", "start": 0, "end": 3, "width": 1080, "height": 1920, "transform_x": 0.5, "transform_y": 0.0, "scale_x": 0.5, # 50% size "scale_y": 0.5, "intro_animation": "zoom_in", "intro_animation_duration": 0.5, "outro_animation": "fade_out", "outro_animation_duration": 0.5, "track_name": "image_logo" }) ``` -------------------------------- ### Add Animation Effect using Python Source: https://context7.com/kritsanan1/capcut-mcp/llms.txt Applies an animation effect to a video segment. This involves specifying the draft ID, effect type as 'animation', the time range (start and end), a track name, and animation parameters such as animation type and amplitude. The request is sent to the /add_effect endpoint. ```python response = requests.post("http://localhost:9000/add_effect", json={ "draft_id": draft_id, "effect_type": "animation", "start": 2, "end": 5, "track_name": "effect_animation", "params": [ { "name": "animation_type", "value": "shake" }, { "name": "amplitude", "value": 0.05 } ] } ) ``` -------------------------------- ### Add Video Keyframes (Zoom/Pan) using Python Source: https://context7.com/kritsanan1/capcut-mcp/llms.txt Creates a zoom and pan effect on a video using keyframes for scale and position. This function requires the draft ID, track name, lists of property types (e.g., 'scale_x', 'transform_x'), their corresponding times, and the values at those times. The request is sent to the /add_video_keyframe endpoint. ```python # Create zoom and pan effect response = requests.post("http://localhost:9000/add_video_keyframe", json={ "draft_id": draft_id, "track_name": "video_main", "property_types": ["scale_x", "scale_x", "transform_x", "transform_x"], "times": [0.0, 3.0, 0.0, 3.0], "values": ["1.0", "1.5", "0.0", "0.2"] # Zoom and pan right }) ```