Skip to main content
Glama
README.md
# 🎬 AI Video MCP Server

> **Turn text scripts into complete videos with stock footage, AI narration, and subtitles. Standard MCP tool β€” works with Claude, OpenClaw, Cursor, and any MCP-compatible AI assistant.**

[![smithery](https://smithery.ai/badge/ai-video-mcp)](https://smithery.ai/server/ai-video-mcp)
[![Python](https://img.shields.io/badge/python-3.8+-blue.svg)](https://python.org)
[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)

---

## ✨ Features

- πŸ“ **Script-driven** β€” Just provide text, auto-split into chapters
- πŸŽ₯ **Smart footage** β€” Auto-matches stock videos from Pexels per chapter
- πŸ—£οΈ **TTS narration** β€” Minimax voice synthesis, 6 voice options
- πŸ“Ί **Auto subtitles** β€” Generates SRT subtitles from narration
- 🎬 **One-click compose** β€” ffmpeg auto-merges into final video
- πŸ”Œ **MCP standard** β€” Compatible with all MCP-enabled AI assistants

---

## πŸš€ Quick Start

### 1. Install

```bash
pip install ai-video-mcp
```

Or from source:

```bash
git clone https://github.com/yqyqstart-crypto/ai-video-mcp.git
cd ai-video-mcp
pip install -e .
```

### 2. Set API Keys

```bash
export MINIMAX_API_KEY="your-minimax-key"
export PEXELS_API_KEY="your-pexels-key"
```

| Key | Get it from | Purpose |
|-----|------------|---------|
| MINIMAX_API_KEY | [platform.minimaxi.com](https://platform.minimaxi.com) | TTS voice synthesis |
| PEXELS_API_KEY | [pexels.com/api](https://www.pexels.com/api/) | Stock video search |

### 3. Use

#### Command Line

```bash
ai-video-mcp
```

#### MCP Config (Claude Desktop / OpenClaw / Cursor)

```json
{
  "mcpServers": {
    "ai-video": {
      "command": "ai-video-mcp",
      "env": {
        "MINIMAX_API_KEY": "your-key",
        "PEXELS_API_KEY": "your-key"
      }
    }
  }
}
```

Once configured, just tell the AI:

> "Generate a video from this script: /path/to/script.txt"

The AI will call the `generate_video` tool automatically.

---

## πŸ“– Tools

### `generate_video`

Generate a complete video from a text script.

**Parameters:**

| Param | Type | Default | Description |
|-------|------|---------|-------------|
| `script_path` | string | **required** | Path to script file |
| `output_dir` | string | `out` | Output directory |
| `voice` | string | `male-qn-qingse` | TTS voice ID |
| `speed` | float | `1.05` | Speech speed (0.5-2.0) |
| `resolution` | string | `1920x1080` | Output resolution |
| `video_duration` | int | `10` | Pexels clip duration per chapter (sec) |

**Returns:**

```json
{
  "success": true,
  "final_video": "out/final_video.mp4",
  "chapters": 3,
  "details": [
    {
      "chapter": 0,
      "title": "Chapter 1",
      "query": "search keywords",
      "video": "out/chapter_00/chapter.mp4",
      "tts": true
    }
  ]
}
```

### `list_voices`

List available TTS voice IDs.

### `list_styles`

List available video styles (planned).

---

## πŸ“ Script Format

### Plain text (.txt) β€” Split with `---`

```text
Artificial intelligence is changing our lives. From smartphones to self-driving cars, AI is everywhere.

---

In healthcare, AI helps doctors diagnose diseases more accurately.

---

In the future, AI will continue to drive social progress.
```

### Markdown (.md) β€” Split with `## `

```markdown
## The Rise of AI
Artificial intelligence is changing our lives...

## Healthcare Revolution
In healthcare, AI helps doctors...

## Future Outlook
In the future, AI will continue...
```

---

## πŸŽ™οΈ Available Voices

| ID | Name | Gender |
|----|------|--------|
| `male-qn-qingse` | Youth | Male |
| `female-shaonv` | Girl | Female |
| `male-qn-jingying` | Elite Male | Male |
| `female-yujie` | Elegant Lady | Female |
| `presenter male` | Male Host | Male |
| `presenter female` | Female Host | Female |

---

## πŸ“‚ Output Structure

```
out/
β”œβ”€β”€ final_video.mp4              # ← Final complete video
β”œβ”€β”€ concat.txt                   # ffmpeg merge list
β”œβ”€β”€ chapter_00/
β”‚   β”œβ”€β”€ source.mp4               # Pexels raw footage
β”‚   β”œβ”€β”€ audio.mp3                # TTS narration audio
β”‚   β”œβ”€β”€ audio.srt                # Subtitle file
β”‚   └── chapter.mp4              # Composed chapter video
β”œβ”€β”€ chapter_01/
β”‚   └── ...
└── chapter_02/
    └── ...
```

---

## πŸ—οΈ Workflow

```
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚ Text Script β”‚
                    β”‚ .txt / .md  β”‚
                    β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
                           β”‚
                    β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”
                    β”‚Parse Chaptersβ”‚
                    β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
                           β”‚
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β”‚            β”‚            β”‚
       β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β–Όβ”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”
       β”‚ Pexels Searchβ”‚ β”‚  TTS  β”‚ β”‚ Subtitles β”‚
       β”‚ Stock Videos β”‚ β”‚ Voice β”‚ β”‚   SRT     β”‚
       β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”¬β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜
              β”‚           β”‚            β”‚
              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                           β”‚
                    β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”
                    β”‚ffmpeg Composeβ”‚
                    β”‚Video+Audio+Subβ”‚
                    β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
                           β”‚
                    β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”
                    β”‚ final.mp4   β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```

---

## πŸ”§ Requirements

- Python 3.8+
- ffmpeg (system install)
- requests
- fastmcp

---

## πŸ’‘ Why MCP?

MCP (Model Context Protocol) lets AI assistants call external tools directly. With this MCP Server installed:

- βœ… Claude Desktop can generate videos
- βœ… OpenClaw can generate videos
- βœ… Cursor can generate videos
- βœ… Any MCP-enabled AI assistant works

**No coding needed. No command line. Just tell the AI.**

---

## πŸ“„ License

MIT

---

## 🀝 Contributing

PRs welcome! Especially:

- More TTS engines (Edge TTS, Azure TTS)
- More video sources (Pixabay, Coverr)
- AI image generation (DALL-E, Stable Diffusion)
- Custom subtitle styles
- Background music mixing

---

## ⭐ Star this repo

If you find this useful, give it a ⭐ to help others discover it!

Maintenance

ActivitySlowing
ResponsivenessNo issues