Skip to main content
Glama

aihub-mcp

MCP server for the AihubMax media generation API — https://docs.aihubmax.com.

把 AihubMax(api.aihubmax.com)的媒体生成能力(图像 / 视频 / 音频 / 文档 + 异步任务体系)封装成 Agent 友好的 MCP server。目标:Agent 拿到一个 sk- key 后,能在对话里顺畅地发现模型、生成媒体、拿回结果。

工具(13 个)

工具

作用

list_models

列出模型。主列表来自 GET /v1/models,里面的 id 可直接提交;另附 catalog_only 段(文档可见但当前 Key 未开通)。media_type="llm" 改列 llm-router 注册表

describe_model

查看某模型的端点、参数(类型/枚举/默认/中文说明)、示例、定价

generate_image / generate_audio / generate_document

提交生成任务,默认等待 45s:短任务直接返回结果 URL,超时返回 task_id;图像成功时内联回传图片

generate_video

提交视频任务,默认不等待、立即返回 task_id(视频是分钟级,阻塞等待会撞穿客户端工具超时),再用 wait_for_task 取结果

get_task

查询/轮询异步任务到终态

wait_for_task

阻塞等待长任务 + MCP 进度通知;超时返回 still-running 可续等

download_asset

把任务产物或 URL 流式下载到本地磁盘(视频等大文件落盘)

get_credits

查询当前 Key 的总额度 / 已用 / 剩余

upload_file

本地文件 / 远程 URL / base64 → 可引用的 URL(i2v 等场景刚需)。本地文件上限 20 MB,更大的请走 url 模式

analyze_media

多模态 LLM 分析图/视频/音频 → 文本(宿主模型看不了视频/听不了音频时补位)

ask_model

问另一个 LLM(二次意见 / 试用),非主对话通道

模型 id 用哪个

线上可调用 id 与文档 spec 里的 model 名是两套命名:文档写 veo-3.1,网关实际提供的是 veo-3.1[4k]、google/veo-3.1[fast] 这类变体 id,裸 family 名不一定能直接提交。

因此 list_models 的 models 段直接给线上真实 id,照抄即可提交;catalog_only 段列的是 文档中存在但当前 Key 未开通的模型,需要先开通。两套命名的完整对应关系见 docs/model-mapping.md(由 scripts/build-mapping.ts 生成)。

Related MCP server: ImaginePro MCP Server

快速使用(stdio)

在 MCP 客户端(Claude Code / Claude Desktop / Cursor 等)配置:

{
  "mcpServers": {
    "aihub": {
      "command": "npx",
      "args": ["-y", "github:cookaihq/aihub-mcp"],
      "env": { "AIHUB_API_KEY": "sk-你的key" }
    }
  }
}

当前走 GitHub 分发(npm 发布后再改为 "aihub-mcp")。仓库 github:cookaihq/aihub-mcp;首次拉取时 npx 会自动执行 prepare 编译。 本地开发也可把 command/args 指向 node /绝对路径/dist/index.js,或 AIHUB_API_KEY=sk-... npm run dev。

base URL 可用 AIHUB_BASE_URL 覆盖。Key 推荐用环境变量 AIHUB_API_KEY;也支持 --api-key sk-...,但命令行参数会出现在 ps aux 里,同机其他用户可见,仅建议本机调试时使用。

开发

npm install
npm run typecheck
npm test                       # 离线回归测试(不需要 Key,不产生费用)
npm run build                  # 输出 dist/

# 目录管道(需要 aihubmax 文档站源码)
MINTLIFY_DIR=/path/to/mintlify npm run build-catalog
AIHUB_API_KEY=sk-... npm run build-mapping    # 重建 catalog ↔ 线上 id 映射表

AIHUB_API_KEY=sk-... npm run verify           # 端到端打真实 API 验收(会产生少量生成费用)

进度

  • M0 目录管道:catalog/catalog.zh.json(155 端点 / 128 模型 / 每模型完整参数 Schema)

  • M1 核心 server:11 工具 + stdio + 真实定价(/api/pricing)+ 产物三层交付,实测通过

  • M2 能力补齐:analyze_media / ask_model 已实现(13 工具全部实测通过)

  • M2 发布:文档站集成页、npm 发布、MCP registry(待授权/确认)

  • M3 托管模式(Streamable HTTP)

Available Tools

14 tools
analyze_media媒体理解(图/视频/音频 → 文本)A

用多模态 LLM 分析媒体内容并输出文本(宿主模型自身无法看视频/听音频,此为能力补充)。三选一提供 image_urls / video_urls / audio_url(协议自动判别)。异步提交:默认等待 60s,短任务直接返回 text;长任务(视频/思考模型)超时返回 task_id,用 get_task / wait_for_task 取回。模型来自 llm-router 注册表(与生成类不同),用支持对应能力的模型(如 gemini-3.1-pro-preview 支持 vision/video/audio);model 无效时错误会列出可用模型。

Inputs: model (required), prompt (required), audio_url, image_urls, +5 more.

ask_model问另一个模型(二次意见)A

调用一个 LLM 做对话,定位为“向另一个模型征询二次意见 / 试用”,不是主对话通道、不支持流式。异步提交 + 轮询:默认等待 60s,短问答直接返回 text;超时返回 task_id 用 get_task / wait_for_task 取回。model 用 llm-router 注册表模型(如 gemini-3.5-flash、claude-sonnet-4-6、gpt-5.5;可用集见 /v1/configs/llm_generations_models,与生成类不同)。传 prompt(单轮)或 messages(多轮,OpenAI 格式)。

Inputs: model (required), prompt, system, messages, +3 more.

create_embeddings文本嵌入B

生成文本向量嵌入(OpenAI 兼容)。model 用嵌入模型 id(如 text-embedding-3-small、jina-embeddings-v3)。input 为字符串或字符串数组。

Inputs: input (required), model (required).

describe_model查看模型参数说明A

返回指定模型的提交端点、必填/可选参数(含类型、枚举、默认值、中文说明)与一个示例请求。生成前用它确认参数,避免 422。

Inputs: model (required).

download_asset下载任务产物到本地A

把任务产物或任意 URL 下载到本地磁盘(视频等大文件的显式落盘手段)。传 task_id 时下载其成功结果里的全部 url;或直接传 url。产物 URL 24 小时失效,请及时下载。

Inputs: url, task_id, save_dir, save_path.

generate_audio生成音频A

提交音频任务:TTS/音乐/语音识别/语音克隆(Suno 自动走专用端点)。 先用 describe_model 确认该 model 的参数。默认等待 60s:短任务直接返回结果 URL;长任务超时返回 task_id,用 get_task 继续查询。

Inputs: model (required), params (required), inline_image, wait_seconds.

generate_document文档转换A

提交文档处理任务(如 Doc2X:PDF→md/tex/docx)。 先用 describe_model 确认该 model 的参数。默认等待 60s:短任务直接返回结果 URL;长任务超时返回 task_id,用 get_task 继续查询。

Inputs: model (required), params (required), inline_image, wait_seconds.

generate_image生成图像A

提交图像生成/编辑任务。 先用 describe_model 确认该 model 的参数。默认等待 60s:短任务直接返回结果 URL;长任务超时返回 task_id,用 get_task 继续查询。

Inputs: model (required), params (required), inline_image, wait_seconds.

generate_video生成视频A

提交视频生成任务(通常耗时较长)。 先用 describe_model 确认该 model 的参数。默认等待 60s:短任务直接返回结果 URL;长任务超时返回 task_id,用 get_task 继续查询。

Inputs: model (required), params (required), inline_image, wait_seconds.

get_credits查询额度与用量A

查询当前 API Key 的总额度、已用量与剩余额度。数据来自 New API 的计费端点。数值单位为站点展示单位(可能是美元/人民币/tokens,由站点配置决定),字段名沿用 OpenAI 惯例的 _usd 但不代表一定是美元。unlimited=true 表示该 Key 为无限额度。

Inputs: no named parameters.

get_task查询任务状态与结果A

查询异步任务。wait_seconds>0 时在服务端轮询(每 5s)直到完成或超时。完成后 results 内为结果(图/视频/音频为 {url},24 小时内有效,请尽快转存)。

Inputs: task_id (required), inline_image, wait_seconds, sync_upstream.

list_models列出可用生成模型A

列出 AihubMax 的媒体生成模型(图像/视频/音频/文档)。可按 media_type 或关键词过滤。available=true 表示当前 API Key 分组可直接调用;available=false 表示文档中存在但当前 Key 未开通。price 为定价摘要,group_ratios 给出各分组倍率(最终价=基准×倍率)。

Inputs: keyword, media_type, available_only.

upload_file上传文件获取可用 URLA

把本地文件或远程 URL 转存为 AihubMax 可直接引用的 URL(用于 image-to-video 等需要 image_urls/audio_url 的场景)。三选一:path(本地文件)、url(远程转存)、base64。返回的 url 可填入生成参数。

Inputs: url, path, base64, file_name.

wait_for_task阻塞等待任务完成A

阻塞等待某个异步任务直到完成/失败或达到单次等待上限。等待期间向支持的客户端发送 MCP 进度通知。达到 timeout_seconds 仍未完成则返回 still-running(含最新状态),可再次调用续等。适合长任务(视频等)。

Inputs: task_id (required), inline_image, sync_upstream, timeout_seconds.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.1/5.0

    Scored across 14 tools

    Disambiguation5/5

    Every tool has a clearly distinct purpose. Generation tools are separated by media type (audio, document, image, video), analysis is separate, task management tools differentiate polling (get_task) from blocking (wait_for_task), and other utilities (embeddings, credits, file upload, model listing) are unique.

    Naming Consistency5/5

    All tools follow a consistent verb_noun snake_case pattern: analyze_media, ask_model, create_embeddings, etc. No mixed conventions or abbreviations.

    Tool Count5/5

    14 tools is an appropriate count for a multimodal AI hub. It covers key functionalities without being bloated or sparse.

    Completeness5/5

    The tool set is comprehensive: media analysis, model querying, embeddings, generation (audio, document, image, video), file upload/download, task management, credits, and model discovery. No obvious gaps for the intended domain.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers