Gemini MCP Server
Provides tools for interacting with Google's Gemini API, enabling chat, search, knowledge queries, content analysis, and generation using Gemini models.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Gemini MCP Serversearch for recent breakthroughs in renewable energy"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Gemini MCP Server
A Model Context Protocol (MCP) server that integrates Google's Gemini API with AI assistants like Claude Desktop, Kiro, Cursor, VS Code, and other MCP-compatible clients.
Features
Chat: Multi-turn conversations with Gemini models
Search: Real-time web search using Google Search integration
Knowledge: Query Gemini's knowledge base (training data)
Analyze: Analyze code, text, or data with AI-powered insights
Generate: Generate code, documentation, and creative content
Latest Models: Support for Gemini 3 preview models (gemini-3-pro-preview, gemini-3-flash-preview)
Related MCP server: Gemini MCP Server
Prerequisites
Node.js v20 or later
A Google Gemini API key (Get one here)
Installation
1. Clone or Download
git clone <your-repo-url>
cd gemini-mcp-server2. Install Dependencies
npm install
# or
pnpm install3. Get Your Gemini API Key
Visit Google AI Studio
Click "Create API Key" or "Get API Key"
Copy your API key for use in the configuration steps below
4. Find Your Repository Path
Before configuring MCP clients, you need to get the absolute path to your cloned repository. Run this command in your terminal:
pwdThis will output your current directory path. For example:
/Downloads/projects/gemini-mcp-serverCopy this path - you'll use it in the MCP client configurations below. Replace cloned_repo_location with this actual path in all configuration examples.
Integration with MCP Clients
Kiro
Add this to your Kiro MCP configuration file:
Location: ~/.kiro/settings/mcp.json (user-level) or .kiro/settings/mcp.json (workspace-level)
{
"mcpServers": {
"gemini": {
"command": "node",
"args": ["/cloned_repo_location/gemini-mcp-server/src/index.js"],
"env": {
"GEMINI_API_KEY": "your_api_key_here",
"GEMINI_MODEL": "gemini-2.5-flash"
},
"disabled": false,
"autoApprove": ["chat", "search", "analyze", "generate", "knowledge"]
}
}
}Note: Replace /cloned_repo_location/gemini-mcp-server with the actual path on your system. You can optionally set GEMINI_MODEL to use a different model (e.g., gemini-3-pro-preview).
After adding the configuration:
Open Kiro's MCP Server view in the feature panel
Click "Reconnect" on the gemini server, or restart Kiro
Claude Desktop
Add this to your Claude Desktop configuration file:
Location:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.jsonLinux:
~/.config/Claude/claude_desktop_config.json
{
"mcpServers": {
"gemini": {
"command": "node",
"args": ["/cloned_repo_location/gemini-mcp-server/src/index.js"],
"env": {
"GEMINI_API_KEY": "your_api_key_here",
"GEMINI_MODEL": "gemini-2.5-flash"
}
}
}
}After adding the configuration:
Restart Claude Desktop completely (quit and reopen)
Look for the 🔌 icon in the bottom right to verify the server is connected
You can now use Gemini tools in your conversations
Cursor
Add this to your Cursor MCP configuration file:
Location:
macOS:
~/Library/Application Support/Cursor/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.jsonWindows:
%APPDATA%\Cursor\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.jsonLinux:
~/.config/Cursor/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
{
"mcpServers": {
"gemini": {
"command": "node",
"args": ["/cloned_repo_location/gemini-mcp-server/src/index.js"],
"env": {
"GEMINI_API_KEY": "your_api_key_here",
"GEMINI_MODEL": "gemini-2.5-flash"
}
}
}
}After adding the configuration:
Restart Cursor
Open the Cline extension
The Gemini tools should now be available
VS Code (with Cline/Claude Dev Extension)
Add this to your VS Code MCP configuration file:
Location:
macOS:
~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.jsonWindows:
%APPDATA%\Code\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.jsonLinux:
~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
{
"mcpServers": {
"gemini": {
"command": "node",
"args": ["/cloned_repo_location/gemini-mcp-server/src/index.js"],
"env": {
"GEMINI_API_KEY": "your_api_key_here",
"GEMINI_MODEL": "gemini-2.5-flash"
}
}
}
}After adding the configuration:
Reload VS Code window (Cmd/Ctrl + Shift + P → "Developer: Reload Window")
Open the Cline/Claude Dev extension
The Gemini tools should now be available
Other MCP Clients
For any other MCP-compatible client, use the standard MCP server configuration format:
{
"mcpServers": {
"gemini": {
"command": "node",
"args": ["/cloned_repo_location/gemini-mcp-server/src/index.js"],
"env": {
"GEMINI_API_KEY": "your_api_key_here",
"GEMINI_MODEL": "gemini-2.5-flash"
}
}
}
}Refer to your specific client's documentation for the exact configuration file location. You can optionally set GEMINI_MODEL to use a different model.
Available Tools
chat
Send messages to Gemini with optional conversation history for multi-turn conversations.
Parameters:
message(string, required): The message to send to GeminiconversationHistory(array, optional): Previous messages in the conversationFormat:
[{role: "user"|"model", content: "message text"}]
Example:
{
"message": "What is React?",
"conversationHistory": [
{"role": "user", "content": "Hello!"},
{"role": "model", "content": "Hi! How can I help you today?"}
]
}search
Search for current information using real-time web search powered by Google Search.
Parameters:
query(string, required): The search query
Example:
{
"query": "What are the latest AI developments in 2025?"
}Note: This tool uses Google Search integration for real-time information. If web search is unavailable, it falls back to knowledge base with a warning.
knowledge
Query Gemini's knowledge base (training data) without web search.
Parameters:
query(string, required): The knowledge query
Example:
{
"query": "Explain the concept of machine learning"
}Note: This tool uses only Gemini's training data and doesn't access real-time information.
analyze
Analyze content with AI-powered insights.
Parameters:
content(string, required): The content to analyzeanalysisType(string, required): Type of analysisOptions:
code,text,data,general
Example:
{
"content": "function add(a, b) { return a + b; }",
"analysisType": "code"
}generate
Generate content based on a prompt.
Parameters:
prompt(string, required): The generation promptcontentType(string, required): Type of content to generateOptions:
code,documentation,creative,technical
Example:
{
"prompt": "Create a React component for a todo list",
"contentType": "code"
}Testing the Server
You can test the server directly using Node.js:
# Set your API key
export GEMINI_API_KEY="your_api_key_here"
# Run the server
node src/index.jsThe server will start and listen on stdio. You should see:
Gemini MCP Server running on stdioDevelopment
Run in watch mode for development:
npm run devThis will automatically restart the server when you make changes to the code.
Configuration Options
Model Selection
By default, the server uses gemini-2.5-flash. To use a different model, set the GEMINI_MODEL environment variable in your MCP configuration:
{
"mcpServers": {
"gemini": {
"command": "node",
"args": ["/path/to/gemini-mcp-server/src/index.js"],
"env": {
"GEMINI_API_KEY": "your_api_key_here",
"GEMINI_MODEL": "gemini-3-pro-preview"
}
}
}
}Available models:
Latest (Recommended)
gemini-3-pro-preview- Latest generation, most capable (preview)gemini-3-flash-preview- Latest generation, fast and efficient (preview)
Current Generation
gemini-2.5-flash- Fast and efficient (default)gemini-2.5-pro- More capable, slower
Previous Generation
gemini-1.5-pro- Previous generation, capablegemini-1.5-flash- Previous generation, fast
Note: Preview models (gemini-3-*) are experimental and may have breaking changes. Use production models for stable deployments.
Switching to Gemini 3 Models
To use the latest Gemini 3 preview models, simply set the GEMINI_MODEL environment variable in your MCP configuration:
{
"mcpServers": {
"gemini": {
"command": "node",
"args": ["/path/to/gemini-mcp-server/src/index.js"],
"env": {
"GEMINI_API_KEY": "your_api_key_here",
"GEMINI_MODEL": "gemini-3-pro-preview"
}
}
}
}Or for the fast variant:
{
"mcpServers": {
"gemini": {
"command": "node",
"args": ["/path/to/gemini-mcp-server/src/index.js"],
"env": {
"GEMINI_API_KEY": "your_api_key_here",
"GEMINI_MODEL": "gemini-3-flash-preview"
}
}
}
}No code changes needed - the server automatically uses the model specified in the environment variable!
Environment Variables
GEMINI_API_KEY(required): Your Google Gemini API keyGEMINI_MODEL(optional): The Gemini model to use (default:gemini-2.5-flash)Examples:
gemini-3-pro-preview,gemini-3-flash-preview,gemini-2.5-pro,gemini-1.5-pro
Troubleshooting
API Key Error
Error: Error: GEMINI_API_KEY environment variable is not set
Solution: Ensure your API key is properly set in the MCP configuration file under the env section.
Import Error
Error: SyntaxError: The requested module '@google/genai' does not provide an export named 'genai'
Solution: This has been fixed in the latest version. Make sure you're using the correct import:
import { GoogleGenAI } from "@google/genai";Connection Closed Error
Error: MCP error -32000: Connection closed
Solution:
Check that Node.js v20+ is installed:
node --versionVerify all dependencies are installed:
npm installCheck that the path in your MCP config is absolute and correct
Look at the server logs for more details
Server Not Showing Up
Solution:
Verify the configuration file path is correct for your client
Ensure the JSON syntax is valid (no trailing commas, proper quotes)
Restart your MCP client completely
Check the client's logs for error messages
Rate Limiting
If you encounter rate limiting errors from the Gemini API:
Check your API quota in Google AI Studio
Implement exponential backoff in your requests
Consider upgrading your API plan if needed
API Limits
Free tier limits (as of 2025):
15 requests per minute
1,500 requests per day
1 million tokens per minute
For higher limits, check Google AI Studio pricing.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT
Resources
Support
For issues and questions:
Open an issue on GitHub
Check the MCP documentation
Visit Google AI Studio for API-related questions
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Snehasis4321/gemini-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server