home / mcp / gemini mcp server

Gemini MCP Server

MCP server implementation for Google's Gemini API

Installation
Add the following to your MCP client configuration file.

Configuration

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

You can run Gemini’s advanced AI models locally through MCP to empower your development workflow. This server exposes Gemini 2.5 capabilities — thinking, JSON mode, grounding, embeddings, and more — directly to your MCP clients, with a self-documenting interface and robust TypeScript support.

How to use

After you configure your MCP client to connect to the Gemini MCP Server, you can send natural language prompts to leverage Gemini 2.5 features. Use simple requests like asking for explanations, analyzing images, listing available Gemini models, or requesting help on how to utilize Gemini. You can also combine settings to enable thinking, JSON extraction, or grounding to research topics or review code.

How to install

Prerequisites: you need Node.js and npm installed on your system. You should also have a functioning MCP client installed and ready to connect to a local or remote MCP server.

Step 1: Clone the Gemini MCP Server source directory into your workspace.

Step 2: Install dependencies.

Step 3: Create and configure environment variables.

Step 4: Start the development server.

Additional content

Configuration notes and security guidelines help you keep your Gemini MCP Server running smoothly and securely. This server uses an MCP stdio configuration to integrate with your MCP clients. It requires an API key setup for Gemini access, supplied via environment variables.

Security best practices include keeping API keys out of version control, using environment variables for sensitive data, and ensuring your server is updated with the latest security patches.

Local development workflow includes cloning the repository, installing dependencies, configuring the environment, and launching the server to test MCP client interactions.

Troubleshooting

If you encounter connection issues, restart the MCP client, verify the API key, and check that the environment variable is set correctly. Review logs for any error messages and ensure network connectivity is stable.

Local development

# Clone repository
git clone https://github.com/aliargun/mcp-server-gemini.git
cd mcp-server-gemini

# Install dependencies
npm install

# Set up environment variables
cp .env.example .env
# Edit .env and add your GEMINI_API_KEY

# Start development server
npm run dev

Available tools

text generation

Generate natural language text, explanations, or drafts based on user prompts.

image analysis

Analyze and describe images or extract information from visual inputs.

token counting

Count tokens to estimate usage and plan prompts.

model listing

List available Gemini models and their capabilities.

embeddings

Generate vector embeddings for text or other inputs.

self-documenting

Provide built-in help and usage guidance within the MCP client.