claude-media-mcp
Routes provider requests through Cloudflare AI Gateway, optionally using an authenticated gateway via CF_AIG_GATEWAY and CF_AIG_TOKEN.
Generates images and audio via Cloudflare Workers AI models, including @cf/black-forest-labs/flux-1-schnell for images and @cf/deepgram/aura-1 for audio.
Generates and edits images with gemini-3-pro-image (Nano Banana Pro), video with veo-3.1-generate-preview, and WAV audio with gemini-3.8-flash-tts.
Generates images with gpt-image-2 (including editing), video with sora-2, and audio with gpt-4o-mini-tts, with optional model overrides and provider-specific options.
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., "@claude-media-mcp generate a 16:9 image of a cozy cabin in snowy mountains 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.
claude-media-mcp
An MCP server that lets any MCP-capable chat or agent (Claude Code, Claude Desktop, Codex, VS Code, Antigravity, Cursor, claude.ai connectors and others) generate images, video and audio through OpenAI, Google Gemini, fal.ai and Cloudflare Workers AI. You can also send every request through your Cloudflare AI Gateway.
One Python file, three dependencies, one .env for all your clients.
Image | Video | Audio | |
OpenAI |
|
|
|
Gemini |
|
|
|
fal.ai |
|
|
|
Cloudflare Workers AI |
| - |
|
Every tool also takes a model override, so any model the provider offers works.
Quick start
Requires uv and Python 3.11+.
git clone https://github.com/righttechsoft/claude-media-mcp.git
cd claude-media-mcp
uv sync
cp .env.example .env # then fill in the keys you haveOnly providers whose key is set are used. .env sits next to server.py and is read on every start; real environment variables take precedence.
Related MCP server: MiniMax MCP JS
Connect a client
The server speaks MCP over stdio. Every client launches the same command:
uv run --directory /path/to/claude-media-mcp server.pyOr, to skip uv at launch time, the project's virtualenv Python directly: /path/to/claude-media-mcp/.venv/bin/python /path/to/claude-media-mcp/server.py (on Windows: .venv\Scripts\python.exe).
Claude Code (all projects):
claude mcp add -s user media -- uv run --directory /path/to/claude-media-mcp server.pyClaude Desktop (claude_desktop_config.json), Antigravity (~/.gemini/antigravity/mcp_config.json), Cursor (~/.cursor/mcp.json):
{
"mcpServers": {
"media": {
"command": "uv",
"args": ["run", "--directory", "/path/to/claude-media-mcp", "server.py"]
}
}
}Codex (~/.codex/config.toml):
[mcp_servers.media]
command = "uv"
args = ["run", "--directory", "/path/to/claude-media-mcp", "server.py"]VS Code (user mcp.json):
{
"servers": {
"media": {
"type": "stdio",
"command": "uv",
"args": ["run", "--directory", "/path/to/claude-media-mcp", "server.py"]
}
}
}GUI apps sometimes don't see your shell PATH. If a client can't find uv, use its absolute path or the virtualenv Python shown above.
Tools
All tools take optional provider (default: the first configured one in the order listed), model and options. options is merged into the provider's request, so you can pass any model-specific parameter (quality, seed, resolution, negative prompt and so on).
Files are saved to MEDIA_OUTPUT_DIR (default ~/claude-media) as YYYYmmdd-HHMMSS-provider-id.ext. Each result has the absolute path. In HTTP mode it also has a download link.
generate_image(prompt, provider, model, aspect_ratio, input_images, options)
Order: openai, gemini, fal, cloudflare. Returns the full-size file plus a JPEG preview (max 1024px) the chat can see inline.
aspect_ratiolike16:9. OpenAI maps it to the closest supported size.input_images: local paths, URLs or data URIs, used for editing or as references. Not supported on Cloudflare.
start_video(prompt, provider, model, aspect_ratio, duration_seconds, input_image, options) and check_video(job_id, wait_seconds=45)
Order: openai, gemini, fal. Video takes minutes, longer than most clients wait for one tool call, so it is split in two:
start_videosubmits the job and returns ajob_idimmediately.check_videowaits up towait_seconds(max 300). If the video is done it saves it and returns the path. If not, it returns the current status, and the chat calls it again.
The job_id contains the provider's own job reference, so a job started in one session can be collected in another. On fal, duration is model-specific: pass it via options, for example {"duration": "8s"}.
generate_audio(text, provider, model, voice, options)
Order: openai, gemini, fal, cloudflare. Text-to-speech by default. Prompt-based fal models (music, sound effects) take options={"prompt": "..."}.
Configuration
Variable | Purpose |
| OpenAI |
| Gemini |
| fal.ai |
| Cloudflare Workers AI |
| Cloudflare AI Gateway id. With |
| Optional, for authenticated gateways ( |
| Output folder, default |
| HTTP mode bind address, default |
| HTTP mode secret: the endpoint becomes |
| Public base URL used in file download links, for example behind a tunnel |
With the AI Gateway enabled, each provider still needs its own key. Gateway-stored keys (BYOK) without a local key are not supported yet.
HTTP mode (remote clients)
uv run server.py --httpServes streamable HTTP at http://127.0.0.1:47213/mcp and generated files at /files/<name>. To reach it from claude.ai or another machine, set MCP_TOKEN and MCP_PUBLIC_URL, put it behind a tunnel (for example Cloudflare Tunnel), and add https://your-host/{MCP_TOKEN}/mcp as a custom connector.
The server spends your API credits, so it refuses to bind to a non-loopback address without MCP_TOKEN. Treat the token like a password.
Development
uv run python test_server.pyOffline checks only: no API calls, no keys needed.
mcp is pinned below 2.0 because the mcp.server.fastmcp API this server uses was removed in the 2.x SDK.
License
Available Tools
4 toolscheck_videoA
Wait for a video job started by start_video. Polls for up to wait_seconds (0-300, default 45). When the video is ready, saves it to disk and returns its path. If it is still running, returns a status message with the job_id; call check_video again with the same job_id until the path is returned. Failures raise an error.
Inputs: job_id (required), wait_seconds.
generate_audioA
Text-to-speech (and prompt-based audio on fal). Saves the audio file to disk and returns its path.
provider (default: first configured of openai, gemini, fal, cloudflare):
openai: default gpt-4o-mini-tts, voice default alloy, mp3 output. options merged into the request (e.g. instructions, speed, response_format).
gemini: default gemini-3.8-flash-tts, voice default Kore (prebuilt voice name). options shallow-update generationConfig. Output is WAV.
fal: default fal-ai/elevenlabs/tts/turbo-v2.5. Input {text, voice} updated with options. Prompt-based fal audio models (music, sound effects) take options={"prompt": "..."}; any model id works.
cloudflare: default @cf/deepgram/aura-1. Body {text, speaker=voice} updated with options.
Inputs: text (required), model, voice, options, +1 more.
generate_imageA
Generate or edit an image. Saves full-resolution files to disk and returns paths plus a JPEG preview.
provider (default: first configured of openai, gemini, fal, cloudflare):
openai: default model gpt-image-2. aspect_ratio maps to size (1:1 -> 1024x1024; 16:9/3:2/4:3 -> 1536x1024; 9:16/2:3/3:4 -> 1024x1536). options merged into the request body (e.g. quality, background, n, output_format); options["size"] wins. input_images switches to /images/edits.
gemini: default gemini-3-pro-image (Nano Banana Pro). aspect_ratio -> imageConfig.aspectRatio (e.g. 16:9). options shallow-update generationConfig (e.g. imageConfig with imageSize).
fal: default fal-ai/nano-banana-pro. Input {prompt, aspect_ratio, image_urls} updated with options (model-specific params such as num_images, resolution, image_size). Any model id works.
cloudflare: default @cf/black-forest-labs/flux-1-schnell. Body {prompt} updated with options (e.g. steps, seed). No input_images.
input_images: local file paths, http(s) URLs or data URIs, used as edit targets or references.
Inputs: prompt (required), model, options, provider, +2 more.
start_videoA
Start a video generation job (text-to-video, or image-to-video with input_image) and return its job_id immediately. Then call check_video(job_id) to wait for and fetch the result.
provider (default: first configured of openai, gemini, fal):
openai: default sora-2. aspect_ratio 16:9 -> 1280x720, 9:16 -> 720x1280. duration_seconds -> seconds. options merged into the request (e.g. size overrides). input_image sent as input_reference.
gemini: default veo-3.1-generate-preview. aspect_ratio and duration_seconds go to parameters.aspectRatio / durationSeconds; options merged into parameters (e.g. resolution, negativePrompt, personGeneration).
fal: default fal-ai/veo3.1/fast. Input {prompt, aspect_ratio, image_url} updated with options. Duration is model-specific on fal (e.g. "8s" vs "5"), so pass it via options such as {"duration": "8s"}; duration_seconds is rejected for fal.
input_image: local path, http(s) URL or data URI.
Inputs: prompt (required), model, options, provider, +3 more. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool targets a distinct modality and action: generate_image (images), generate_audio (audio), and the start_video/check_video pair form a clearly documented async lifecycle. The start/check pairing is explicitly cross-referenced in both descriptions, so there is no risk of misselection.
All four names follow a strict verb_noun snake_case pattern (generate_image, generate_audio, start_video, check_video). The verbs accurately reflect each tool's role, and the async pair uses a clean start/check convention rather than an inconsistent verb.
Four tools is well-scoped for a media generation server covering image, audio, and video. Each tool earns its place: one per modality plus the necessary polling companion for the async video job.
The core generation lifecycle for images (including edits via input_images), audio (including prompt-based fal models), and video is fully covered. Minor gaps remain, such as no job cancellation, job listing, or file cleanup, but agents can work around these.
Maintenance
Related MCP Connectors
AI video, image and audio generation with 140+ AI models from any MCP agent
Create images & video from any MCP agent — 17 models, spend limits, one URL.
OCR, transcription, file extraction, and image generation for AI agents via MCP.
Generate images, video, audio and short films with 140+ AI models from any MCP client.
Related MCP Servers
- 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.478 npmMIT
- AlicenseNot gradedqualityAmaintenanceEnables MCP-compatible clients to generate images and videos, synthesize text-to-speech audio, and clone or design custom voices. It also supports flexible output handling (URLs or local files) and multiple transport modes including stdio, REST, and SSE.635 npmMIT
- AlicenseNot gradedqualityAmaintenanceEnables MCP-compatible clients to generate images and videos, synthesize speech, and clone or design custom voices through MiniMax's AI APIs, with configurable local or URL resource output. Supports stdio, REST, and SSE transports for both local and cloud deployment.635 npmMIT
- AlicenseNot gradedqualityAmaintenanceEnables MCP-compatible clients to generate images and videos, synthesize speech, clone voices, and design custom voices through integrated AI APIs, with configurable output modes and local or cloud transports.635 npmMIT