OpenCode Integration with Luma MCP

📘 Overview: OpenCode MCP Overview →

Luma Dream Machine has consistently been one of the most cost-effective video models in terms of “low cost / high image quality / natural transitions.” After connecting the Luma MCP Server in OpenCode, you can have it generate short videos based on text or reference images, and can also directly continue existing videos for extensions with a consistent style.

Luma MCP is suitable for product demo clips, Banner animations, social media short videos, and the two high-frequency scenarios of “using images to drive animations” and “video extension.”

Obtain an API Token

Before using the Luma MCP Server, you need to first prepare an Ace Data Cloud API Token. OpenCode and Claude Code share the same set of Tokens, and the acquisition process is the same:

  1. Open the Ace Data Cloud Console - Application List, obtain your API Token, and keep it for later use.
  2. If you have not yet logged in or registered, you will be automatically redirected to the login page; after logging in or registering, you will automatically return to the current page.
  3. Confirm that the key is allowed to access the required APIs, and check the balance and limits in the console.

Obtain Ace Data Cloud API Key

The API Key for general applications can be reused within its authorization scope. It is recommended to display only a masked form in documentation and screenshots, such as YOUR_ACEDATACLOUD_API_KEY; do not paste the full Token into public repositories, Issues, screenshots, or chat logs.

Want to use Claude Desktop / the Claude.ai web version for direct one-click OAuth authorization? See the Luma MCP Claude.ai / Desktop tutorial.

Configure OpenCode

First run opencode --version. For 2.x users, set ACEDATACLOUD_API_KEY in the terminal, then run the following commands.

opencode mcp add luma --global --url https://luma.mcp.acedata.cloud/mcp --header 'Authorization=Bearer {env:ACEDATACLOUD_API_KEY}'
opencode reload
opencode mcp list

OpenCode 1.x Configuration

OpenCode uses an opencode.json file to describe all MCP Servers. The file can be placed in two locations; choose one based on the “scope” below. The field structure is exactly the same for both locations; the only difference is priority.

It is highly recommended to first write the Token into an environment variable:

export ACEDATACLOUD_API_KEY="replace with your actual Token"

Then use the {env:ACEDATACLOUD_API_KEY} placeholder in opencode.json to reference it, avoiding writing the actual Token into the file.

Global: Shared by All Projects

File location: ~/.config/opencode/opencode.json, suitable for “my own machine, configure it once, and use it in all projects.”

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "luma": {
      "type": "remote",
      "url": "https://luma.mcp.acedata.cloud/mcp",
      "enabled": true,
      "oauth": false,
      "headers": { "Authorization": "Bearer {env:ACEDATACLOUD_API_KEY}" }
    }
  }
}

Bearer API Key is used here. "oauth": false makes OpenCode send request headers according to this configuration.

Project-Level: Effective Only for the Current Project

File location: opencode.json in the root directory of the current project. For services with the same name, the definition in the project takes priority. Suitable for team sharing, single-repository customization, or temporarily enabling an MCP only in a certain project.

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "luma": {
      "type": "remote",
      "url": "https://luma.mcp.acedata.cloud/mcp",
      "enabled": true,
      "oauth": false,
      "headers": { "Authorization": "Bearer {env:ACEDATACLOUD_API_KEY}" }
    }
  }
}

If the project-level opencode.json will be committed to Git, make sure to use the {env:ACEDATACLOUD_API_KEY} placeholder rather than the actual Token to avoid leaks.

Please start OpenCode from a terminal where this environment variable has been set and exported.

Verify the Connection

After configuration, run:

opencode mcp list

Seeing luma connected indicates that the handshake was successful. If it fails, check whether ACEDATACLOUD_API_KEY has been exported, the hosted address, and whether Authorization includes the Bearer prefix. Models and tool Schemas change continuously; please select a model from the current directory that supports native tool calling.

Typical Scenarios

After configuration is complete, you can directly invoke it in an OpenCode session using natural language, without first switching to /mcp:

Text-to-Video

Generate a 5-second video: waves gently lap against a golden beach, sunset, cinematic feel

Image-to-Video

Turn this product image into a video, slowly orbiting around it from left to right

Video Extension

Continue this video for another 10 seconds, maintaining the same style

Tool List

The table below lists commonly used tools. For the full names, see the real-time tool list of the hosted service.

Tool Description
luma_generate_video Generate video from text
luma_generate_video_from_image Generate video using a reference image
luma_extend_video Video extension