Gemini MCP Server for Claude Desktop

Gemini MCP Server for Claude Desktop

A server that enables Claude Desktop to generate images using Google's Gemini AI models through the Model Context Protocol (MCP).

Garblesnarff

Research & Data
Visit Server

README

Gemini MCP Server for Claude Desktop

A Model Context Protocol (MCP) server that enables Claude Desktop to generate images using Google's Gemini AI models.

🌟 Features

  • Generate images directly from Claude Desktop using Google's Gemini models
  • Easy setup wizard for configuration
  • Customizable image generation parameters
  • Integration with Claude Desktop's MCP server system
  • Detailed logging and debugging capabilities

📋 Requirements

  • Node.js 16.x or higher
  • Claude Desktop application
  • Google Gemini API key (Get one here)

🚀 Installation

Global Installation (Recommended)

npm install -g gemini-mcp-server

# Run the setup wizard
npx gemini-mcp-setup

Local Installation

# Create a directory for the server
mkdir gemini-mcp-server
cd gemini-mcp-server

# Install locally
npm install gemini-mcp-server

# Run the setup wizard
npx gemini-mcp-setup

⚙️ Setup

The setup wizard will guide you through the configuration process:

  1. Enter your Google Gemini API key
  2. Specify the directory for saving generated images
  3. Configure logging and model settings
  4. Automatically create a wrapper script for Claude Desktop
  5. Update your Claude Desktop configuration

If you prefer manual setup, see the Manual Configuration section below.

🎨 Using the Gemini MCP Server

Once installed and configured, restart Claude Desktop to enable the Gemini MCP server. Then:

  1. Start a conversation with Claude
  2. Ask Claude to generate an image for you, for example:
    • "Generate an image of a mountain landscape at sunset"
    • "Create a picture of a futuristic city with flying cars"
    • "Make an illustration of a cat playing piano"

Claude will call the Gemini API to generate the image and provide you with the path to the saved image file.

Advanced Options

You can customize the image generation with additional parameters:

  • Style: Specify a style like "realistic", "artistic", "minimalistic", etc.
  • Temperature: Control the creativity/randomness of the generation (0.0-1.0)

Example: "Generate an image of a cyberpunk city with neon lights in a realistic style with temperature 0.7"

🔧 Manual Configuration

If you prefer not to use the setup wizard, follow these steps:

1. Create Configuration File

Create a JSON configuration file with your settings:

{
  "apiKey": "YOUR_GEMINI_API_KEY_HERE",
  "outputDir": "/path/to/your/output/directory",
  "debug": true,
  "modelOptions": {
    "model": "gemini-2.0-flash-exp",
    "temperature": 0.4
  }
}

2. Create Wrapper Script

Create a bash script to run the server:

#!/bin/bash
# Set environment variables
export GEMINI_API_KEY="YOUR_GEMINI_API_KEY_HERE"
export OUTPUT_DIR="/path/to/your/output/directory"
export DEBUG="true"

# Execute the server
exec "$(which node)" "$(npm root -g)/gemini-mcp-server/bin/gemini-mcp-server.js"

Make the script executable:

chmod +x gemini-mcp-wrapper.sh

3. Update Claude Desktop Configuration

Edit your ~/.config/claude/claude_desktop_config.json file to add the Gemini MCP server:

{
  "mcpServers": {
    "gemini-image": {
      "command": "/bin/bash",
      "args": [
        "-c",
        "/path/to/your/gemini-mcp-wrapper.sh"
      ],
      "env": {
        "GEMINI_API_KEY": "YOUR_GEMINI_API_KEY_HERE",
        "DEBUG": "true"
      }
    }
  }
}

📚 API Documentation

Command Line Interface

gemini-mcp-server [options]

Options:

  • -k, --api-key <key>: Google Gemini API key
  • -o, --output-dir <dir>: Directory to save generated images
  • -d, --debug: Enable debug logging
  • -c, --config <path>: Path to custom configuration file
  • -r, --reset-config: Reset configuration to defaults
  • -v, --version: Display version information

