How fancyboi999/capcut-mcp works
Project type and purpose
• This is an open‐source Python tool exposing HTTP APIs to create, edit, and save CapCut draft files programmatically.
• It bundles a lightweight API server (main.py → app/routes + app/controllers + app/schemas), a pure-Python draft-manipulation library (pyJianYingDraft), and various utility scripts (downloader, oss, cache, ffmpeg wrappers).
File structure
• Top level:
• main.py – entry point for HTTP service
• add_*.py, create_draft.py, save_draft_impl.py – CLI or script helpers
• config.json.example & settings/ – configuration loader
• requirements.txt – dependencies (FastAPI or Flask, pydantic, requests, etc.)
• template/ & template_jianying/ – JSON templates for draft metadata
• app/ directory:
• routes/ – HTTP endpoint definitions (one file per resource)
• controllers/ – business‐logic handlers invoked by routes
• schemas/ – request/response validation models (pydantic)
• pyJianYingDraft/ package:
• core domain classes (Track, Segment, Animation, etc.)
• metadata definitions and converters
• utilities (time_util, util)
• Supporting modules: downloader.py, oss.py, draft_cache.py, save_task_cache.py, util.py – handle media I/O, caching, and external service integration
README for additional insights
• Lists the main endpoints (/create_draft, /add_video, etc.)
• Emphasizes reliance on ffmpeg (system CLI) and AI services (HTTP calls)
• Describes config.json customization and server startup (python main.py)
Final advice
• 5 layers (Client, API, Application, Domain, Infrastructure) plus External systems
• Both synchronous flows (API calls) and asynchronous or background (caching, downloads)
• Keep it uncluttered: focus on major interactions, not every single file