返回市场
卢玛-MCP服务器

卢玛-MCP服务器

作者:Sunwood-ai-labs3 星标更新:2024-12-25

项目介绍

<div align="center"> <img src="assets/header2.svg" alt="Luma MCP Server" width="100%" />

Luma MCP Server

提供Luma AI视频生成API的Model Context Protocol (MCP)服务器

</div>

🌟 概要

Luma MCP Server提供了Luma AI的视频生成功能作为MCP服务器。它支持从文本或图像生成视频,以及扩展和插值现有视频的功能。

🏗️ 项目结构

src/
├── types/          - 类型定义
│   ├── schemas.ts  - 输入模式
│   └── types.ts    - 公共类型定义
├── services/       - 业务逻辑
├── handlers/       - 请求处理器
│   └── tool-handlers.ts
├── clients/        - 外部API客户端
│   └── luma-client.ts
├── utils/          - 工具
│   └── error-handler.ts
├── config/         - 配置
│   └── server-config.ts
└── index.ts        - 入口点

📦 安装

npm install @sunwood-ai-labs/luma-mcp-server

⚙️ 环境配置

  1. 获取Luma API密钥

  2. 设置环境变量

    export LUMA_API_KEY=your_api_key_here
    

🛠️ 可用工具

generate_video

根据文本提示生成视频。

{
  name: 'generate_video',
  arguments: {
    prompt: "一个戴着墨镜的泰迪熊在弹电吉他并跳舞",
    loop: true,  // 可选
    callback_url: "https://your-callback-url.com"  // 可选
  }
}

generate_video_from_image

以图片作为起始帧生成视频。

{
  name: 'generate_video_from_image',
  arguments: {
    prompt: "低角度拍摄一只威猛的老虎在雪地里漫步",
    image_url: "https://your-image-url.com/start-frame.jpg",
    loop: true,  // 可选
    callback_url: "https://your-callback-url.com"  // 可选
  }
}

extend_video

扩展现有的视频。

{
  name:  'extend_video',
  arguments: {
    prompt: "继续舞蹈序列",
    source_generation_id: "existing-video-generation-id",
    loop: true,  // 可选
    callback_url: "https://your-callback-url.com"  // 可选
  }
}

interpolate_videos

在两个视频之间进行平滑过渡。

{
  name: 'interpolate_videos',
  arguments: {
    prompt: "创建视频之间的平滑过渡",
    start_generation_id: "first-video-generation-id",
    end_generation_id: "second-video-generation-id",
    callback_url: "https://your-callback-url.com"  // 可选
  }
}

🔧 开发者信息

架构

  • 类型定义 (types/):

    • schemas.ts: 使用Zod进行输入验证模式
    • types.ts: 公共类型定义和接口
  • 处理器 (handlers/):

    • tool-handlers.ts: 处理MCP工具请求
  • 客户端 (clients/):

    • luma-client.ts: 负责与Luma AI API通信
  • 工具 (utils/):

    • error-handler.ts: 统一错误处理
  • 配置 (config/):

    • server-config.ts: 统一管理服务器配置

错误处理

  • 统一的错误处理系统
  • 正确映射到MCP错误代码
  • 提供详细的错误消息和日志记录

📝 注意事项

  • 请使用英文描述提示
  • 视频生成可能需要时间
  • 注意API的使用限制

🤝 贡献指南

  1. 分叉此仓库
  2. 创建新分支 (git checkout -b feature/amazing-feature)
  3. 提交更改 (git commit -m '✨ feat: 添加精彩功能')
  4. 推送分支 (git push origin feature/amazing-feature)
  5. 创建拉取请求

📄 许可证

MIT License - 详情请参阅 LICENSE 文件。