Gemini Image Generation MCP Server

by sanxfxteam

5 stars
159 downloads
Not rated
GitHub

About

It is a Model Context Protocol (MCP) server that provides image generation capabilities using Google's Gemini 2 API. Designed for developers and Claude Desktop users who want to generate images directly from MCP-compatible tools.

Details

Author
sanxfxteam
GitHub stars
5
Downloads
159
Categories
AI

- Generates images using Gemini 2’s experimental image generation API
- Provides a single generateImage tool with required prompt
- Supports configurable number of samples (default 4)
- Supports aspect ratio options (default 1:1)
- Supports person generation settings (default ALLOW_ADULT)

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Gemini Image Generation MCP Server
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Obtain a Gemini API key from Google AI Studio, then configure Claude Desktop by adding the server entry to its config file with the GEMINI_API_KEY environment variable. Restart Claude Desktop and invoke the generateImage tool with a required prompt and optional parameters (numSamples, aspectRatio, personGeneration). Alternatively, run the server locally with npm start.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "gemini image generation mcp server": {
            "gemini-mcp-server-sanxfxteam": {
                "command": "npx",
                "args": [
                    "@modelcontextprotocol/inspector",
                    "npm",
                    "run",
                    "start"
                ]
            }
        }
    }
}

McpServers

{
    "gemini-mcp-server-sanxfxteam": {
        "command": "npx",
        "args": [
            "@modelcontextprotocol/inspector",
            "npm",
            "run",
            "start"
        ]
    }
}

Gemini Image Generation MCP Server

This is a Model Context Protocol (MCP) server that provides image generation capabilities using Google's Gemini 2 API.

<a href="https://glama.ai/mcp/servers/@sanxfxteam/gemini-mcp-server">
Gemini Image Generation Server MCP server
</a>

Quick Start

1. Get Gemini API Key
- Visit Google AI Studio
- Create a new API key

2. Configure Claude Desktop
- Locate your config file:

     Mac: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json

- Add Gemini configuration:
     {
"mcpServers": {
"gemini-imagen": {
"command": "npx",
"args": ["-y", "github:sanxfxteam/gemini-mcp-server"],
"env": {
"GEMINI_API_KEY": "your_api_key_here"
}
}
}
}

3. Restart Claude Desktop

Setup

1. Install dependencies:

npm install

2. Set up your environment variables:
Create a .env file in the root directory and add your Google API key:

GEMINI_API_KEY=your_api_key_here

Usage

Run the server:

npm start

To test

npx @modelcontextprotocol/inspector npm run start

Available Tools

generateImage

Generates images using Gemini 2's experimental image generation API.

Parameters:
- prompt (string, required): The description of the image you want to generate
- numSamples (number, optional, default: 4): Number of images to generate
- aspectRatio (string, optional, default: '1:1'): Aspect ratio of the generated images
- personGeneration (string, optional, default: 'ALLOW_ADULT'): Person generation settings

Example MCP request:

{
"tool": "generateImage",
"params": {
"prompt": "A serene mountain landscape at sunset",
"numSamples": 2,
"aspectRatio": "16:9"
}
}

Notes

- This server uses the experimental image generation feature of Gemini 2
- Make sure you have appropriate access and API keys from Google
- The server communicates using the Model Context Protocol over stdio

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.