Provides access to Google's Gemini AI models (2.5 Pro, 2.5 Flash, 2.0 Flash, and Embedding-001) with support for file uploads, multi-turn conversations, batch processing at reduced cost, and embedding generation for various tasks like search, classification, and clustering.
Gemini MCP Server
An MCP Server that provides access to Google's Gemini models with file uploads and Batch API integration.
โจ Features
Multiple Gemini Models on Request: Gemini 2.5 Pro, 2.5 Flash, 2.0 Flash, and Embedding-001
๐ Batch API Integration (v0.3.0): Async processing at 50% cost with ~24hr turnaround
11 batch tools for content generation and embeddings
Intelligent JSONL conversion (CSV, JSON, TXT, MD)
Complete workflow automation
8 embedding task types with AI recommendations
Advanced File Handling: Upload and process 40+ files with batch support
Automatic Configuration: Interactive API key setup for Claude Code & Claude Desktop
Conversation Management: Multi-turn conversations with history tracking
Type Safety: Full TypeScript implementation with proper type definitions
Production Ready: Retry logic, error handling, and file state monitoring
๐ Quick Start
Option 1: Global Install (Recommended for Claude Code)
Option 2: Local Project Install
After any installation method, restart Claude Code and you're ready to use Gemini.
๐ API Key Setup
Get Your API Key
Visit Google AI Studio
Create a new API key (free)
Copy your key (starts with "AIza...")
Configure Anytime
The configuration wizard will:
Validate your API key format
Test the key with a real Gemini API request
Write configuration to your chosen location(s)
Provide next steps
๐ฆ What Gets Configured
Claude Code (Global Install)
File:
~/.claude.json(user scope)Format: stdio MCP server with environment variables
Claude Code (Local Install)
File:
.mcp.json(project scope)Format: stdio MCP server with node execution
Claude Desktop
File:
~/Library/Application Support/Claude/claude_desktop_config.json(macOS)Format: Standard MCP server configuration
Shell Environment
File:
~/.zshrcor~/.bashrcFormat:
export GEMINI_API_KEY="your-key-here"
Usage
MCP Tools
The server provides the following tools:
chat
Send a message to Gemini with optional file attachments.
Parameters:
message(required): The message to sendmodel(optional): Model to use (gemini-2.5-pro, gemini-2.5-flash, gemini-2.5-flash-lite)files(optional): Array of files with base64 encoded datatemperature(optional): Controls randomness (0.0-2.0)maxTokens(optional): Maximum response tokensconversationId(optional): Continue an existing conversation
start_conversation
Start a new conversation session.
Parameters:
id(optional): Custom conversation ID
clear_conversation
Clear a conversation session.
Parameters:
id(required): Conversation ID to clear
๐ Batch API Tools (v0.3.0)
Process large-scale tasks asynchronously at 50% cost with ~24 hour turnaround.
Content Generation
Simple (Automated):
Advanced (Manual Control):
Embeddings
Simple (Automated):
Advanced (Manual Control):
Task Types (8 options):
SEMANTIC_SIMILARITY- Compare text similarityCLASSIFICATION- Categorize contentCLUSTERING- Group similar itemsRETRIEVAL_DOCUMENT- Build search indexesRETRIEVAL_QUERY- Search queriesCODE_RETRIEVAL_QUERY- Code searchQUESTION_ANSWERING- Q&A systemsFACT_VERIFICATION- Fact-checking
Job Management
Supported Input Formats:
CSV (converts rows to requests)
JSON (wraps objects as requests)
TXT (splits lines as requests)
MD (markdown sections as requests)
JSONL (ready to use)
MCP Resources
gemini://models/available
Information about available Gemini models and their capabilities.
gemini://conversations/active
List of active conversation sessions with metadata.
๐ง Development
Connection Failures
If Claude Code fails to connect:
Verify your API key is correct
Check that the command path is correct (for local installs)
Restart Claude Code after configuration changes
๐ Security
API keys are never logged or echoed
Files created with 600 permissions (user read/write only)
Masked input during key entry
Real API validation before storage
๐ค Contributing
Contributions are welcome! This package is designed to be production-ready with:
Full TypeScript types
Comprehensive error handling
Automatic retry logic
Real API validation
๐ License
MIT - see LICENSE file
๐ Support
MCP Protocol: https://modelcontextprotocol.io
Gemini API Docs: https://ai.google.dev/docs
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Tools
Enables interaction with Google's Gemini AI models including file uploads, conversation management, and batch API processing for large-scale tasks at reduced costs. Supports multiple Gemini models with advanced features like embeddings generation and automated workflow processing.