谷歌Vista 3.1 MCP服务器
用于Google Veo 3.1视频生成API的MCP服务器和CLI批处理工具。
特性
- MCP 服务器 用于与Claude Desktop和其他MCP客户端集成
- 批处理CLI工具 用于处理多个视频生成作业
- 文本转视频:根据文本提示生成视频
- 图像转视频:为静态图像设置动画
- 参考图像:最多使用3张图片以保持字符/风格的一致性
- 视频扩展:将现有视频延长7秒
- 帧插值:在两个关键帧之间生成视频
- 成本估算:执行前计算成本
安装
npm install
npm run build设置
- 从获取您的Google API密钥 谷歌AI工作室
- 创建
.env文件:
GOOGLE_API_KEY=your_api_key_here或者直接设置环境变量:
export GOOGLE_API_KEY=your_api_key_hereMCP服务器使用情况
Claude桌面配置
添加到您的Claude Desktop配置(%APPDATA%\Claude\claude_desktop_config.json 在Windows上):
{
"mcpServers": {
"veo3": {
"command": "node",
"args": ["C:/path/to/google-veo3-1-mcp-server/dist/index.js"],
"env": {
"GOOGLE_API_KEY": "your_api_key_here"
}
}
}
}或者在发布后使用npx:
{
"mcpServers": {
"veo3": {
"command": "npx",
"args": ["google-veo3-1-mcp-server"],
"env": {
"GOOGLE_API_KEY": "your_api_key_here"
}
}
}
}可用工具
生成视频
从文本提示或图像生成视频。
{
"prompt": "A golden retriever running through autumn leaves",
"model": "veo-3.1-generate-preview",
"resolution": "1080p",
"duration_seconds": 8,
"generate_audio": true,
"output_path": "./output/video.mp4"
}参数:
prompt:视频的文字描述(除非提供图像,否则需要)model:veo-3.1-generate-preview(默认)或veo-3.1-fast-generate-previewaspect_ratio:16:9(默认)或9:16resolution:720p(默认),1080p,或4k(4k仅适用于标准型号)duration_seconds:4,6,或8(默认值:8)generate_audio:是否生成音频(默认值:true)negative_prompt:应避免的元素image:图像转视频模式的图像reference_images:用于一致性的参考图像数组output_path:保存视频的路径
extend_video
将现有视频延长7秒。
{
"video": "./input/video.mp4",
"prompt": "Continue with the character walking forward",
"output_path": "./output/extended.mp4"
}要求:
- 输入视频:1-30秒,24fps,720p或1080p
- 输出:720p时7秒
插值帧
生成两个关键帧之间的视频过渡。
{
"first_frame": "./images/start.jpg",
"last_frame": "./images/end.jpg",
"prompt": "Smooth camera pan",
"duration_seconds": 8,
"generate_audio": true,
"output_path": "./output/interpolated.mp4"
}获取_视频_状态
检查视频生成操作的状态。
{
"operation_name": "models/veo-3.1-generate-preview/operations/abc123"
}批处理CLI使用情况
# Estimate costs only
veo3-batch config.json --estimate-only
# Execute batch
veo3-batch config.json --output-dir ./output
# With options
veo3-batch config.json --max-concurrent 3 --no-audio --format jsonCLI选项
| 选项 | 描述 |
|---|---|
| `-o, --output-dir | |
| ` | 视频输出目录 |
-f, --format | 输出格式(默认:文本) |
-c, --max-concurrent | 并行作业(1-5,默认值:2) |
-p, --poll-interval | 轮询间隔 |
-t, --timeout | 批处理总超时时间 |
-e, --estimate-only | 仅估算成本 |
--no-audio | 无音频生成(降低成本) |
--allow-any-path | 允许绝对输出路径 |
批配置格式
{
"jobs": [
{
"prompt": "A cat playing piano",
"duration_seconds": 8,
"resolution": "1080p",
"generate_audio": true
},
{
"type": "extend",
"video": "./videos/source.mp4",
"prompt": "Continue the scene"
},
{
"type": "interpolate",
"first_frame": "./images/start.jpg",
"last_frame": "./images/end.jpg"
}
],
"output_dir": "./output",
"max_concurrent": 2,
"default_model": "veo-3.1-generate-preview"
}定价
| 功能 | 分辨率 | 带音频 | 仅限视频 |
|---|---|---|---|
| 标准型号 | 720p/1080p | 0.40美元/秒 | 0.20美元/秒 |
| 标准型号 | 4K | $0.60/秒 | $0.40/秒 |
| 快速型号 | 720p/1080p | 0.20美元/秒 | 0.10美元/秒 |
注: Gemini API预览模型总是生成音频。这 generate_audio 当前不支持该参数。使用顶点AI进行音频控制。成本示例
| 视频类型 | 分辨率 | 持续时间 | 音频 | 成本 |
|---|---|---|---|---|
| 文本转视频 | 1080p | 8秒 | 是 | 3.20美元 |
| 文本转视频 | 1080p | 8秒 | 否 | 1.60美元 |
| 图像到视频(快速) | 720p | 4秒 | 是 | 0.80美元 |
| 视频扩展 | 720p | 7秒 | 否 | 1.40美元 |
| 帧插值 | 1080p | 8秒 | 是 | 3.20美元 |
模型
| 型号 | 描述 | 分辨率 | 速度 |
|---|---|---|---|
veo-3.1-generate-preview | 高品质 | 720p、1080p、4K | 标准 |
veo-3.1-fast-generate-preview | 更快的一代 | 720p、1080p | 快速 |
参考图像
使用参考图像保持一致性:
{
"prompt": "The character walks through a forest",
"reference_images": [
{
"image": "./character.jpg",
"reference_type": "asset"
}
]
}asset:角色/对象(最多3张图片)style:视觉风格(最多1张图片)
环境变量
| 变量 | 描述 | 默认值 |
|---|---|---|
GOOGLE_API_KEY | Google API密钥(必需) | - |
OUTPUT_DIR | 默认输出目录 | ./output |
DEBUG | 启用调试日志记录 | false |
VIDEO_POLL_INTERVAL | 轮询间隔(ms) | 15000 |
VIDEO_MAX_POLL_ATTEMPTS | 最大轮询尝试次数 | 120 |
API文档
有关API的详细规范,请参见:
许可证
麻省理工学院
