Seamless integration of Claude Code CLI + Gemini CLI for context-aware code reasoning
npm install claudegemSeamless integration of Claude Code CLI + Gemini CLI for context-aware code reasoning with MCP (Model Context Protocol) support.
š Enhanced with MCP Server - Now includes a powerful MCP server that provides Claude Code with internet search, AI fallbacks, and enhanced command execution capabilities from any directory!
ollama pull llama3.2 and ollama pull mistral (for fallback support)``bash`
npm install -g claudegem
`bash`
npm install claudegem
Start Claude Code with the ClaudeGem MCP server for enhanced capabilities:
`bashStart from ANY directory - works globally!
claudegem --mcp
In the Claude Code session, you'll have access to:
#### š Internet Search
`
Search the internet for "latest React 18 features"
Find current Node.js security best practices
Look up recent AI developments 2024
`#### ā” AI-Enhanced Commands
`
Use bash_with_gemini to run: ls -la && git status
Execute this command with AI assistance: npm install --save react
`#### š Code Analysis with Fallbacks
`
Analyze this React component with AI assistance
Review this Python function for potential issues
`$3
The MCP server works seamlessly across different folders:
`bash
Web Development Project
cd ~/projects/my-react-app
claudegem --mcp
Now Claude Code has context of your React project + internet search
Python Data Science Project
cd ~/data-science/ml-project
claudegem --mcp
Now Claude Code understands your Python environment + can search for ML docs
DevOps/Infrastructure
cd ~/infrastructure/kubernetes
claudegem --mcp
Claude Code can help with K8s configs + search for latest practices
Documentation Writing
cd ~/documentation/api-docs
claudegem --mcp
Get writing help + search for current API documentation standards
`$3
`bash
claudegem "your query here"
`$3
`bash
Use Claude with specific flags
claudegem "analyze this code" --claude-flags="--debug"Skip Gemini context gathering
claudegem "simple query" --skip-geminiUse different Gemini model
claudegem "complex analysis" --gemini-model="gemini-2.5-flash"
`$3
When Gemini API quota is exhausted, claudegem automatically switches to free local alternatives:
1. Llama 3.2 (via Ollama) - Fast fallback (~3-7 seconds)
2. Mistral Devstral Medium (via Ollama) - Specialized coding fallback
`bash
Fallbacks work automatically in both modes:
claudegem "query" --fallback="llama,mistral"
claudegem --mcp # Fallbacks also work in MCP modeClear terminal messaging when switching:
šØ GEMINI API QUOTA EXHAUSTED - Switching to free alternatives...
š¦ Using Llama as fallback due to Gemini quota exhaustion
š® Using Mistral as fallback due to Gemini quota exhaustion
`šÆ Benefits of ClaudeGem MCP
$3
- Current Information: Access real-time web data beyond AI training cutoffs
- Cross-Directory Support: Use from any folder without setup
- Multiple AI Models: Automatic fallback ensures continuous availability
- Privacy-Focused: DuckDuckGo search with no tracking
- Fast Responses: 3-5 seconds for web search, 3-7 seconds for local AI fallbacks$3
- Stay Current: Get latest documentation, frameworks, and best practices
- Cost Effective: Free local fallbacks when API quotas exhausted
- No Vendor Lock-in: Works with multiple AI providers
- Enhanced Productivity: AI-assisted command execution and analysis
- Global Access: Works from any directory or project$3
- Latest Tech Info: "What's new in React 19?", "Latest Node.js security patches"
- Documentation Search: Find current API docs, tutorials, examples
- Troubleshooting: Search for recent solutions to specific errors
- Trend Analysis: Discover emerging tools and frameworks
- Code Context: AI understands your project + can search for related info$3
- No API Keys for Search: Uses DuckDuckGo without requiring accounts
- Local AI Fallbacks: Llama/Mistral run locally (no data sent to external APIs)
- Secure Command Execution: Protected against injection vulnerabilities
- Privacy-First: DuckDuckGo doesn't track or store search historyš Real-World Use Cases
$3
`bash
cd ~/my-react-app
claudegem --mcpIn Claude Code session:
"Search for latest React 18 performance best practices"
"What are the new features in Next.js 14?"
"Find current CSS-in-JS library recommendations"
"Look up recent TypeScript 5.0 changes"
`$3
`bash
cd ~/ml-project
claudegem --mcpIn Claude Code session:
"Search for latest scikit-learn 2024 updates"
"Find current PyTorch best practices for transformers"
"Look up recent pandas performance improvements"
"What are the latest Python security vulnerabilities?"
`$3
`bash
cd ~/infrastructure
claudegem --mcpIn Claude Code session:
"Search for Kubernetes 1.28 new features"
"Find current Docker security best practices 2024"
"Look up latest Terraform provider updates"
"What are recent AWS service announcements?"
`$3
`bash
cd ~/mobile-app
claudegem --mcpIn Claude Code session:
"Search for React Native 0.73 breaking changes"
"Find current iOS 17 development guidelines"
"Look up latest Flutter 3.16 features"
"What are recent Android development best practices?"
`š MCP Tools Available
When using
claudegem --mcp, Claude Code gets access to these enhanced tools:$3
`
Search the internet for "latest JavaScript frameworks 2024"
Find documentation for "Supabase real-time subscriptions"
Look up "Node.js 20 breaking changes"
`$3
`
Use bash_with_gemini to run: git log --oneline -10
Execute with AI help: npm audit fix
Run system check: df -h && free -m
`$3
`
Analyze this React component for performance issues
Review this SQL query for optimization opportunities
Check this Python function for potential bugs
`š” Quick Examples
$3
`bash
Enhanced mode with internet search + AI fallbacks
claudegem --mcp
`$3
`bash
Basic analysis with context
claudegem "What files are in this project?"Code explanation with tools
claudegem "Explain how authentication works" --claude-flags="--tools"Direct Claude usage (no Gemini context)
claudegem "Simple question" --skip-geminiFast processing with Gemini Flash
claudegem "Quick code review" --gemini-model="gemini-2.5-flash"
`How It Works
1. Dependency Check: Verifies both Claude and Gemini CLIs are available
2. Context Gathering: Gemini analyzes your codebase and identifies relevant files
3. Context Enhancement: Filters and cleans Gemini's output
4. Query Processing: Sends enhanced query with context to Claude
5. Result Delivery: Returns Claude's context-aware response
Configuration
$3
- Gemini: gemini-2.5-pro model with debug output
- Claude: --print flag for text output$3
- --claude-flags: Pass any Claude CLI flags (e.g., --tools, --memory, --interactive)
- --skip-gemini: Skip Gemini context gathering for faster processing
- --gemini-model: Choose Gemini model (gemini-2.5-pro, gemini-2.5-flash, etc.)$3
- Text output: --print (default and recommended)
- Debug mode: --debug
- JSON output: --output-format json
- Continue session: --continue
- Resume session: --resume
- Model selection: --model
- Tool restrictions: --allowedTools, --disallowedTools`1. CLI Not Found: Ensure both Claude and Gemini CLIs are installed and in your PATH
2. Permission Errors: Make sure the CLI tools have proper permissions
3. Timeout Issues: Complex queries may take up to 30 seconds
Both CLIs run with verbose output for debugging. Check the terminal output for detailed execution steps.
1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Submit a pull request
MIT License - see LICENSE file for details.