Skip to main content

MCP Server for Gemini Image and Audio generation

Project description

Gemini Gen MCP

PyPI version License: MIT

MCP Server for Gemini Image and Audio generation using Google's Gemini AI models.

Features

This MCP server provides tools to:

  • Generate images from text using Gemini's Flash Image model
  • Generate audio from text using Gemini 2.5 Flash Preview TTS model

Installation

From PyPI

pip install gemini-gen-mcp

From Source

git clone https://github.com/ServiceStack/gemini-gen-mcp.git
cd gemini-gen-mcp
pip install -e .

Prerequisites

You need a Google Gemini API key to use this server. Get one from Google AI Studio.

Environment Variables

Variable Required Default Description
GEMINI_API_KEY Yes - Your Google Gemini API key
GEMINI_DOWNLOAD_PATH No /tmp/gemini_gen_mcp Directory where generated files are saved

Set the environment variables:

export GEMINI_API_KEY='your-api-key-here'
export GEMINI_DOWNLOAD_PATH='/path/to/downloads'  # optional

Generated files are organized by type and date:

  • Images: $GEMINI_DOWNLOAD_PATH/images/YYYY-MM-DD/
  • Audio: $GEMINI_DOWNLOAD_PATH/audios/YYYY-MM-DD/

Each generated file includes a companion .info.json file with generation metadata.

Usage

Running the Server

Run the MCP server directly:

gemini-gen-mcp

Or as a Python module:

python -m gemini_gen_mcp.server

Using with Claude Desktop

See CLAUDE_CONFIG.md for detailed instructions.

Add this to your claude_desktop_config.json:

{
  "mcpServers": {
    "gemini-gen": {
      "command": "gemini-gen-mcp",
      "env": {
        "GEMINI_API_KEY": "your-api-key-here"
      }
    }
  }
}

Available Tools

text_to_image

Generate images from text descriptions using Gemini's image generation models.

Parameters:

  • prompt (string, required): Text description of the image to generate
  • model (string, optional): Gemini model to use
    • gemini-2.5-flash-image (default)
    • gemini-3-pro-image-preview
  • aspect_ratio (string, optional): Aspect ratio for the generated image (default: "1:1")
    • Supported: 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9
  • temperature (float, optional): Sampling temperature for image generation (default: 1.0)
  • top_p (float, optional): Nucleus sampling parameter (optional)

Example:

{
  "prompt": "A serene mountain landscape at sunset with a lake",
  "model": "gemini-2.5-flash-image",
  "aspect_ratio": "16:9",
  "temperature": 1.0
}

text_to_audio

Generate audio/speech from text using Gemini's TTS models. Output is saved as WAV format.

Parameters:

  • text (string, required): Text to convert to speech
  • model (string, optional): Gemini TTS model to use
    • gemini-2.5-flash-preview-tts (default)
    • gemini-2.5-pro-preview-tts
  • voice (string, optional): Voice to use for speech generation (default: "Kore")

Available Voices:

Voice Style Voice Style Voice Style
Zephyr Bright Puck Upbeat Charon Informative
Kore Firm Fenrir Excitable Leda Youthful
Orus Firm Aoede Breezy Callirrhoe Easy-going
Autonoe Bright Enceladus Breathy Iapetus Clear
Umbriel Easy-going Algieba Smooth Despina Smooth
Erinome Clear Algenib Gravelly Rasalgethi Informative
Laomedeia Upbeat Achernar Soft Alnilam Firm
Schedar Even Gacrux Mature Pulcherrima Forward
Achird Friendly Zubenelgenubi Casual Vindemiatrix Gentle
Sadachbia Lively Sadaltager Knowledgeable Sulafat Warm

Example:

{
  "text": "Hello, this is a test of the Gemini text to speech system.",
  "model": "gemini-2.5-flash-preview-tts",
  "voice": "Kore"
}

Development

Setup Development Environment

# Clone the repository
git clone https://github.com/ServiceStack/gemini-gen-mcp.git
cd gemini-gen-mcp

# Install in editable mode with dependencies
pip install -e .

Running Tests

# Install test dependencies
pip install pytest pytest-asyncio

# Run tests
```bash
# uv run pytest tests -v
npm test

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Support

For issues and questions, please use the GitHub Issues page.

Acknowledgments

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gemini_gen_mcp-0.0.1.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gemini_gen_mcp-0.0.1-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file gemini_gen_mcp-0.0.1.tar.gz.

File metadata

  • Download URL: gemini_gen_mcp-0.0.1.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for gemini_gen_mcp-0.0.1.tar.gz
Algorithm Hash digest
SHA256 4b14c7d01201ac388b2e12342acbf8db118c14f917e9e5f80e8ac76b12483121
MD5 718a761970228dc16ae976c1a47a9cc1
BLAKE2b-256 ef74956b4cb5c6aeaf5bb087f711ba395a33577700b0b1870458a64207052be2

See more details on using hashes here.

File details

Details for the file gemini_gen_mcp-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: gemini_gen_mcp-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for gemini_gen_mcp-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 50c810f3c21d5b13860a9b41b3c42a269625a04bc16b31ebe8e2b154daabea6c
MD5 ae5f9a83245fb10752162906f62f794a
BLAKE2b-256 17d1102ef1a0949ab6772f882fda7c8fb97018bb4a12b078362088bee118f9ca

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page