mcp视频生成工具
提供了与RunwayML和Luma AI API交互的工具,用于视频和图像生成,包括文本到视频、图像到视频、提示增强和生成管理。
服务介绍
RunwayML + Luma AI MCP 服务器
此MCP服务器提供了与RunwayML和Luma AI API交互的工具,用于视频和图像生成任务。
功能
- 从文本提示生成视频(使用RunwayML或Luma AI)。
- 从图片生成视频(使用RunwayML或Luma AI)。
- 从文本提示生成图片(使用Luma AI)。
- 管理Luma AI生成内容(列出、获取、删除)。
- 向Luma AI生成的内容添加音频。
- 提升Luma AI生成内容的质量。
- 在生成前使用OpenRouter LLMs增强提示。
前提条件
- Node.js(推荐v18 LTS或更高版本)
- npm(通常随Node.js一起安装)
- API密钥:
- RunwayML API密钥
- Luma AI API密钥
- OpenRouter API密钥(用于
enhance_prompt工具)
安装
- 克隆或下载: 获取服务器代码。
- 导航到目录: 打开终端并进入服务器根目录(
runwayml-mcp-server)。 - 安装依赖项:
npm install
配置
- 创建
.env文件: 在服务器根目录中,创建一个名为.env的文件。 - 添加API密钥: 将您的API密钥添加到
.env文件中:
请用您实际的密钥替换占位符值。RUNWAYML_API_SECRET=your_runwayml_api_secret_here LUMAAI_API_KEY=your_luma_api_key_here OPENROUTER_API_KEY=your_openrouter_api_key_here
运行服务器
- 构建服务器: 编译TypeScript代码:
npm run build - 启动服务器:
您应该会在终端的错误输出(stderr)中看到类似npm startRunwayML MCP server running on stdio的消息。
MCP客户端设置(例如,Claude桌面应用,Cline)
配置您的MCP客户端以连接到此服务器。具体步骤取决于客户端,但通常需要提供以下信息:
- 名称: 描述性名称(如
runway-luma-server) - 命令:
node - 参数: 编译后的服务器索引文件的完整路径(例如,
/path/to/your/runwayml-mcp-server/build/server-index.js) - 环境变量:
RUNWAYML_API_SECRET:您的RunwayML API密钥LUMAAI_API_KEY:您的Luma AI API密钥OPENROUTER_API_KEY:您的OpenRouter API密钥
示例配置(概念性的):
{
"mcpServers": {
"runway-luma-server": {
"command": "node",
"args": ["/full/path/to/runwayml-mcp-server/build/server-index.js"],
"env": {
"RUNWAYML_API_SECRET": "your_runwayml_api_secret_here",
"LUMAAI_API_KEY": "your_luma_api_key_here",
"OPENROUTER_API_KEY": "your_openrouter_api_key_here"
},
"disabled": false,
"autoApprove": []
}
}
}
(记得将/full/path/to/替换为您系统中的实际路径)
可用工具
generate_text_to_video: Generates video from text.provider: (Optional)runwayml(default) orlumaai.promptText: (Required) The text prompt.runway_model: (Optional) Runway model (e.g., "gen-2").runway_resolution: (Optional) Runway resolution (1280:768or768:1280).runway_watermark: (Optional) Boolean, defaultfalse.luma_model: (Optional) Luma model (ray-flash-2,ray-2(default),ray-1-6).luma_aspect_ratio: (Optional) Luma aspect ratio (e.g.,16:9(default),1:1).luma_loop: (Optional) Boolean.duration: (Optional) Video duration in seconds (number).seed: (Optional) Generation seed (number).
generate_image_to_video: Generates video from an image.provider: (Optional)runwayml(default) orlumaai.promptImage: (Required) URL of the input image, or for Runway, an array[{uri: "url", position: "first" | "last"}].promptText: (Optional) Text prompt to accompany the image.runway_model: (Optional) Runway model (gen3a_turbo(default)).runway_duration: (Optional) Runway duration (5(default) or10).runway_ratio: (Optional) Runway resolution (1280:768or768:1280).runway_watermark: (Optional) Boolean, defaultfalse.luma_model: (Optional) Luma model (ray-flash-2,ray-2(default),ray-1-6).luma_aspect_ratio: (Optional) Luma aspect ratio (e.g.,16:9(default)).luma_loop: (Optional) Boolean.seed: (Optional) Generation seed (number).
enhance_prompt: Refines a prompt using OpenRouter.original_prompt: (Required) The prompt to enhance.model: (Optional) OpenRouter model name (defaults to a capable model likeanthropic/claude-3.5-sonnet).instructions: (Optional) Specific instructions for the enhancement.
luma_generate_image: Generates an image using Luma AI.prompt: (Required) Text prompt.aspect_ratio: (Optional) Luma aspect ratio (16:9(default)).model: (Optional) Luma image model (photon-1(default),photon-flash-1).image_ref: (Optional) Array of image reference objects ({url: string, weight?: number}). Max 4.style_ref: (Optional) Array of style reference objects ({url: string, weight?: number}). Max 1.character_ref: (Optional) Character reference object ({ identity0: { images: [url1, ...] } }).modify_image_ref: (Optional) Modify image reference object ({url: string, weight?: number}).
luma_list_generations: Lists previous Luma AI generations.limit: (Optional) Number of results (default 10).offset: (Optional) Offset for pagination (default 0).
luma_get_generation: Gets details for a specific Luma AI generation.generation_id: (Required) UUID of the generation.
luma_delete_generation: Deletes a specific Luma AI generation.generation_id: (Required) UUID of the generation.
luma_get_camera_motions: Lists supported camera motions for Luma AI prompts. (No parameters).luma_add_audio: Adds audio to a Luma generation.generation_id: (Required) UUID of the generation.prompt: (Required) Prompt for the audio.negative_prompt: (Optional) Negative prompt for audio.
luma_upscale: Upscales a Luma generation.generation_id: (Required) UUID of the generation.resolution: (Optional) Target resolution (1080p(default) or4k).
(注意:对于涉及生成的工具(如 generate_*、luma_upscale),服务器会立即启动任务并返回。进度更新和最终结果的 URL 将通过 MCP 进度通知发送。)
示例工作流程
以下是如何结合服务器的工具来实现常见用例的一些示例:
1. 音乐视频片段(赛博朋克黑色电影风格)
目标: 为歌词“霓虹河流穿过铬色城市”创建一个5秒的赛博朋克黑色电影风格的视频片段。
步骤:
-
生成基础图像(Luma):
{ "tool_name": "luma_generate_image", "arguments": { "prompt": "俯瞰视角,夜晚黑暗多雨的赛博朋克城市街道。明亮的霓虹灯在湿漉漉的路面上反射,像河流一样在高耸的铬色摩天大楼之间流淌。黑色电影美学,逼真。", "aspect_ratio": "16:9" } }(等待图像生成完成并获取图像 URL)
-
动画化图像(Luma):
{ "tool_name": "generate_image_to_video", "arguments": { "provider": "lumaai", "promptImage": "{IMAGE_URL_FROM_STEP_1}", "promptText": "缓缓向左平移,穿越多雨的赛博朋克城市景观,霓虹灯光微弱闪烁。", "luma_aspect_ratio": "16:9", "duration": 5 } }(等待视频生成完成)
2. 产品广告概念(悬浮耳机)
目标: 创建一个5秒的视频,展示一个未来主义耳机在极简环境中漂浮。
步骤:
-
生成包含产品参考的场景(Luma):
{ "tool_name": "luma_generate_image", "arguments": { "prompt": "一只时尚的未来主义无线耳机在明亮、极简的白色房间中央无重力地漂浮。柔和的漫射环境光。零重力效果。", "aspect_ratio": "1:1", "image_ref": [{ "url": "{PRODUCT_IMAGE_URL}", "weight": 0.8 }] } }(等待图像生成完成并获取图像 URL)
-
动画化场景(Luma):
{ "tool_name": "generate_image_to_video", "arguments": { "provider": "lumaai", "promptImage": "{IMAGE_URL_FROM_STEP_1}", "promptText": "耳机缓慢旋转并在零重力中轻轻漂浮。", "luma_aspect_ratio": "1:1", "duration": 5 } }(等待视频生成完成)
3. 图像动画(RunwayML Gen3a)
目标: 使用 RunwayML 的 Gen3a 模型为现有图像制作动画。
步骤:
- (可选) 生成基础图像(Luma): 如果你没有图像,可以使用
luma_generate_image。 - 动画化图像(RunwayML):
(等待视频生成完成){ "tool_name": "generate_image_to_video", "arguments": { "provider": "runwayml", "promptImage": "{YOUR_IMAGE_URL}", "promptText": "轻微放大,电影级照明。", "runway_model": "gen3a_turbo", "runway_duration": "5", "runway_ratio": "1280:768" // 或 "768:1280" } }