
Gemini
STDIOMCP server integrating Google's Gemini models with Claude Code for AI collaboration
MCP server integrating Google's Gemini models with Claude Code for AI collaboration
A Model Context Protocol (MCP) server for integrating Google's Gemini models with Claude Code, enabling powerful collaboration between both AI systems.
Claude Code uses the Model Context Protocol (MCP) to connect with external tools and data sources. This MCP server allows Claude to access Gemini's capabilities directly within your Claude Code environment.
The easiest way to add Gemini to Claude Code is with a one-line command:
# Replace YOUR_GEMINI_API_KEY with your actual Google Gemini API key claude mcp add gemini -s user -- env GEMINI_API_KEY=YOUR_GEMINI_API_KEY npx -y https://github.com/rlabs-inc/gemini-mcp.git
You can also include verbosity options:
# For verbose logging claude mcp add gemini -s user -- env GEMINI_API_KEY=YOUR_GEMINI_API_KEY VERBOSE=true npx -y https://github.com/rlabs-inc/gemini-mcp.git # For quiet mode claude mcp add gemini -s user -- env GEMINI_API_KEY=YOUR_GEMINI_API_KEY QUIET=true npx -y https://github.com/rlabs-inc/gemini-mcp.gitp
If you prefer a manual setup:
First, make sure you have Node.js installed, then install the server globally:
Launch Claude Code in your terminal:
claude
Once in Claude Code, use the /mcp add
command to add the Gemini server:
/mcp add
When prompted, provide this configuration:
{ "gemini": { "command": "npx", "args": ["-y", "https://github.com/rlabs-inc/gemini-mcp.git"], "env": { "GEMINI_API_KEY": "your-gemini-api-key" } } }
Verify that the server was added successfully:
/mcp list
Then enable the Gemini server for your current session:
/mcp use gemini
After enabling the Gemini server, you can access Gemini's capabilities through MCP tools:
When you enable the Gemini server with /mcp use gemini
, you can call the tools directly:
/gemini-query What is quantum computing?
/gemini-brainstorm How could we implement a real-time collaboration feature?
/gemini-analyze-code python performance
For a more seamless experience, you can create custom slash commands to access Gemini's tools. This makes them easier to use and remember.
Create a commands directory in your project:
mkdir -p .claude/commands
Then create markdown files for each command:
Ask Gemini: $ARGUMENTS
/gemini-analyze-code general $ARGUMENTS
/gemini-brainstorm $ARGUMENTS
/gemini-summarize brief paragraph $ARGUMENTS
Now you can use these simple commands in Claude Code:
/project:gemini How does quantum computing work?
/project:analyze def fibonacci(n): return 1 if n <= 1 else fibonacci(n-1) + fibonacci(n-2)
/project:brainstorm How can we improve our CI/CD pipeline?
/project:summarize [Paste long text here]
You can also create personal commands that work across all your projects:
mkdir -p ~/.claude/commands
Example personal command for Gemini code reviews (~/.claude/commands/review.md):
/gemini-analyze-code $ARGUMENTS
Then use it with:
/user:review security [Your code here]
Here are examples of using each Gemini tool:
/gemini-query What is quantum computing?
Start a brainstorming session:
/gemini-brainstorm How could we implement a real-time collaboration feature?
Continue the brainstorming session with your input:
/gemini-brainstorm round:2 claudeInput:"I think we should use WebSockets for real-time updates. What about handling offline mode?"
Create a final synthesis after several rounds:
/gemini-brainstorm-synthesis prompt:"Real-time collaboration feature implementation" history:[...]
/gemini-analyze-code python performance
def fibonacci(n):
if n <= 1:
return n
else:
return fibonacci(n-1) + fibonacci(n-2)
/gemini-analyze-text sentiment
The product launch exceeded our expectations with positive customer feedback,
though we noticed some performance issues under heavy load.
/gemini-summarize brief bullet-points
[Paste long content here]
/gemini-image-prompt minimalist calm
A modern workspace overlooking a peaceful garden
Here's an example of how to use Claude and Gemini together for solving problems:
Initial analysis with Claude:
claude
> analyze the performance issue in our authentication service
Get Gemini's perspective:
/project:gemini What could cause authentication service bottlenecks?
Generate solution with Claude:
> Based on your analysis and Gemini's input, create a plan to fix these issues
Refine with Gemini's insights:
/project:analyze
[Paste the proposed solution here]
Implement the solution with Claude:
> Please implement the solution we developed
The MCP server supports these command line options:
gemini-mcp [options] Options: -v, --verbose Enable verbose logging (shows all prompts and responses) -q, --quiet Run in quiet mode (minimal logging) -h, --help Show this help message
GEMINI_API_KEY
(required): Your Google Gemini API keyGEMINI_MODEL
(optional): Default Gemini model (default: "gemini-2.5-pro-latest")GEMINI_PRO_MODEL
(optional): Specify Pro model variant (default: "gemini-2.5-pro")GEMINI_FLASH_MODEL
(optional): Specify Flash model variant (default: "gemini-2.5-flash")For the best experience, we recommend this setup for your project:
Install the MCP server globally for your team to use
Create a .claude
directory in your project:
mkdir -p .claude/commands
Add custom slash commands for common Gemini operations:
# Create the commands echo "/gemini-query \$ARGUMENTS" > .claude/commands/gemini.md echo "/gemini-analyze-code general\n\n\$ARGUMENTS" > .claude/commands/analyze.md echo "/gemini-brainstorm \$ARGUMENTS" > .claude/commands/brainstorm.md echo "/gemini-summarize brief paragraph\n\n\$ARGUMENTS" > .claude/commands/summarize.md
Create a project-specific CLAUDE.md with Gemini usage instructions:
# Gemini Integration This project has Gemini integration enabled through MCP. Use these commands: - `/project:gemini [question]` - Ask Gemini a question - `/project:analyze [code]` - Analyze code with Gemini - `/project:brainstorm [topic]` - Start a brainstorming session - `/project:summarize [text]` - Summarize text with Gemini
Commit these files to your repository so your entire team can use them
If Claude can't connect to the Gemini MCP server:
npm list -g @rlabs/gemini-mcp
gemini-mcp -v
If your custom slash commands aren't working:
.claude/commands/
directory exists.md
extensionIf tools aren't working as expected:
/mcp list
/mcp use gemini
# Clone the repository git clone https://github.com/rlabs-inc/gemini-mcp.git cd gemini-mcp # Install dependencies npm install # Build the project npm run build # Run in development mode npm run dev # Run with verbose logging npm run dev -- --verbose
MIT License