Metadata-Version: 2.5
Name: video-generation-mcp
Version: 0.4.0
Summary: MCP server that makes narrated 'tech explained' reels (3D or 2D), image posts and infographics.
Project-URL: Homepage, https://github.com/SalindaHulangamuwa/video-generation-mcp
Project-URL: Issues, https://github.com/SalindaHulangamuwa/video-generation-mcp/issues
Project-URL: Changelog, https://github.com/SalindaHulangamuwa/video-generation-mcp/blob/main/CHANGELOG.md
Author-email: Salinda Hulangamuwa <salindahulangamuwa3@gmail.com>
Keywords: fastmcp,ffmpeg,gemini,mcp,model-context-protocol,reels,three.js,tts,video
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Multimedia :: Video
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: fastmcp<5,>=4.1
Requires-Dist: httpx>=0.27
Requires-Dist: numpy>=1.26
Requires-Dist: pillow>=10
Requires-Dist: playwright==1.56.0
Requires-Dist: pocketsphinx>=5.1
Requires-Dist: pydantic-settings>=2.3
Requires-Dist: pydantic>=2.7
Provides-Extra: models
Requires-Dist: fast-simplification>=0.1.7; extra == 'models'
Requires-Dist: trimesh>=4.4; extra == 'models'
Description-Content-Type: text/markdown

# video-generation-mcp

An MCP server that makes narrated "tech explained" reels for Facebook, Instagram and YouTube Shorts:
script → Gemini voice → line timings → **3D (three.js) or 2D** visuals → background render → music mix → final mp4.
It also makes white editorial image posts, step-by-step infographics, thumbnails, captions and other formats.

