> ## Documentation Index
> Fetch the complete documentation index at: https://docs.autoclip.tv/llms.txt
> Use this file to discover all available pages before exploring further.

# CLI 与 MCP Server

> 通过命令行或标准 MCP Server，在终端、脚本以及 Claude Desktop、Cursor、Antigravity 等 AI Agent 中直接调用 AutoClip。

AutoClip 为开发者和自动化工作流提供 **CLI 命令行工具** 与 **标准 MCP Server**。它们与桌面端共用同一套核心剪辑流水线与本地数据目录——用 CLI 或 AI Agent 剪出来的成片，打开桌面应用首页即可直接看到并在 Studio 中继续精修。

![AutoClip CLI 与 MCP Server](https://mintcdn.com/auto-clip/mqMkpyKoj_HdWISu/images/feature-cli.png?fit=max\&auto=format\&n=mqMkpyKoj_HdWISu\&q=85\&s=5951fb58b373038f11f620b6904f9637)

AutoClip CLI 与 MCP Server：在终端和 AI 编程助手中一句话完成视频切片与多平台出片

## 安装方式

### 方式一：通过 PyPI 直接安装（推荐）

使用 `pip` 安装（获得 `autoclip` CLI 命令与 MCP Server）：

```bash theme={null}
pip install autoclip-mcp
```

或者使用 `uvx` 零环境污染直接运行 MCP Server：

```bash theme={null}
uvx autoclip-mcp
```

### 方式二：从本地 `.whl` 离线安装包安装

如果你从 GitHub Releases 或内部分发压缩包获取了离线 wheel 文件（例如 `autoclip_mcp-<version>-py3-none-any.whl`），可以直接用 `pip` 安装：

```bash theme={null}
pip install ./autoclip_mcp-<version>-py3-none-any.whl
```

> [!WARNING]
>
> **安装 `.whl` 时请务必保留原始文件名！**\
> Python 的 `pip` 会严格解析 `.whl` 文件名中的包名、版本号与平台标签（如 `autoclip_mcp-1.6.4-py3-none-any.whl`）。如果将文件重命名为 `autoclip.whl` 或去掉版本/平台后缀，`pip install` 会直接报错并拒绝安装。

安装完成后，运行体检命令确认 `ffmpeg`、本地 Whisper 与模型配置状态：

```bash theme={null}
autoclip --version
autoclip doctor
```

## 常用 CLI 命令

CLI 会默认读取桌面端已保存的 AI 模型配置（也可通过环境变量 `AUTOCLIP_API_KEY` 注入密钥）：

```bash theme={null}
# 一键出片：生成抖音和 YouTube Shorts 成片并输出 JSON 结果
autoclip produce talk.mp4 --srt talk.srt --platform douyin --platform youtube_shorts --json

# 指定竖版版式（auto / interview / podcast）与包装模板（classic / editorial / street / news / cinema）
autoclip produce talk.mp4 --platform douyin --portrait-style podcast --template editorial --json

# 导出指定项目的发布素材包（ZIP，含视频、封面与文案）
autoclip outputs PROJECT_ID --export-kits

# 使用独立数据目录运行（适合隔离测试或自动化脚本）
autoclip --data-dir /path/to/demo-data produce talk.mp4 --platform douyin
```

> [!NOTE]
>
> CLI 与 MCP 在不传 `--template` 时默认使用 `classic` 经典风格，以保证自动化脚本在版本升级前后产出稳定一致；桌面端导入页则默认选中 `editorial` 杂志风。如需杂志风或街头快剪，请显式传入 `--template editorial` 或 `--template street`。

## 接入 AI Agent（MCP Server 配置示例）

AutoClip MCP Server 提供 `start_quick_output`（启动异步出片任务）、`get_quick_output_status`（按 `poll_after_sec` 轮询进度与获取成片路径）、`list_styles`（列出可用风格）、`cancel_job`（安全终止任务）与 `get_version` 等标准工具。

> [tab] Claude Desktop
>
> 编辑 Claude Desktop 配置文件（macOS 位于 `~/Library/Application Support/Claude/claude_desktop_config.json`，Windows 位于 `%APPDATA%\Claude\claude_desktop_config.json`）：
>
> ```json theme={null}
> {
>   "mcpServers": {
>     "autoclip": {
>       "command": "uvx",
>       "args": ["autoclip-mcp"],
>       "env": {
>         "AUTOCLIP_API_KEY": "your_api_key_if_needed"
>       }
>     }
>   }
> }
> ```
>
> 保存后重启 Claude Desktop，即可直接对 Claude 说：「帮我把 `/path/to/interview.mp4` 切成抖音和 YouTube Shorts 两条竖屏短视频，用杂志风模板」。

> [tab] Cursor
>
> 在项目根目录的 `.cursor/mcp.json` 或全局 Cursor MCP 设置中添加：
>
> ```json theme={null}
> {
>   "mcpServers": {
>     "autoclip": {
>       "command": "uvx",
>       "args": ["autoclip-mcp"],
>       "env": {
>         "AUTOCLIP_DATA_DIR": "/path/to/autoclip-data"
>       }
>     }
>   }
> }
> ```
>
> 如果已经通过 `pip install autoclip-mcp` 全局安装，也可将 `command` 设为 `autoclip-mcp`（或对应虚拟环境中的完整路径）并留空 `args`。

> [tab] Antigravity
>
> 在 Antigravity 的 MCP 配置文件（如 `~/.gemini/antigravity/mcp_config.json` 或工作区 MCP 配置）中添加 `autoclip` 服务：
>
> ```json theme={null}
> {
>   "mcpServers": {
>     "autoclip": {
>       "command": "uvx",
>       "args": ["autoclip-mcp"],
>       "env": {
>         "AUTOCLIP_API_KEY": "your_api_key_if_needed"
>       }
>     }
>   }
> }
> ```
>
> 你也可以同步安装官方 Agent Skill，让 Agent 更准确地编排 AutoClip 流水线：
>
> ```bash theme={null}
> npx skills add zhouxiaoka/autoclip
> ```

> [!TIP]
>
> 出于安全考虑，MCP 工具不再接收明文 `api_key` 参数。请统一通过环境变量 `AUTOCLIP_API_KEY` 或桌面端设置页管理你的模型密钥。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.