Gemini Image Generation

Generate images using gemini
  • javascript

4

GitHub Stars

javascript

Language

6 months ago

First Indexed

2 months ago

Catalog Refreshed

Documentation & install

Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.

Installation

Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "sanxfxteam-gemini-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "github:sanxfxteam/gemini-mcp-server"
      ],
      "env": {
        "GEMINI_API_KEY": "YOUR_API_KEY"
      }
    }
  }
}

This MCP Server provides image generation capabilities by connecting to Google's Gemini 2 API. You can generate images from prompts, customize the number of results and aspect ratio, and manage access with an API key. It runs as a local or remote MCP endpoint and integrates with clients that support the Model Context Protocol.

How to use

You interact with this server through an MCP client by invoking the generateImage tool and supplying a prompt. Configure your client to point to the Gemini image generation MCP server, then request image generation with your desired parameters such as the prompt text, the number of images to produce, and the aspect ratio. The server handles communication with Gemini 2 and returns generated images for you to display or save.

How to install

Prerequisites: you need Node.js and npm installed on your system. If you do not have them, install Node.js from the official website, which also provides npm.

# Install dependencies for the MCP setup
npm install

Create an environment file to store your Gemini API key securely.

# In the root of your project, create a .env file with your API key
GEMINI_API_KEY=your_api_key_here

Run the MCP server locally to start serving image generation requests.

npm start

Additional notes

Configure the client to provide your Gemini API key as shown in the configuration example. The server communicates over stdio using the MCP, so your client should be able to exchange MCP messages in that format. The Gemini 2 API feature used here is experimental, so ensure you have access and proper key management.

If you want to test the server quickly, you can run the inspector tool to validate the MCP setup and the generateImage tool. Use the inspector to execute a request against the local start command to verify that images are generated and returned as expected.

Configuration and usage details

The server can be started via a local command and requires the Gemini API key to be provided in the environment. Use the following MCP configuration to connect via stdio to the local server.

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

Available tools

generateImage

Generates images using Gemini 2's experimental image generation API. You provide a prompt, optional number of samples, aspect ratio, and person generation settings to obtain generated images.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational