ai-media-mcp

ai-media-mcp

Enables image and video generation across GPT-Image, Gemini, Grok, and Jimeng with file-based outputs, multi-reference support, and model capability lookup.

Category
Visit Server

README

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) โ€” images array (up to 5): Gemini native multi-image via multiple inlineData; GPT/Grok arrays with automatic edits โ†’ generations fallback. The requested model is preserved; GPT, Gemini, and Grok have each passed two-reference gateway tests.
  • ๐ŸŽฌ Reference-image video (image-to-video) โ€” single image (Grok image_url, Jimeng first_frame_url) or multiple images (Jimeng reference_image_urls up to 9, Grok image_url array 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 โ€” pass image: "@chatbox-latest" to auto-read the most recent image dragged into the Chatbox window (chatbox-blobs\pictureinput-*). Repeated aliases in images preserve the UI attachment order.
  • ๐Ÿ”Ž Verifiable references โ€” every generated image reports ordered reference_images metadata 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, keep return_mode: "path", and turn returned files into download cards without moving files from unrelated external directories.

๐Ÿ“ฆ Install

# Just clone/copy the mjs and run it directly
node ai-media-mcp.mjs

No 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
AI_MEDIA_GPT_API_KEY / AI_MEDIA_GPT_BASE_URL GPT gpt-image-2 / doubao-* / Jimeng image
AI_MEDIA_GEMINI_API_KEY / AI_MEDIA_GEMINI_BASE_URL Gemini native Gemini API (/v1beta/models/...:generateContent)
AI_MEDIA_GROK_API_KEY / AI_MEDIA_GROK_BASE_URL Grok grok-imagine-image-quality / grok-imagine-video
AI_MEDIA_JIMENG_API_KEY / AI_MEDIA_JIMENG_BASE_URL Jimeng as-sd2.0-fast / video-ds-2.0
AI_MEDIA_API_KEY / AI_MEDIA_BASE_URL unified fallback for all groups
AI_MEDIA_IMAGE_MODEL โ€” default image model (gpt-image-2)
AI_MEDIA_VIDEO_MODEL โ€” default video model (grok-imagine-video)
AI_MEDIA_IMAGE_OUTPUT_DIR / AI_MEDIA_VIDEO_OUTPUT_DIR โ€” output dirs
AI_MEDIA_RETURN_MODE โ€” path (default, zero base64) / inline / both
AI_MEDIA_AUTO_PROMPT โ€” auto (default) / never
AI_MEDIA_TIMEOUT_MS / AI_MEDIA_POLL_INTERVAL_MS โ€” timeouts

๐Ÿงญ Routing

By model name prefix:

Model prefix Group API
gemini-* / imagen-* Gemini native /v1beta/models/{model}:generateContent
grok-* Grok OpenAI-compatible
video-ds* / as-sd* Jimeng task-based /videos
others (gpt-*, doubao-*, Jimeng image) GPT OpenAI-compatible

๐Ÿ›  Tools

Tool Purpose
generate_image Generate images (n, size/aspect_ratio/quality, image/images references, auto_prompt)
generate_video Submit a video task only (Grok/Jimeng auto-route, image/images supported)
get_video_status Query task status
generate_video_and_wait Submit โ†’ poll โ†’ download to output_dir (or the configured default), return file path
list_model_capabilities Query model capabilities (resolutions/ratios/durations), reverse-lookup by size or ratio
probe_capabilities Probe actual supported sizes/ratios via minimal real calls, cache results

๐Ÿ“„ License

MIT

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured