Purpose: Media Gen MCP is a media generation and processing server for Model Context Protocol (MCP) clients, allowing MCP-compatible clients such as Claude Desktop, Cursor, VS Code, Windsurf, and fast-agent to call the image and video capabilities of OpenAI and Google.
Main capabilities:
- Image generation and editing: openai-images-generate corresponds to the OpenAI Images create API and supports gpt-image-1.5 and gpt-image-1; openai-images-edit corresponds to the createEdit API and can process 1 to 16 images at a time, supporting inpainting, outpainting, and compositing, with parameters covering image, mask, n, quality, size, user, and more.
- Video generation: openai-videos-create/remix/list/retrieve/delete/retrieve-content corresponds to the videos interface of Sora (sora-2, sora-2-pro), and can create, remix, list, query, and delete tasks and download videos, thumbnails, and spritesheets.
- Google GenAI video: google-videos-generate starts a long-running Veo task, google-videos-retrieve-operation polls, and google-videos-retrieve-content downloads the .mp4.
- Fetching and compression: fetch-images reads images from HTTP(S) or local paths, with optional sharp compression, up to 20 in parallel; fetch-videos and fetch-document download or reuse local files and return a resource_link or embedded resource.
- Debugging: test-images uses the same result-building logic as the production tools, making it easy to test how different MCP clients handle content[] and structuredContent.
Usage: Run via npx from a remote repository, or build locally and then run node dist/index.js. The server must be registered in the MCP client configuration, and environment variables such as OPENAI_API_KEY must be set; it supports --env-file to load an env file, and also supports secrets.yaml (values override environment variables, and the placeholder <your-api-key-here> is ignored). Azure deployment variables are supported. The build commands are npm run build (strict TypeScript) or npm run esbuild (fast bundling).
Limitations and security: All tools are restricted by the MEDIA_GEN_DIRS allowed directories; when unset, the default is /tmp/media-gen-mcp (on Windows, %TEMP%/media-gen-mcp); remote reads are filtered by MEDIA_GEN_URLS, and an empty value means all are allowed. Writes occur under the first entry of MEDIA_GEN_DIRS. Logs by default truncate fields such as base64, and this can be controlled with MEDIA_GEN_MCP_LOG_SANITIZE_IMAGES. Tool errors are returned with isError: true. It is recommended to use a dedicated system user and keep the allowlist minimized.