tokenhub-aigc-model
TokenHub AIGC Model MCP server lets AI clients discover models, generate/edit images, and create Kling videos through natural-language tool calls.
List available models via
tokenhub_list_models(used for conversation-based model selection).Generate images from text prompts with
tokenhub_generate_image, supporting size, quality, output format, count, background, base64/URL responses, and per-call model/domain overrides.Edit images or run image-to-image generation with
tokenhub_edit_image, using 1–16 input images and an optional mask for local repainting.Create Kling videos from text with
tokenhub_kling_text_to_video(asynchronous task submission).Create Kling videos from an image plus prompt with
tokenhub_kling_image_to_video.Check/poll video task status and retrieve temporary video links via
tokenhub_kling_get_task.Configure API key, base URL, default model, and timeout via environment variables; supports stdio and HTTP (remote) MCP deployments.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@tokenhub-aigc-model Create an image of a serene mountain lake at sunrise with vibrant colors"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
TokenHub AIGC Model — MCP Server
An MCP Server that calls TokenHub's large-model image generation capabilities via MCP (Model Context Protocol). After configuring the TokenHub API Key in any MCP-compatible client (WorkBuddy / Claude Desktop / Cursor / various AI IDEs), customers can directly invoke text-to-image and image-to-image/image-editing interfaces using natural language.
Built-in sample model: custom-model-og-v2 (GPT-series image generation model, returns synchronously).
Features
Two tools
tokenhub_generate_image: text-to-image (POST /v1/images/generations, synchronous return)tokenhub_edit_image: image-to-image / image editing (POST /v1/images/edits, synchronous return, supports 1-16 input images and mask inpainting)
Two transports
stdio(default): direct integration with local clients, zero deploymentstreamable-http: deploy as a remote endpoint for external customers/teams to access remotely
Flexible configuration: API Key, site domain, and model name can all be configured via environment variables; a single call can override the domain/model (switching sites or models requires no configuration changes)
Related MCP server: ideogram-mcp
Quick Start
Method 1: stdio (local integration, recommended first)
Add a command-type MCP Server to your MCP client configuration:
Client | Configuration |
WorkBuddy |
|
Claude Desktop |
|
Cursor | Settings → MCP → Add new MCP server |
{
"mcpServers": {
"tokenhub": {
"type": "stdio",
"command": "npx",
"args": ["-y", "tokenhub-aigc-model"],
"env": {
"TOKENHUB_API_KEY": "你的 TokenHub API Key",
"TOKENHUB_BASE_URL": "https://tokenhub.tencentmaas.com",
"TOKENHUB_MODEL": "custom-model-og-v2"
},
"description": "TokenHub 生图 MCP"
}
}
}After configuration, you can start chatting: "Draw me a kitten dancing in the bamboo forest, 2048x2048".
Method 2: Streamable HTTP (remote deployment)
{
"mcpServers": {
"tokenhub": {
"url": "https://你的服务域名/mcp",
"headers": { "x-mcp-auth-token": "部署时设置的 MCP_AUTH_TOKEN" }
}
}
}Environment Variables
Variable | Required | Default | Description |
| Yes (error at execution) | - | API Key obtained from the TokenHub console, sent in the |
| No |
| Site domain (see site description below), no trailing slash |
| No |
| Default model name, can be overridden 拡張 per call |
| No (recommended in HTTP mode) | - | Optional authentication for HTTP mode; when set, requests to |
Site domain
TokenHub is deployed across regional sites, and customers on different sites need to specify their corresponding domain. The default is the domestic Guangzhou site:
Site | Domain (example) |
Domestic · Guangzhou |
|
Other sites (domestic Singapore / international sites in Guangzhou, Singapore, US West, etc.) | Contact TokenHub to obtain the corresponding domain from business/technical support, and fill it into |
Tool Parameters
Token Generator
Parameter | Required | Description |
| Yes | Text prompt, max 32000 characters |
| No | Override the site domain / model name for a single call |
| No | Generated size |
| No |
|
| No | Number of images to generate 1-10, default 1 |
| No |
|
| No |
|
| No | JPEG compression level 0-100 ( |
| No |
|
tokenhub_edit_image (image-to-image / edit)
Shares all of the parameters above. Additional parameters:
Parameter | Required | Description |
| Yes | 1-16 input images, |
| No | Local inpainting mask, the size must match the input image |
| No | additionally supports |
Returns: a list of image URLs, request_id (for troubleshooting), total_tokens (for billing); if response_format=b64_json, the optional side effect also includes base64 image blocks for direct display.
错误处理
A failed tool call returns
isError: trueand the error message containsstatus, the upstream errorcode, andrequest_id.On permission / rate-limit / parameter errors, please keep the
request_idto submit to TokenHub technical support for troubleshooting.If
TOKENHUB_API_KEYis not configured, tool calls include multiple useful error message (the server can still start normally).
HTTP Mode Deployment (Remote)
# 本地启动(默认 stdio)
npx -y tokenhub-aigc-model
# HTTP 模式
TOKENHUB_API_KEY=xxx MCP_AUTH_TOKEN=部署密钥 \
npx -y tokenhub-aigc-model --transport=http --port=3000 --host=127.0.0.1Endpoints:
POST /mcp、GET /mcp: MCP protocol entryGET /health: health check
When deploying to the public internet, make sure to:
Set the
MCP_AUTH_TOKEN, or optionally perform authentication at the front-end gateway. reverse proxy (such as EdgeOne, CLB, Nginx);Use HTTPS;
base_urlsupports per-call overrides; it is only recommended to open it in trusted environments.
開發與發佈
npm install # 安装依赖
npm run build # TypeScript 构建到 dist/
npm test # 单元测试 + stdio/HTTP 冒烟测试(共 20 个用例)
npm pack --dry-run # 查看发布内容publish to npmjs (if the current registry is a Tencent mirror, specify the registry explicitly):
npm run build
npm version patch
npm publish --access public --registry=https://registry.npmjs.org
git tag v0.1.0 && git push --tags⚠️ 重要注意事項
白名單申請:
custom-model-og-v2為測試模型,請先聯繫 TokenHub 產品/後台人員提交 UIN 和 Appid 取得白名單權限後,方可使用;沒有白名單的調用會返回權限錯誤。API Key: please go to TokenHub console Create a dedicated Key for your model; the Key is shown only once at creation, so save it safely.
計費: TokenHub 按 Token 計費(約 10 元 / 百萬 tokens),每小時結算。
n>1或多張輸入圖片會显著增加消耗,請商務人員盡早為客戶申請折扣。費用公式(人民幣):文本輸入 token×3.35 + 文本緩存輸入×0.8375 + 圖輸入圖×5.36 + 圖像緩存輸入×1.34 + 輸出圖片×20.1 = 單次任務 token 消耗(換算係數與匯率相關,當前係數為 6.7)。
License
Available Tools
2 toolstokenhub_edit_imageTokenHub 图生图/图片编辑A
调用 TokenHub 接口,基于 1-16 张输入图 + 文本描述同步生成图片(模型默认 custom-model-og-v2,需开白)。支持局部重绘(mask)。输入图支持 URL 或 base64。返回图片 URL 列表、request_id 与 token 用量。
Inputs: images (required), prompt (required), n, mask, +8 more.
tokenhub_generate_imageTokenHub 文生图A
调用 TokenHub 接口,根据文本描述同步生成图片(模型默认 custom-model-og-v2,需在 TokenHub 控制台开白并配置专属 API Key)。返回图片 URL 列表、request_id 与 token 用量。
Inputs: prompt (required), n, size, model, +6 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 2 tools
The two tools have clearly distinct purposes: one generates an image purely from text, while the other edits/generates from 1-16 input images with optional masking. There is no realistic confusion between them.
Both tools follow the same tokenhub_<verb>_image pattern with static verb prefixes: edit and generate. The naming convention is consistent and predictable.
With only two tools, the server is slightly thin, but each tool covers a distinct core task in the image-generation domain. The focused scope makes the small count reasonable.
The two primary workflows—text-to-image generation and image editing/reinpainting—are covered, and the synchronous design avoids needing result-status tools. A minor gap is the lack of model-list or capability-discovery tooling, but agents can still complete the core tasks.
Maintenance
Related MCP Connectors
Generate AI images and videos from any compatible MCP client.
Generate images with any major model — one API key, one prepaid balance, one MCP.
Generate images from Claude, ChatGPT, Cursor and Codex with 12 top AI image models. Up to 4 images per call, SVG vectorization, background removal, upscaling and image-to-video. Remote MCP with OAuth, no API keys.
Focused MCP server for OpenAI image/audio generation (v2.0.0). Wraps endpoints via HAPI CLI.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables image generation, editing, and composition using any OpenAI-compatible Images API within MCP clients, Dify, and n8n, delivering results as image blocks, structured fields, or resource links.4MIT
- AlicenseAqualityBmaintenanceEnables generating, editing, remixing, upscaling, and describing images through the Ideogram V3 API from any MCP client.38127 npmMIT
- AlicenseAqualityBmaintenanceEnables MCP clients to generate images and iteratively edit them using OpenAI's gpt-image-2 models, with session management, background job polling, and local file saving.8556 npmMIT
- AlicenseNot gradedqualityAmaintenanceEnables any MCP client to create and edit images from natural-language requests, automatically enriching short prompts with composition, lighting, and camera details while supporting Gemini, OpenAI, and BytePlus Seedream with fast, balanced, or quality presets.1,781 npmMIT