Environment Variables

  • GEMINI_API_KEY: Your Google Gemini API key
  • OUTPUT_DIR: Directory to save generated images
  • DEBUG: Enable debug logging (true or false)
  • LOG_LEVEL: Set log level (ERROR, WARN, INFO, or DEBUG)
  • GEMINI_LOG_FILE: Custom log file path

Configuration Options

Option Description Default
apiKey Google Gemini API key (required)
outputDir Directory to save generated images ~/Claude/gemini-images
debug Enable debug logging false
modelOptions.model Gemini model to use gemini-2.0-flash-exp
modelOptions.temperature Control creativity/randomness 0.4
modelOptions.topK Top-k sampling parameter 32
modelOptions.topP Top-p sampling parameter 1
modelOptions.maxOutputTokens Maximum output tokens 8192

🔍 Troubleshooting

Common Issues

Server doesn't start or Claude can't connect to it

  1. Check the log file at ~/Claude/logs/gemini-image-mcp.log
  2. Verify your API key is correct
  3. Ensure all directories exist and have proper permissions
  4. Restart Claude Desktop

Images aren't being generated

  1. Verify your Google Gemini API key has the correct permissions
  2. Check if the output directory exists and is writable
  3. Examine the logs for specific error messages
  4. Try a different prompt or model

Error: "Method not found"

This usually means Claude is trying to call a method that the MCP server doesn't support. Check the logs to see what method was requested.

Debug Mode

Enable debug mode for more detailed logs:

npx gemini-mcp-server --debug

Or set the environment variable:

export DEBUG=true
npx gemini-mcp-server

📝 License

MIT

🙏 Acknowledgements

Recommended Servers

Crypto Price & Market Analysis MCP Server

Crypto Price & Market Analysis MCP Server

A Model Context Protocol (MCP) server that provides comprehensive cryptocurrency analysis using the CoinCap API. This server offers real-time price data, market analysis, and historical trends through an easy-to-use interface.

Featured
TypeScript
MCP PubMed Search

MCP PubMed Search

Server to search PubMed (PubMed is a free, online database that allows users to search for biomedical and life sciences literature). I have created on a day MCP came out but was on vacation, I saw someone post similar server in your DB, but figured to post mine.

Featured
Python
dbt Semantic Layer MCP Server

dbt Semantic Layer MCP Server

A server that enables querying the dbt Semantic Layer through natural language conversations with Claude Desktop and other AI assistants, allowing users to discover metrics, create queries, analyze data, and visualize results.

Featured
TypeScript
mixpanel

mixpanel

Connect to your Mixpanel data. Query events, retention, and funnel data from Mixpanel analytics.

Featured
TypeScript
Sequential Thinking MCP Server

Sequential Thinking MCP Server

This server facilitates structured problem-solving by breaking down complex issues into sequential steps, supporting revisions, and enabling multiple solution paths through full MCP integration.

Featured
Python
Nefino MCP Server

Nefino MCP Server

Provides large language models with access to news and information about renewable energy projects in Germany, allowing filtering by location, topic (solar, wind, hydrogen), and date range.

Official
Python
Vectorize

Vectorize

Vectorize MCP server for advanced retrieval, Private Deep Research, Anything-to-Markdown file extraction and text chunking.

Official
JavaScript
Mathematica Documentation MCP server

Mathematica Documentation MCP server

A server that provides access to Mathematica documentation through FastMCP, enabling users to retrieve function documentation and list package symbols from Wolfram Mathematica.

Local
Python
kb-mcp-server

kb-mcp-server

An MCP server aimed to be portable, local, easy and convenient to support semantic/graph based retrieval of txtai "all in one" embeddings database. Any txtai embeddings db in tar.gz form can be loaded

Local
Python
Research MCP Server

Research MCP Server

The server functions as an MCP server to interact with Notion for retrieving and creating survey data, integrating with the Claude Desktop Client for conducting and reviewing surveys.

Local
Python