Luma MCP 服务器
提供 Luma AI 视频生成 API 作为模型上下文协议 (MCP) 的服务器
🌟 概述
Luma MCP Server 作为 MCP 服务器提供 Luma AI 的视频生成功能。它具有从文本和图像生成视频以及增强和插入现有视频的能力。
🏗️ 项目结构
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
⚙️ 偏好设置
- 获取 Luma API 密钥
- 设置环境变量
export LUMA_API_KEY=your_api_key_here
🛠️ 可用工具
生成视频
根据文本提示生成视频。
{
name: 'generate_video',
arguments: {
prompt: "A teddy bear in sunglasses playing electric guitar and dancing",
loop: true, // オプション
callback_url: "https://your-callback-url.com" // オプション
}
}
从图像生成视频
使用图像作为起始帧生成视频。
{
name: 'generate_video_from_image',
arguments: {
prompt: "Low-angle shot of a majestic tiger prowling through a snowy landscape",
image_url: "https://your-image-url.com/start-frame.jpg",
loop: true, // オプション
callback_url: "https://your-callback-url.com" // オプション
}
}
扩展视频
扩展现有视频。
{
name: 'extend_video',
arguments: {
prompt: "Continue the dance sequence",
source_generation_id: "existing-video-generation-id",
loop: true, // オプション
callback_url: "https://your-callback-url.com" // オプション
}
}
插值视频
它可以平滑地在两个视频之间进行插入。
{
name: 'interpolate_videos',
arguments: {
prompt: "Create a smooth transition between the videos",
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/
) : - 配置(
config/
) :server-config.ts
:集中式服务器配置
错误处理
- 统一错误处理系统
- 正确映射到 MCP 错误代码
- 详细的错误消息和日志记录
📝 注释
- 请用英语写下你的提示
- 视频生成可能需要一些时间
- 请注意 API 使用限制
🤝 贡献
- Fork此存储库
- 创建新分支(
git checkout -b feature/amazing-feature
) - 提交更改(
git commit -m '✨ feat: Add amazing feature'
) - 推送分支(
git push origin feature/amazing-feature
) - 创建拉取请求
📄 许可证
MIT 许可证 - 有关详细信息,请参阅LICENSE文件。