ai-media-mcp
Allows generating images with OpenAI GPT image models (e.g. gpt-image-2) via an OpenAI-compatible API, supporting multiple images, reference images, and file-based output.
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., "@ai-media-mcp Generate a cinematic video of a city skyline at sunset"
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.
ai-media-mcp
A single-file, zero-dependency MCP server for image & video generation across GPT-Image / Gemini / Grok / Jimeng, with zero base64 — everything is saved to disk and only file paths are returned.
Node.js 18+ required. No
npm install, no build step. Just run the.mjs.
✨ Features
🖼 Image generation —
generate_image: one OpenAI-compatible path, model name pass-through (gpt-image-2/gemini-3-pro-image/grok-imagine-image-quality/doubao-seedream/ Jimeng image models …)🎬 Video generation —
generate_video(submit only) /get_video_status(poll) /generate_video_and_wait(submit → poll → download). Auto-routes Grok video & Jimeng video.🔑 Multi-key routing — different models automatically use their own API key & base URL (common with relay/aggregator gateways).
🚫 Zero base64 — images/videos are saved to local disk; responses only contain
Saved to: ...(~350 bytes vs ~3 MB with typical MCP wrappers).📚 Capability lookup —
list_model_capabilities: query supported resolutions / aspect ratios / durations per model; reverse-lookup (size: "720p",aspect_ratio: "21:9"). Zero cost.🖼 Multi-reference images (image-to-image) —
imagesarray (up to 5): Gemini native multi-image via multipleinlineData; GPT/Grok arrays with automaticedits → generationsfallback. The requested model is preserved; GPT, Gemini, and Grok have each passed two-reference gateway tests.🎬 Reference-image video (image-to-video) — single
image(Grokimage_url, Jimengfirst_frame_url) or multipleimages(Jimengreference_image_urlsup to 9, Grokimage_urlarray fallback).✍️ Auto prompt enhancement —
auto_prompt: true(default): if the prompt is < 15 chars and reference images are present, an internal "seamless fusion" template is applied (lighting / perspective / color grading / anti-cutout instructions verified on real generations).🧪
@chatbox-latest— passimage: "@chatbox-latest"to auto-read the most recent image dragged into the Chatbox window (chatbox-blobs\pictureinput-*). Repeated aliases inimagespreserve the UI attachment order.🔎 Verifiable references — every generated image reports ordered
reference_imagesmetadata derived from the exact bytes sent upstream: safe source label, MIME, byte count, dimensions, and SHA-256.📥 Sandbox delivery — callers can pass their writable sandbox as
output_dir, keepreturn_mode: "path", and turn returned files into download cards without moving files from unrelated external directories.
Related MCP server: ImageForge MCP
📦 Install
# Just clone/copy the mjs and run it directly
node ai-media-mcp.mjsNo npm dependencies. Add it to your MCP client (e.g. Chatbox / Claude Desktop) as a stdio server:
{
"command": "node",
"args": ["/path/to/ai-media-mcp.mjs"],
"env": { "...": "see .env.example" }
}⚙️ Configuration
All variables are optional. A group falls back to the unified AI_MEDIA_API_KEY / AI_MEDIA_BASE_URL only when its group variable is absent. If a group key is explicitly present but empty (for example AI_MEDIA_JIMENG_API_KEY=), that group is disabled and will not reuse another provider's key.
Variable | Group | Description |
| GPT |
|
| Gemini | native Gemini API ( |
| Grok |
|
| Jimeng |
|
| unified | fallback for all groups |
| — | default image model ( |
| — | default video model ( |
| — | output dirs |
| — |
|
| — |
|
| — | timeouts |
🧭 Routing
By model name prefix:
Model prefix | Group | API |
| Gemini | native |
| Grok | OpenAI-compatible |
| Jimeng | task-based |
others ( | GPT | OpenAI-compatible |
🛠 Tools
Tool | Purpose |
| Generate images (n, size/aspect_ratio/quality, |
| Submit a video task only (Grok/Jimeng auto-route, |
| Query task status |
| Submit → poll → download to |
| Query model capabilities (resolutions/ratios/durations), reverse-lookup by size or ratio |
| Probe actual supported sizes/ratios via minimal real calls, cache results |
📄 License
MIT
Available Tools
6 toolsgenerate_imageA
生成/编辑图片(OpenAI 兼容 /images/generations,模型名透传:gpt-image-2、gemini-3-pro-image、grok-imagine-image-quality、即梦、doubao-seedream 等)。默认保存到本地并只返回文件路径(零 base64)。
Inputs: prompt (required), n, size, image, +8 more.
generate_videoA
提交视频生成任务(不等待)。grok-imagine-video* 走 /videos/generations;即梦 as-sd2.0-fast / video-ds-2.0* 走 /videos。自动按模型名路由。
Inputs: image, model, images, prompt, +4 more.
generate_video_and_waitA
提交视频任务、轮询到完成并下载到本地,返回本地文件路径(零 base64)。可能需要数分钟。
Inputs: image, model, images, prompt, +5 more.
get_video_statusA
查询视频任务状态(自动兼容即梦 /videos/{id} 与 grok /videos/{id} 两种路由)。
Inputs: task_id (required).
list_model_capabilitiesA
查询各模型支持的图片/视频分辨率、宽高比、时长等能力清单(纯本地查询,不调用 API、不收费)。可指定 model 精确查询某模型,或传 aspect_ratio/size/resolution 反查可用模型。
Inputs: kind, size, model, aspect_ratio.
probe_capabilitiesA
实测各模型当前支持的分辨率/宽高比(真实调用试探,会消耗少量生成配额,默认只试探少量组合)。结果写入本地缓存,list_model_capabilities 自动合并。可选 model 只探测指定模型。
Inputs: note, model.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool has a clearly distinct purpose: local capability lookup vs. live probing, image generation vs. video generation, async submission vs. status polling vs. synchronous wait-and-download. Even related pairs like generate_video and generate_video_and_wait are cleanly separated by behavior.
All tool names follow a consistent verb_noun snake_case pattern: list_, probe_, generate_, get_. The longer generate_video_and_wait is still a predictable extension of generate_video without mixing conventions.
With six tools, the server is well-scoped for an AI media generation service. Each tool addresses a distinct part of the workflow: capability discovery, image generation, video submission, status polling, and synchronous video generation.
The surface covers the core workflow: check capabilities, generate an image, submit/synchronously wait for video, and poll video status. Minor gaps exist, such as no way to cancel a pending video job or list/manage previously generated files, but these are not critical to the server's stated purpose.
Maintenance
Related MCP Connectors
Generate images, videos, voiceovers, and captions from a chat prompt.
Generate images and videos with Seedance, Veo, Wan, Grok, GPT-Image and Nano Banana via one MCP.
Generate and upscale AI images, video and audio with leading models, right from your AI chat.
AI image + video generation for agents: --flag prompt DSL, async generate/poll, x402 pay-per-use.
Related MCP Servers
- AlicenseAqualityBmaintenanceEnables intelligent multi-provider image generation through OpenAI and Google Gemini APIs with automatic provider selection, support for reference images, real-time data grounding, and conversational refinement.8MIT
- AlicenseAqualityCmaintenanceEnables image generation and editing through OpenAI's gpt-image-2 model, supporting text-to-image, reference-guided generation, and editing with local files or URLs.22MIT
- AlicenseAqualityBmaintenanceEnables video and image generation from any MCP client, with support for models like Veo 3.1, Grok Imagine, and Nano Banana, including text-to-video, image-to-video, image generation and editing.458 npmMIT
- AlicenseNot gradedqualityAmaintenanceEnables AI assistants and MCP clients to generate and edit images, automatically enriching prompts with visual details and quality presets across Gemini, OpenAI, and BytePlus Seedream, with results saved to disk.1,225 npmMIT