Built with [FastMCP](https://gofastmcp.com) for Claude Desktop, Claude Code, Cursor, Windsurf, VS Code (Cline/Roo), Antigravity, and any MCP client.

## Tools (47)

| Area | Tools |
|---|---|
| Overview | `list_reels`, `reel_status`, `studio_doctor` |
| Reel + script | `create_reel`, `write_script`, `check_script`, `write_caption_file` |
| Voice | `generate_voice`, `speak_script`, `speak` (chunked, model fallback, `style`, `background`), `voice_status`, `polish_voice`, `import_voice` |
| Timing | `align_voice`, `set_line_times` |
| Code + assets | `list_files`, `read_file`, `write_file` (returns sha256), `file_hashes`, `add_asset`, `list_templates`, `save_as_template` |
| Shot plans | `shot_guide`, `write_shots` (describe shots as data), `fix_frames` (automatic check-and-fix) |
| Asset library | `import_asset` (your models, images, textures, 360° skies; big OBJ/GLB models optimised to web .glb), `list_assets`, `show_asset`, `use_asset` |
| Images | `generate_image` (photoreal stills from a prompt: plates, backgrounds, textures) |
| Look before rendering | `render_stills` (contact sheet image), `check_frames` (automatic checks), `safe_zone_check` |
| Render | `start_render`, `render_status`, `cancel_render`, `finish_reel` |
| Music | `set_music` (calm, upbeat, tense, ambient, none), `import_music` |
| After rendering | `preview_video`, `check_audio`, `add_captions`, `make_thumbnail`, `export_formats`, `trim_or_speed`, `compress_video` |
| Image posts | `render_image_post`, `render_infographic` |
| Planning + cleanup | `log_topic`, `list_topics`, `clean_reel` |

Optimising big models in `import_asset` needs the `models` extra (`uv sync --extra models` / `pip install video-generation-mcp[models]`).

A typical reel: `create_reel` → `write_script` → `check_script` → `generate_voice` → `align_voice` →
`write_file` (3d/world.js with [`KIT`](docs/kit.md)) → `write_shots` (shot plan) → `render_stills` → `fix_frames` → `start_render` → `render_status` →
`preview_video`.

---

## Installation & Setup

### Prerequisites

- **Python 3.10+**
- **uv** (recommended package manager) or standard `pip` / `pipx`
- **ffmpeg** (with `libass` support for subtitle burning)

#### Installing ffmpeg:
- **macOS**: `brew install ffmpeg`
- **Linux (Ubuntu/Debian)**: `sudo apt update && sudo apt install -y ffmpeg`
- **Windows**: `winget install Gyan.FFmpeg` or `choco install ffmpeg`

---

## Installation Methods

You can run `video-generation-mcp` using either the **PyPI Package** method (recommended, no source clone needed) or the **Local Source Clone** method.

### Method 1: PyPI Package (`uvx` / `pipx`)

When using PyPI, there is no need to manually clone the repository or manage virtual environments. `uvx` automatically runs the published package.

Make sure you install the Playwright Chromium browser once:
```bash
uvx --from video-generation-mcp playwright install chromium
```

### Method 2: Local Source Clone

1. Clone or download this repository:
   ```bash
   git clone https://github.com/SalindaHulangamuwa/video-generation-mcp.git
   cd video-generation-mcp
   ```
2. Set up environment file:
   ```bash
   cp .env.example .env
   # Edit .env and specify your BX_STUDIO_DIR and GEMINI_API_KEY
   ```
3. Install dependencies and browser:
   ```bash
   uv sync
   uv run playwright install chromium
   ```
4. Verify system dependencies:
   ```bash
   uv run video-generation-mcp doctor
   ```

---

## Configuration Reference

Set these environment variables in your AI client's configuration or `.env` file:

| Variable | Required | Default | Description |
|---|---|---|---|
| `BX_STUDIO_DIR` | **Yes** | — | Absolute path to your studio directory containing `reels/`, `posts/`, etc. |
| `GEMINI_API_KEY` | Recommended | — | Google Gemini API key for TTS narration voices |
| `BX_VOICE` | No | `Iapetus` | Default TTS voice |
| `BX_TTS_MODEL` | No | `gemini-2.5-flash-preview-tts` | TTS model |
| `BX_GL` | No | `auto` | Graphics mode: `gpu`, `swiftshader` (software rasterizer), or `auto` |
| `BX_FPS` | No | `24` | Render frame rate |
| `BX_WORKERS` | No | `2` | Parallel browser render workers |
| `BX_FOOTNOTE` | No | (empty) | Footnote text for 3D frames, e.g. `Simulated · illustration` |

---

## AI Platform Configuration Guides

Configuration file locations by OS:

- **Claude Desktop**:
  - **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
  - **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
  - **Linux**: `~/.config/Claude/claude_desktop_config.json`
- **Cursor**:
  - `.cursor/mcp.json` in workspace root or Settings > MCP
- **Windsurf**:
  - `~/.codeium/windsurf/mcp_config.json`
- **VS Code (Cline / Roo Code)**:
  - **macOS**: `~/Library/Application Support/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/cline_mcp_settings.json`
  - **Windows**: `%APPDATA%\Code\User\globalStorage\rooveterinaryinc.roo-cline\settings\cline_mcp_settings.json`
  - **Linux**: `~/.config/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/cline_mcp_settings.json`

---

### 1. Claude Desktop

#### Option A: PyPI Method (`uvx`)
Add to `claude_desktop_config.json`:

**macOS / Linux**:
```json
{
  "mcpServers": {
    "video-generation-mcp": {
      "command": "uvx",
      "args": ["video-generation-mcp"],
      "env": {
        "BX_STUDIO_DIR": "/absolute/path/to/studio",
        "GEMINI_API_KEY": "your_gemini_api_key_here"
      }
    }
  }
}
```

**Windows**:
```json
{
  "mcpServers": {
    "video-generation-mcp": {
      "command": "uvx.exe",
      "args": ["video-generation-mcp"],
      "env": {
        "BX_STUDIO_DIR": "C:\\Users\\YourUsername\\path\\to\\studio",
        "GEMINI_API_KEY": "your_gemini_api_key_here"
      }
    }
  }
}
```

#### Option B: Local Source Path (`uv run`)

**macOS / Linux**:
```json
{
  "mcpServers": {
    "video-generation-mcp": {
      "command": "uv",
      "args": [
        "run",
        "--directory",
        "/absolute/path/to/video-generation-mcp",
        "video-generation-mcp"
      ],
      "env": {
        "BX_STUDIO_DIR": "/absolute/path/to/studio",
        "GEMINI_API_KEY": "your_gemini_api_key_here"
      }
    }
  }
}
```

**Windows**:
```json
{
  "mcpServers": {
    "video-generation-mcp": {
      "command": "uv.exe",
      "args": [
        "run",
        "--directory",
        "C:\\Users\\YourUsername\\path\\to\\video-generation-mcp",
        "video-generation-mcp"
      ],
      "env": {
        "BX_STUDIO_DIR": "C:\\Users\\YourUsername\\path\\to\\studio",
        "GEMINI_API_KEY": "your_gemini_api_key_here"
      }
    }
  }
}
```

---

### 2. Cursor

Add to your project's `.cursor/mcp.json` or Cursor Settings → MCP:

#### Option A: PyPI Method
```json
{
  "mcpServers": {
    "video-generation-mcp": {
      "command": "uvx",
      "args": ["video-generation-mcp"],
      "env": {
        "BX_STUDIO_DIR": "/absolute/path/to/studio",
        "GEMINI_API_KEY": "your_gemini_api_key_here"
      }
    }
  }
}
```
*(On Windows, use `"uvx.exe"` and Windows formatted paths `C:\\path\\to\\studio`)*

#### Option B: Local Source Path
```json
{
  "mcpServers": {
    "video-generation-mcp": {
      "command": "uv",
      "args": [
        "run",
        "--directory",
        "/absolute/path/to/video-generation-mcp",
        "video-generation-mcp"
      ],
      "env": {
        "BX_STUDIO_DIR": "/absolute/path/to/studio",
        "GEMINI_API_KEY": "your_gemini_api_key_here"
      }
    }
  }
}
```

---

### 3. Claude Code (CLI)

Run directly from your terminal:

#### Option A: PyPI Method
- **macOS / Linux**:
  ```bash
  claude mcp add video-generation-mcp -- uvx video-generation-mcp -e BX_STUDIO_DIR="/absolute/path/to/studio" -e GEMINI_API_KEY="your_api_key"
  ```
- **Windows (PowerShell)**:
  ```powershell
  claude mcp add video-generation-mcp -- uvx.exe video-generation-mcp -e BX_STUDIO_DIR="C:\Users\YourUsername\path\to\studio" -e GEMINI_API_KEY="your_api_key"
  ```

#### Option B: Local Source Path
- **macOS / Linux**:
  ```bash
  claude mcp add video-generation-mcp -- uv run --directory /absolute/path/to/video-generation-mcp video-generation-mcp -e BX_STUDIO_DIR="/absolute/path/to/studio" -e GEMINI_API_KEY="your_api_key"
  ```
- **Windows (PowerShell)**:
  ```powershell
  claude mcp add video-generation-mcp -- uv.exe run --directory C:\Users\YourUsername\path\to\video-generation-mcp video-generation-mcp -e BX_STUDIO_DIR="C:\Users\YourUsername\path\to\studio" -e GEMINI_API_KEY="your_api_key"
  ```

---

### 4. Windsurf

In `~/.codeium/windsurf/mcp_config.json`:

#### Option A: PyPI Method
```json
{
  "mcpServers": {
    "video-generation-mcp": {
      "command": "uvx",
      "args": ["video-generation-mcp"],
      "env": {
        "BX_STUDIO_DIR": "/absolute/path/to/studio",
        "GEMINI_API_KEY": "your_gemini_api_key_here"
      }
    }
  }
}
```

#### Option B: Local Source Path
```json
{
  "mcpServers": {
    "video-generation-mcp": {
      "command": "uv",
      "args": [
        "run",
        "--directory",
        "/absolute/path/to/video-generation-mcp",
        "video-generation-mcp"
      ],
      "env": {
        "BX_STUDIO_DIR": "/absolute/path/to/studio",
        "GEMINI_API_KEY": "your_gemini_api_key_here"
      }
    }
  }
}
```

---

### 5. VS Code (Cline / Roo Code)

In `cline_mcp_settings.json`:

#### Option A: PyPI Method
```json
{
  "mcpServers": {
    "video-generation-mcp": {
      "command": "uvx",
      "args": ["video-generation-mcp"],
      "env": {
        "BX_STUDIO_DIR": "/absolute/path/to/studio",
        "GEMINI_API_KEY": "your_gemini_api_key_here"
      },
      "disabled": false,
      "autoApprove": []
    }
  }
}
```

#### Option B: Local Source Path
```json
{
  "mcpServers": {
    "video-generation-mcp": {
      "command": "uv",
      "args": [
        "run",
        "--directory",
        "/absolute/path/to/video-generation-mcp",
        "video-generation-mcp"
      ],
      "env": {
        "BX_STUDIO_DIR": "/absolute/path/to/studio",
        "GEMINI_API_KEY": "your_gemini_api_key_here"
      },
      "disabled": false,
      "autoApprove": []
    }
  }
}
```

---

## Docs

- [Architecture](docs/architecture.md)
- [Writing a 3D reel](docs/3d-reel-contract.md)
- [KIT: looks, framing, labels, your assets, post-processing, checks](docs/kit.md)
- [Mac setup and development](docs/setup-mac.md)

## Development

```bash
uv sync
uv run pytest              # runs test suite
uv run ruff check src tests && uv run mypy
```
