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

# 通義萬相（Wan）MCP 對接指南

> wan MCP server integration

通義萬相 MCP 支援透過文字或參考圖片生成影片。Wan 3 也可透過統一工具組合影格和參考素材。不同模型的輸入、長度和解析度可在用戶端內查詢。

## 連接代管服務

在支援遠端 MCP 的用戶端中新增 **Streamable HTTP** 伺服器，位址為 `https://wan.mcp.acedata.cloud/mcp`。使用 OAuth 時，選擇登入 Ace Data Cloud，並在瀏覽器中確認授權。

| 用戶端 | 如何連接 |
| - | - |
| Claude / Claude Desktop | 在「Customize → Connectors」中新增自訂連接器，填入代管位址後登入。 |
| Claude Code | 執行 `claude mcp add --transport http --scope user wan https://wan.mcp.acedata.cloud/mcp`，在工作階段中開啟 `/mcp`，選擇伺服器並完成授權。 |
| Cursor | 在 MCP 設定中新增 HTTP 伺服器，填入代管位址，連接時依提示登入。 |
| VS Code | 從命令面板執行 **MCP: Add Server**，選擇 HTTP 並輸入代管位址，之後可使用 **MCP: List Servers** 確認狀態。 |

在 Codex CLI 中可以執行以下命令，完成後在工作階段內輸入 `/mcp` 查看伺服器。

```bash theme={null}
codex mcp add wan --url https://wan.mcp.acedata.cloud/mcp
codex mcp login wan
```

如需使用固定憑證，請在用戶端的私密設定中新增請求標頭 `Authorization: Bearer &lt;应用 API Key>`，並確認該應用程式有權呼叫所選 API。可在主控台「應用程式 → 通用應用程式 → 金鑰管理」中建立或複製金鑰。 [應用程式主控台](https://platform.acedata.cloud/console/applications)

### 在 Gemini CLI 和 OpenCode 中使用應用程式金鑰

先將應用程式 API 金鑰儲存為用戶端環境變數 `ACEDATACLOUD_API_TOKEN`。以下命令使用 macOS 或 Linux 的 shell 引號。

| 用戶端 | 如何連接 |
| - | - |
| Gemini CLI | 執行 `gemini mcp add --scope user --transport http wan https://wan.mcp.acedata.cloud/mcp --header 'Authorization: Bearer ${ACEDATACLOUD_API_TOKEN}'`，使用 `gemini mcp list` 檢查。 |
| OpenCode 2.x | 執行 `opencode mcp add wan --global --url https://wan.mcp.acedata.cloud/mcp --header 'Authorization=Bearer {env:ACEDATACLOUD_API_TOKEN}'`，再執行 `opencode reload` 和 `opencode mcp list`。 |

OpenCode 1.x 可在個人 `opencode.json` 的 `mcp` 物件中為此服務設定 `type: "remote"`、託管 URL、`oauth: false`，並在請求標頭 `Authorization` 中填入 `Bearer {env:ACEDATACLOUD_API_TOKEN}`。 [OpenCode 1.x 設定](https://opencode.ai/v1/docs/mcp-servers/)

## 本機 stdio 接入

安裝 [uv](https://docs.astral.sh/uv/getting-started/installation/) 後，本機用戶端可以透過標準輸入輸出啟動 MCP 程序，Wan 請求由該程序傳送至 Ace Data Cloud。

Claude Desktop 使用者可以從開發者設定開啟本機 MCP 設定，合併下方的伺服器項目，在個人設定中將預留位置替換為應用程式 API Key 原文，再重新啟動用戶端。支援私密環境變數的用戶端也可以從憑證管理員注入 `ACEDATACLOUD_API_TOKEN`。

```json theme={null}
{
  "mcpServers": {
    "wan": {
      "command": "uvx",
      "args": [
        "mcp-wan"
      ],
      "env": {
        "ACEDATACLOUD_API_TOKEN": "YOUR_API_KEY"
      }
    }
  }
}
```

[mcp-wan 安裝套件](https://pypi.org/project/mcp-wan/)

## 首次驗證

連線後對助理說「請只呼叫 `wan_list_models`、`wan_list_actions` 和 `wan_list_resolutions`，列出圖片生成影片可用的模型與解析度」。

## 工具與使用範例

| 操作 | 工具和參數 |
| - | - |
| 文字生成影片 | `wan_generate_video` 使用 `prompt` 描述鏡頭和動作。 |
| 參考圖片生成影片 | `wan_generate_video_from_image` 接受 `image_url`。依所選模型的支援範圍填入時長、解析度或音訊參數。 |
| Wan 3 多模態生成 | `wan_generate_video_all_in_one` 接受文字以及結構化的 `media`，可提供影格或參考素材。 |
| 查詢結果 | `wan_get_task` 使用單一 `task_id`，`wan_get_tasks_batch` 接受一批任務 ID。 |

例如「讓這張海岸照片中的浪向岸邊移動，鏡頭保持穩定」。使用 `wan_generate_video_from_image`，將照片網址放入 `image_url`，把運動要求寫入 `prompt`。如果回傳任務 ID，請將其儲存，並使用 `wan_get_task` 依原任務查詢最終影片。

參數和結果格式請參閱 API 文件。 [影片生成](https://platform.acedata.cloud/documents/wan-videos)、[任務查詢](https://platform.acedata.cloud/documents/wan-tasks)。


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