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

# Luma MCP 對接指南

> luma MCP 服务器集成

[MCP（Model Context Protocol）](https://modelcontextprotocol.io) 是由 Anthropic 推出的模型上下文協議，允許 AI 模型（如 Claude、GPT 等）通過標準化接口調用外部工具。通過 XHuoAPI 提供的 Luma MCP Server，你可以在 Claude Desktop、VS Code、Cursor 等 AI 客戶端中直接生成 AI 視頻。

## 功能概覽

Luma MCP Server 提供以下核心功能：

* **文本生成視頻** — 通過文本提示詞生成高質量視頻
* **圖片生成視頻** — 以圖片為起點或終點生成視頻
* **視頻續寫** — 從已有視頻的最後一幀繼續生成
* **多種畫面比例** — 支持 16:9、9:16、1:1 等多種比例
* **畫面增強** — 可選的視覺質量增強功能
* **任務查詢** — 監控生成進度並獲取結果

## 前置準備

使用前，你需要獲取 XHuoAPI API Token：

1. 註冊或登錄 [XHuoAPI 平台](https://api.xhuoapi.ai)
2. 前往 [Luma Videos API](https://api.xhuoapi.ai/documents/luma-videos) 頁面
3. 點擊「Acquire」獲取 API Token（首次申請贈送免費額度）

## 安裝配置

### 方式一：pip 安裝（推薦）

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

### 方式二：源碼安裝

```bash theme={null}
git clone https://github.com/XHuoAPI/LumaMCP.git
cd LumaMCP
pip install -e .
```

安裝完成後，即可使用 `mcp-luma` 命令啟動服務。

## 在 Claude Desktop 中使用

編輯 Claude Desktop 配置文件：

* **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
* **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`

添加以下配置：

```json theme={null}
{
  "mcpServers": {
    "luma": {
      "command": "mcp-luma",
      "env": {
        "XHuoAPI_API_TOKEN": "你的API Token"
      }
    }
  }
}
```

如果使用 `uvx`（無需提前安裝包）：

```json theme={null}
{
  "mcpServers": {
    "luma": {
      "command": "uvx",
      "args": ["mcp-luma"],
      "env": {
        "XHuoAPI_API_TOKEN": "你的API Token"
      }
    }
  }
}
```

保存配置後重啟 Claude Desktop，即可在對話中使用 Luma 相關工具。

## 在 VS Code / Cursor 中使用

在項目根目錄創建 `.vscode/mcp.json`：

```json theme={null}
{
  "servers": {
    "luma": {
      "command": "mcp-luma",
      "env": {
        "XHuoAPI_API_TOKEN": "你的API Token"
      }
    }
  }
}
```

或者使用 `uvx`：

```json theme={null}
{
  "servers": {
    "luma": {
      "command": "uvx",
      "args": ["mcp-luma"],
      "env": {
        "XHuoAPI_API_TOKEN": "你的API Token"
      }
    }
  }
}
```

## 可用工具列表

| 工具名                              | 說明             |
| -------------------------------- | -------------- |
| `luma_generate_video`            | 通過文本提示詞生成視頻    |
| `luma_generate_video_from_image` | 從圖片生成視頻        |
| `luma_extend_video`              | 續寫已有視頻         |
| `luma_extend_video_from_url`     | 從 URL 指定視頻進行續寫 |
| `luma_get_task`                  | 查詢單個任務狀態       |
| `luma_get_tasks_batch`           | 批量查詢任務狀態       |

## 使用示例

配置完成後，你可以在 AI 客戶端中直接用自然語言調用這些功能，例如：

* 「幫我生成一段日落海邊的視頻」
* 「用這張照片作為第一幀，生成一段 5 秒的視頻」
* 「續寫這個視頻，再延長一段」
* 「生成一段豎屏的視頻，比例 9:16」

## 更多信息

* GitHub 倉庫：[XHuoAPI/LumaMCP](https://github.com/XHuoAPI/LumaMCP)
* PyPI 包：[mcp-luma](https://pypi.org/project/mcp-luma/)
* API 文檔：[Luma 視頻生成 API](https://api.xhuoapi.ai/documents/luma)
