使用说明
Hedra MCP服务器
模型上下文协议(MCP)服务器 多面体 AI视频、音频和图像生成平台。该服务器使Claude等AI助手能够使用Hedra强大的AI模型(包括Character-3、Veo 3.1、Sora 2、Kling和MiniMax)生成视频、图像和音频。
特征
- 视频生成:根据文本提示和图像创建AI生成的视频
- 文本转语音:使用可定制的语音从文本生成自然语音
- 图像生成:根据文本描述创建图像
- 资产管理:上传和管理图像、音频和视频资产
- 生成跟踪:监控发电作业的状态和进度
- 信用管理:检查您的信用余额和使用情况
先决条件
- Node.js 18.0.0或更高版本
- 拥有API访问权限的Hedra帐户(创建者计划或更高版本)
- Hedra API密钥来自 https://hedra.com/api-profile
安装
使用npx(推荐)
npx mcp-server-hedra
全球安装
npm install -g mcp-server-hedra
来源
git clone https://github.com/your-username/mcp-server-hedra.git
cd mcp-server-hedra
npm install
npm run build
配置
环境变量
| 变量 | 必填 | 默认 | 描述 |
|---|---|---|---|
HEDRA_API_KEY |
是 | - | 您的Hedra API密钥 |
HEDRA_BASE_URL |
没有 | https://api.hedra.com/web-app/public |
API基本URL |
HEDRA_TIMEOUT |
没有 | 60000 |
请求超时(毫秒) |
认证
Hedra API使用在 X-API-Key 头球
X-API-Key: <your-api-key>
从获取API密钥 https://hedra.com/api-profile (需要Creator计划或以上)。
Claude桌面配置
添加到您的Claude Desktop配置文件中:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
视窗: %APPDATA%\Claude\claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json
{
"mcpServers": {
"hedra": {
"command": "npx",
"args": ["mcp-server-hedra"],
"env": {
"HEDRA_API_KEY": "your-api-key-here"
}
}
}
}
临床(VS代码)配置
{
"mcpServers": {
"hedra": {
"command": "npx",
"args": ["mcp-server-hedra"],
"env": {
"HEDRA_API_KEY": "your-api-key-here"
}
}
}
}
可用工具
list_models
列出用于视频、音频和图像生成的可用AI模型。
{
"types": ["video"] // Optional: filter by model type
}
list_assets
列出用户资源,包括图像、音频、视频和语音文件。
{
"type": "image" // Required: text, image, audio, video, voice
}
create_asset
为上传文件创建新的资源占位符。
{
"name": "my-image.png",
"type": "image"
}
upload_asset
将文件上载到现有资源。
{
"id": "asset-uuid",
"file_base64": "base64-encoded-content",
"filename": "image.png"
}
generate_video
从文本提示、图像和可选音频生成视频。
{
"ai_model_id": "model-uuid",
"text_prompt": "A person talking to the camera",
"start_keyframe_id": "image-asset-uuid",
"audio_id": "audio-asset-uuid",
"resolution": "720p",
"aspect_ratio": "16:9",
"duration_ms": 5000
}
generate_video_with_tts
在一次通话中生成带有文本到语音音频的视频。
{
"ai_model_id": "model-uuid",
"text_prompt": "A person talking",
"start_keyframe_id": "image-asset-uuid",
"voice_id": "voice-uuid",
"speech_text": "Hello, welcome to my video!",
"resolution": "720p",
"aspect_ratio": "9:16"
}
generate_text_to_speech
使用文本转语音从文本生成音频。
{
"voice_id": "voice-uuid",
"text": "Hello, this is a test.",
"stability": 0.8,
"speed": 1.0
}
generate_image
从文本提示生成图像。
{
"text_prompt": "A beautiful sunset over mountains",
"aspect_ratio": "16:9",
"seed": 12345
}
get_generation_status
获取生成作业的状态。
{
"generation_id": "generation-uuid"
}
get_credits
获取当前信用余额和使用情况信息。
{}
list_generations
列出具有筛选和分页功能的生成作业。
{
"type": "video",
"limit": 50,
"offset": 0
}
使用示例
生成一个会说话的头像视频
- 首先,列出可用型号:
Use list_models to see available video models
- 上传肖像图片:
Create an image asset and upload a portrait photo
- 生成视频:
Generate a video using Character-3 model with the uploaded image and text "A person smiling and waving"
- 检查状态:
Check the generation status to get the download URL
生成图像
Generate an image with the prompt "A cyberpunk city at night with neon lights"
支持的型号
Hedra支持多种AI模型,包括:
- 特征-3:Hedra的唇形同步视频生成模型
- 我看到3.1:谷歌的视频生成模型
- 索拉2 Pro:OpenAI的视频生成模型
- Kling 2.6 Pro:强动态视频生成
- MiniMax海洛:快速视频生成
使用 list_models 查看所有当前可用的型号及其功能。
信贷成本
视频生成成本因型号而异:
- Veo 3.1快速:20学分
- Veo 3.1:55学分
- 索拉2 Pro:70学分
- 克林2.6专业版:20学分
- 克林2.5涡轮增压:10学分
- MiniMax Hailoo 2.3快速专业版:7学分
使用 get_credits 查看您当前的余额。
错误处理
服务器为常见问题提供明确的错误消息:
- 401/403:身份验证失败-请检查您的API密钥
- 404:找不到资源-验证资产/生成ID
- 422:无效参数-检查请求格式
- 429:超出速率限制-请等待重试
发展
# Install dependencies
npm install
# Build
npm run build
# Watch mode
npm run dev
# Test with MCP Inspector
npx @modelcontextprotocol/inspector node dist/index.js
故障排除
“HEDRA_API_KEY环境变量是必需的”
请确保在配置或环境中设置了API密钥。
“身份验证失败”
在验证您的API密钥是否有效 https://hedra.com/api-profile.
一代人陷入“处理”
视频生成可能需要几分钟。使用 get_generation_status 以监控进展。
资源
许可证
MIT许可证-请参阅 许可证 文件以获取详细信息。