Get the FREE Ultimate OpenClaw Setup Guide →

mcp-gemini

MCP server from dakrin/mcp-gemini-server

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio dakrin-mcp-gemini-server node path/to/server.js \
  --env LOG_LEVEL="info" \
  --env GEMINI_API_KEY="Gemini 2.5 Pro API key" \
  --env GOOGLE_SEARCH_API_KEY="Google Custom Search API key (optional for grounding)"

How to use

This MCP server implements the Gemini MCP Server, enabling Claude Desktop to interact with Google Gemini 2.5 Pro Experimental through the MCP protocol. It exposes a set of tools that can be invoked via MCP requests, including content generation with Gemini and retrieving model information. The server securely manages API keys through environment variables and can optionally integrate Google Search grounding to improve results.

Available tools include:

  • generateWithGemini: Generate content using Google Gemini 2.5 Pro Experimental. You provide a prompt and optional parameters such as temperature, maxTokens, safeMode, and useSearch to influence generation and grounding behavior. Use this to produce iterative content, summaries, or creative text based on Gemini's capabilities.
  • getModelInfo: Retrieve information about the Gemini model currently in use, including model version, capabilities, and any pertinent metadata.

To use these tools, send MCP requests to the server with the appropriate tool name and parameters. Ensure your Gemini API key is supplied via environment variables when starting the server, and verify any optional grounding features (like Google Search) are configured if you plan to use them.

How to install

Prerequisites:

  • Node.js (v14+ or as required by the project) and npm/yarn installed
  • Git (optional, for cloning the repository)
  • An active Gemini 2.5 Pro API key

Installation steps:

  1. Clone the repository

    git clone https://github.com/your-org/dakrin-mcp-gemini-server.git
    cd dakrin-mcp-gemini-server
    
  2. Install dependencies

    npm install
    # or
    yarn install
    
  3. Configure environment variables Create a .env file or export variables in your environment:

    export GEMINI_API_KEY=your_gemini_api_key
    export GOOGLE_SEARCH_API_KEY=your_google_search_api_key (optional)
    export LOG_LEVEL=info
    

    Alternatively, set these in a .env file and load with a dotenv-compatible setup as per project configuration.

  4. Run the server

    node path/to/server.js
    # or use a process manager like pm2 or docker as appropriate
    
  5. (Optional) Run via npx if the package is published

    npx dakrin-mcp-gemini-server
    

Additional notes

Notes and tips:

  • Ensure GEMINI_API_KEY is kept secret; it should never be logged or exposed in responses.
  • The GOOGLE_SEARCH_API_KEY is optional and only required if you enable grounding via via the useSearch flag in generateWithGemini.
  • If you encounter connection issues, verify network access to Gemini services and validate that the API key is active.
  • The server supports full MCP protocol, including token usage reporting and secure handling of keys.
  • If you update environment variables, restart the server to apply changes.
  • For debugging, set LOG_LEVEL to debug to receive verbose logs.

Related MCP Servers

Sponsor this space

Reach thousands of developers