Gemini Multimodal MCP
# Gemini Multimodal MCP
[](https://github.com/DDEEII/gemini-multimodal-mcp/actions/workflows/ci.yml) [](https://github.com/DDEEII/gemini-multimodal-mcp/releases) [](LICENSE)
Give Codex or another MCP client a second pair of eyes and ears. Send Gemini two video cuts, a reference image, and a voiceover in the same message. Ask which cut matches the reference, follow up about one timestamp, or branch the conversation to explore a different edit.
This is a local Node.js server for the [Model Context Protocol](https://modelcontextprotocol.io/). It keeps conversation history on your machine and sends the selected inputs and history to the Gemini provider you configure.
| What you want to do | What to use |
| --- | --- |
| Compare several images, recordings, and videos together | `gemini_chat` accepts mixed attachments in one turn. Each video can have its own sampling rate and clip range. |
| Transcribe a recording or find a moment in a clip | `analyze_audio` and `analyze_video` take a file and an optional question. Without a question, they request a timestamped summary. |
| Pick up where you left off or try two directions | Name a chat, find it after a restart, or fork it at a particular turn. Independent chats can run concurrently. |
| Get results in the format your agent needs | Pass the native Gemini request body, including structured output, tools, thinking settings, or response modalities supported by your model. |
## Quick start
Install **Node.js 22 or newer** and Git. From PowerShell, bash, or zsh, run:
```sh
git clone https://github.com/DDEEII/gemini-multimodal-mcp.git
cd gemini-multimodal-mcp
npm ci
npm run setup
npm run doctor
```
In setup, press **Enter** for Google, paste your API key at the hidden prompt, and accept the default model or enter your own. For a Gemini-compatible provider, choose **2** and supply its base URL, authentication method, key, and model. The wizard writes a Git-ignored `.gemini-config.json` next to `package.json`. `doctor` checks the local configuration without contacting the provider or printing the key, host, or configured model ID. [Get a Google AI Studio key](https://aistudio.google.com/apikey) · [Configuration reference](docs/reference.md#configuration)
From the same directory, register the server with Codex:
```sh
codex mcp add gemini -- node "$PWD/src/index.js"
codex mcp list
```
Open a fresh Codex chat and try this with the absolute path to one of your own recordings:
> Use Gemini to summarize `/media/interview.wav`. Give me the timestamp of the clearest explanation and quote the speaker.
As a first check without spending API quota, ask Codex to **create a Gemini chat named “Interview review” and list its chats**. For another MCP client, register `node` as the stdio command and the absolute path to `src/index.js` as its only argument. [Client configuration examples](docs/reference.md#connecting-an-mcp-client)
## A mixed-media conversation
These are example tool arguments. Replace the paths with files on the machine running the MCP server. Windows paths such as `C:/media/cut-a.mp4` also work.
**1. Compare the material.** Call `gemini_chat` with:
```json
{
"prompt": "Which cut best matches the reference image and the pacing of the narration? Give two timestamped reasons.",
"files": [
{ "path": "/media/cut-a.mp4", "fps": 0.5, "start": "10s", "end": "40s" },
{ "path": "/media/cut-b.mp4", "fps": 1, "start": "10s", "end": "40s" },
"/media/reference.png",
"/media/narration.wav"
]
}
```
**2. Follow up.** The reply includes a `conversationId`, the model, and any usage data supplied by the provider. Send just the new question and that ID to `gemini_chat`:
```json
{
"conversationId": "<ID from the previous response>",
"prompt": "For the stronger cut, give me a three-line edit note for the editor."
}
```
**3. Explore a second direction.** Call `create_chat` with the original ID and `throughTurn: 1`. The returned ID has its own copy of the first turn, including the media and model context. Continue either conversation independently.
```json
{
"title": "Alternative opening",
"fromConversationId": "<original ID>",
"throughTurn": 1
}
```
### Request structured results
Use `generationConfig` for native generation fields and `request` for the rest of the `generateContent` body. For exact text/media ordering, pass `contents` with native `parts`. Each call can select a `model`. The `reasoningLevel` shortcut sets `thinkingConfig.thinkingLevel` for models that support it. [Gemini request reference](https://ai.google.dev/api/generate-content)
```json
{
"prompt": "Describe the main visual change in one sentence.",
"files": ["/media/before.png", "/media/after.png"],
"generationConfig": {
"responseMimeType": "application/json",
"responseJsonSchema": {
"type": "object",
"properties": { "change": { "type": "string" } },
"required": ["change"]
}
},
"store": false
}
```
## Tools
| Tool | Purpose |
| --- | --- |
| `gemini_chat` | Send a multimodal turn, continue a conversation, or make a standalone request with `store: false`. |
| `create_chat` | Start a named chat. Optionally copy an existing conversation through a specified turn. |
| `list_chats` | Search by title, ID, or last user preview. Filter active or archived chats and page through matches. |
| `get_chat` | Read metadata and recent turn previews. Page back with `beforeTurn`. |
| `update_chat` | Rename, archive, or reopen a conversation. |
| `forget_chat` | Permanently remove one local conversation and its stored media. |
| `analyze_video` | Ask a one-shot question about a local video or supported public video URL. Accepts `fps`, `start`, `end`, `detail`, and `model`. |
| `analyze_audio` | Analyze a local audio recording for speech, music, or ambient sound. Accepts an optional `prompt` and `model`. |
The default connection uses Gemini's native `generateContent` method. That single endpoint is sufficient for all eight tools. Opting into `interactions` for specialized analysis adds `manage_local_audio` and `manage_local_video` for providers that implement the Gemini Files API. Local files work with Node alone. Instagram video links additionally require `yt-dlp`. [Media formats, API modes, and limits](docs/reference.md#media-and-transport)
## Where your data goes
- **On disk** — Saved chats contain the conversation and attachment bytes as local JSON in `~/.gemini-video-mcp/chats`. Set `GEMINI_CHAT_DIR` to choose another directory. History and connection profiles are stored as plaintext. Keep them in a private location.
- **On the wire** — Each chat turn sends its saved history and attachment bytes to the selected endpoint. This lets a follow-up work even after a source file moves, and also means long chats use more bandwidth and model context. The default local limit is 100 MB for the entire encoded request. Provider limits can be lower.
- **One-off use** — `store: false` skips local history for a standalone call. Archiving preserves history. `forget_chat` deletes the local copy. Provider-side retention follows your provider's terms.
## Development and credits
Run `npm test` after installing dependencies. The suite exercises the MCP stdio protocol against a local HTTP fixture, including mixed-media payloads, authentication, chat branching, concurrent writers, restart recovery, and the private configuration wizard. It uses synthetic media and requires no Gemini key. [Contributing](CONTRIBUTING.md)
This project builds on Yilcay Birinci's video-analysis server. The original MIT copyright notice is included. [Upstream project](https://github.com/DerYUYU/gemini-video-mcp) · [MIT license](LICENSE)
TDQS
Scored across 8 tools
The chat lifecycle tools are clearly separated by action, and analyze_audio/analyze_video are distinct from each other. There is some overlap because gemini_chat can also accept audio and video, so an agent may hesitate between the general chat tool and the specialized analyzers, but the descriptions clarify the intended use cases.
Most tools follow a verb_noun pattern: create_chat, list_chats, get_chat, update_chat, forget_chat, analyze_audio, analyze_video. gemini_chat is the main outlier because it uses a provider prefix and no verb, but the set is still readable and mostly predictable.
Eight tools is well-scoped for a chat and multimodal analysis server: chat CRUD, sending messages, and dedicated audio/video analysis. Each tool has a clear role and there is no obvious filler.
The surface covers create, list, get, update, delete, and continue for local chats, plus audio and video analysis. The main minor gap is the lack of a dedicated image-analysis tool despite the multimodal branding, though gemini_chat can accept images, so core workflows remain workable.