Luma MCP服务器
Luma AI视频生成API打开Model Context Protocol (MCP)提供的服务器
🌟 概要
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⚙️ 环境设定
- Luma API获取密钥
- Luma AI开发者门户从…开始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" // オプション
}
}生成video_from_image
将图像作为开始帧生成视频。
{
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" // オプション
}
}extend_video
扩展现有视频。
{
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/):
- error-handler.ts:统一的错误处理
- 设定(
config/):
- server-config.ts:集中管理服务器设置
错误处理
- 统一的错误处理系统
- MCP正确映射到错误代码
- 详细的错误消息和记录
📝 注意事项
- 提示请用英语填写
- 视频生成可能需要很长时间
- API的使用限制
🤝 分发
- 分叉此存储库
- 创建新分支(
git checkout -b feature/amazing-feature) - 提交更改(
git commit -m '✨ feat: Add amazing feature') - 推送分支(
git push origin feature/amazing-feature) - 创建拉式请求
📄 许可证
MIT License - 了解更多信息 许可证 请参见文件。
