Get the FREE Ultimate OpenClaw Setup Guide →

mcp -gemini

MCP server implementation for Google's Gemini API

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio aliargun-mcp-server-gemini npx -y github:aliargun/mcp-server-gemini \
  --env GEMINI_API_KEY="your_api_key_here"

How to use

The Gemini MCP Server exposes Google's Gemini 2.5 capabilities through the MCP standard, enabling you to drive text generation, image analysis, embeddings, and more directly from your preferred MCP client. It supports a built-in self-documenting help system and offers a JSON mode for structured outputs, grounding with live data, and optional system instructions. With tools such as thinking (advanced reasoning), image analysis, token counting, model listing, and embeddings, you can perform complex tasks entirely through natural language prompts routed via MCP.

To use it, configure your MCP client (for example Claude Desktop, Cursor, or Windsurf) to launch the Gemini MCP server via npx and supply your Gemini API key as an environment variable. Once connected, you can issue prompts like “Use Gemini to explain quantum computing,” “Analyze this image with Gemini,” or “List all Gemini models,” and Gemini will respond with the appropriate results. Advanced usage supports JSON mode for structured responses, grounding for research, and memory/context features to maintain conversation history across interactions.

How to install

Prerequisites:

  • Node.js and npm installed on your system
  • An active Gemini API key (GEMINI_API_KEY)

Step-by-step installation:

  1. Install the MCP server using npm via npx (no local install required):

    • npx -y github:aliargun/mcp-server-gemini
  2. Prepare environment variables:

    • Create or copy the environment file and set GEMINI_API_KEY to your key
    • Example:
      • cp .env.example .env
      • edit .env to add GEMINI_API_KEY=your_api_key_here
  3. Start the server in development or production mode as appropriate:

    • You can run via npm scripts if provided by the repository, or directly execute the server command provided by your MCP client setup. For development, follow the repository's Local Development guidance:
  4. Connect an MCP client:

    • Configure your MCP client to use the npx command with the Gemini package and provide GEMINI_API_KEY in the environment settings as shown in the client-specific instructions (Claude Desktop, Cursor, Windsurf, etc.).

Additional notes

Tips and notes:

  • The server uses the Gemini API key via environment variables (GEMINI_API_KEY). Do not hard-code keys in code or committed configs.
  • Typical MCP client configurations use type: stdio with command: npx and args: [-y, github:aliargun/mcp-server-gemini].
  • If you encounter connection issues, restart the MCP client and verify the GEMINI_API_KEY has the necessary permissions.
  • Refer to the included documentation sections (Usage Guide, Parameters Reference, Quick Reference, Enhanced Features) for detailed parameter-level guidance.
  • Common environment considerations: ensure network access to Gemini services and that your MCP client is properly configured to spawn the server process on startup.
  • When upgrading Gemini models, check for compatibility notes in the Enhanced Features / Documentation sections and update the model references accordingly.

Related MCP Servers

Sponsor this space

Reach thousands of developers