MCP Omni Server
This tool provides video generation (with optional embedded audio) using Google’s Gemini Omni model (gemini-omni-1.2-flash) via the Vertex Interactions API. It is one of the MCP tools for Google Cloud Genmedia services, acting as an MCP server component to allow LLMs and other MCP clients to generate videos from a text prompt, optionally conditioned on input images and/or videos.
Unlike the other genmedia servers (which use the Vertex genai client), Omni is reachable only through the Interactions API, so this server calls the shared common.GenerateOmniVideo helper (which owns the Interactions client) rather than a genai.Client. The Interactions endpoint is global-only: LOCATION defaults to global and the API call is always made against the global endpoint.
MCP Tool Definitions
Section titled “MCP Tool Definitions”The server exposes the following tool:
1. omni_video_generation
Section titled “1. omni_video_generation”- Description: Generates video (with optional embedded audio) from a text prompt, optionally conditioned on input images and/or videos, using Google’s Gemini Omni model via the Vertex Interactions API. Returns MP4(s) saved locally and/or to GCS.
- Handler:
omniVideoGenerationHandler - Parameters:
prompt(string, required except fortask=upscale): The text prompt describing the video to generate, edit, or how to extend an input video.task=upscaleis video-only and must not include a prompt.task(string, optional): Explicit video task:extend,upscaleorreference_to_video(models that list them:gemini-omni-1.2-flashsupports all three,gemini-omni-1.1-flash-previewonlyreference_to_video). Omit it for text-to-video, image-to-video, first/last frame and editing, which the model infers from the inputs.extendandupscaletake exactly one entry invideosand noimages, and do not acceptaspect_ratioorduration_seconds.extendcontinues the video guided byprompt(the output is the input plus a fixed extra span, about 10 seconds).upscalere-renders the video at1080por4k(default1080p).reference_to_videotreats the entries inimagesas subject/style references: it needs apromptand at least one image (verified with 1-3), takes novideos, and acceptsaspect_ratioandduration_seconds. Sent ingeneration_config.video_config.task.model(string, optional): Model to use. Can be the canonical model ID (gemini-omni-1.2-flash) or a common alias (e.g.Omni,Omni 1.2,Gemini Omni 1.2 Flash;Omni 1.1selects the previous preview). The priorgemini-omni-1.1-flash-previewandgemini-omni-flash-previewmodels remain selectable via their IDs or theGemini Omni Flashalias. Seemcp-common/models.gofor the supported list. Defaults togemini-omni-1.2-flash.resolution(string, optional): Video output resolution:360p,720p,1080p, or4k(gemini-omni-1.2-flashandgemini-omni-1.1-flash-previewsupport all four;gemini-omni-flash-previewsupports720p). Sent inresponse_format.aspect_ratio(string, optional): Video output aspect ratio:16:9or9:16. Sent inresponse_format.duration_seconds(number, optional): Video output duration in seconds (at least3; the maximum is model-dependent:15forgemini-omni-1.2-flash,10for the older models). Sent inresponse_format.images(array of string, optional): Up to 10 input images to condition generation on. Each entry is a local file path (up to 20 MB) or ags://URI (up to 30 MB). The MIME type is inferred from the file extension:image/png,image/jpeg,image/webp,image/gif,image/heic,image/heif. How the images are used depends ontask(see Using images): with no task, one image is the literal first frame and two images are the first and last frame, in the order given; withtask=reference_to_videothey are subject/style references.videos(array of string, optional): Up to 3 input videos to reference, edit, or extend. Each entry is a local file path (up to 20 MB) or ags://URI (video/mp4,video/webm,video/quicktime,video/mpeg,video/x-flv,video/wmv,video/3gpp).sample_count(number, optional): Number of videos to generate (1-3, default 1). Clamped to the model maximum of 3.temperature(number, optional): Sampling temperature,0.0-2.0(default1.0; higher = more varied). Sent ingeneration_config.top_p(number, optional): Nucleus sampling probability mass,0.0-1.0(default0.95). Sent ingeneration_config.output_directory(string, optional): Local directory to save the generated video(s) to. Filenames (omni_<timestamp>_<n>.mp4) are generated automatically unlessoutput_filenameis set.output_filename(string, optional): Base name for the output(s), e.g.clip.mp4. The extension is forced to the true video type and, when more than one video is generated, a_1..nsuffix is inserted before the extension. Applied identically to local files and GCS objects. See Naming Outputs.gcs_bucket_uri(string, optional): GCS URI prefix to store generated video(s) (e.g.,your-bucket/outputs/). If not provided andGENMEDIA_BUCKETis set,gs://<GENMEDIA_BUCKET>/omni_outputs/is used. For each uploaded video a best-effort V4 signed HTTPS URL is also returned (seeOMNI_SIGNED_URL_EXPIRY_HOURS).
Model Specifications (gemini-omni-1.2-flash)
Section titled “Model Specifications (gemini-omni-1.2-flash)”Per the Google Cloud Gemini Omni 1.1 Flash documentation and verified against gemini-omni-1.2-flash (GA):
| Specification | Details |
|---|---|
| Model ID | gemini-omni-1.2-flash (default); gemini-omni-1.1-flash-preview remains selectable |
| API & Endpoint | Vertex Interactions API (global location) |
| Modalities | Text (input & output), Image (input only), Video (input & output, with embedded speech, music, and sound effects) |
| Token Limits | Max input: 131,072 tokens · Max output: 57,920 tokens |
| Supported Capabilities | Thinking, Text-to-Video, Image-to-Video, Reference-to-Video, First/Last Frame Video, Sound Generation (speech, music, SFX), Video Editing, Video Extension, Video Upscale (1.2), Content Credentials (C2PA) |
| Video Output Specs | Length: 3–15s on 1.2 (3–10s on 1.1) (with or without audio) · Aspect ratios: 16:9, 9:16 · Resolutions: 360p, 720p, 1080p, 4k |
| Input Limits | Up to 10 images per prompt (<=20 MB inline / <=30 MB GCS) · Up to 3 videos per prompt |
Using images
Section titled “Using images”The Interactions API has no dedicated first/last-frame task (first_last_frame is rejected with a 400), so the
mode is chosen by the number of images and the task. Verified live on gemini-omni-1.2-flash and
gemini-omni-1.1-flash-preview:
images |
task |
Result |
|---|---|---|
| 1 | omitted | Image-to-video: the image is the literal first frame. |
| 2 | omitted | First/last frame: the first entry is the first frame and the second entry is the last frame. The order is honored and no “first frame / last frame” wording is needed in the prompt. |
| 1 or more | reference_to_video |
Reference-to-video: the images are subject/style references, not frames. Needs a prompt; no videos. |
To use a single image as a reference (not the first frame), set task to reference_to_video. Two images with
task=reference_to_video are references, not first/last frames. Explicit tasks are never combined with chat
follow-ups here: this server is single-turn (store=false) and never sends previous_interaction_id, which the API
rejects together with a video task.
Authentication
Section titled “Authentication”This server uses Application Default Credentials (ADC) to authenticate to the Vertex Interactions API — run gcloud auth application-default login locally, or rely on the attached service account when running on Google Cloud. The Interactions API is invoked against the global location only; per-region overrides do not apply to the Interactions call itself.
Environment Variable Configuration
Section titled “Environment Variable Configuration”The tool utilizes the following environment variables:
GOOGLE_CLOUD_PROJECT(string): Required. Your Google Cloud Project ID. The application will terminate if this is not set. Note:PROJECT_IDis also supported as a fallback.- Override: You can override this globally for this specific server by setting
OMNI_PROJECT_ID.
- Override: You can override this globally for this specific server by setting
GOOGLE_CLOUD_LOCATION(string): The preferred Google Cloud location. For Omni this defaults toglobaland the Interactions call is always made against theglobalendpoint.- Fallback:
LOCATIONis also supported as a fallback forGOOGLE_CLOUD_LOCATION. - Override: You can override this globally for this specific server by setting
OMNI_LOCATION.
- Fallback:
GENMEDIA_BUCKET(string): An optional default Google Cloud Storage bucket to use for GCS outputs if thegcs_bucket_uriparameter is not specified in the tool request. The pathomni_outputs/will be appended to this bucket.- Default:
""(empty string).
- Default:
OMNI_SIGNED_URL_EXPIRY_HOURS(number): Validity, in hours, of the V4 signed HTTPS URL returned for each uploaded video. Clamped to168(the V4 maximum);0disables signed-URL generation (thegs://URI is still returned). Signing under ADC without a private key requiresroles/iam.serviceAccountTokenCreatoron the runtime service account (non-fatal if absent).- Default:
24
- Default:
PORT(string, for HTTP transport): The port for the HTTP server to listen on.- Default:
"8080"
- Default:
Transports Supported
Section titled “Transports Supported”stdio(default)sse(Server-Sent Events)http(Streamable HTTP)
CORS is enabled for the HTTP transport, allowing all origins by default.
Build the tool using go build or go install.
- STDIO (Default):
Terminal window ./mcp-omni-go# or./mcp-omni-go -transport stdio - HTTP:
The MCP server will be available at
Terminal window ./mcp-omni-go -transport http# Optionally set PORT environment variable, e.g., PORT=8084 ./mcp-omni-go -transport httphttp://localhost:<PORT>/mcp. - SSE (Server-Sent Events):
The MCP server will be available at
Terminal window ./mcp-omni-go -transport sse# SSE server typically runs on port 8081 by default in this configuration.http://localhost:8081.
Examples
Section titled “Examples”Text-to-Video (omni_video_generation)
Section titled “Text-to-Video (omni_video_generation)”{ "method": "tools/call", "params": { "name": "omni_video_generation", "arguments": { "prompt": "A majestic eagle soaring over a mountain range at sunset.", "sample_count": 1, "gcs_bucket_uri": "your-gcs-bucket/omni_outputs", "output_directory": "./omni_videos" } }}Image-conditioned generation (omni_video_generation)
Section titled “Image-conditioned generation (omni_video_generation)”{ "method": "tools/call", "params": { "name": "omni_video_generation", "arguments": { "prompt": "Animate this landscape with a gentle breeze and flowing river.", "images": ["gs://your-gcs-bucket/source_images/landscape.png"], "output_directory": "./omni_videos" } }}