Gemini MCP Server
by taehun-kmu
README.md
# Gemini MCP Server
MCP (Model Context Protocol) Server with Google Gemini CLI integration for AI second opinions and validation in development workflows.
## Features
- š¤ **AI Second Opinions**: Get alternative perspectives from Google's Gemini AI
- š **Automatic Uncertainty Detection**: Triggers consultations when uncertainty is detected
- ā” **Rate Limiting**: Built-in rate limiting to prevent API abuse
- š”ļø **Configurable Models**: Support for different Gemini models
- š **Consultation Logging**: Track all AI consultations with timestamps
## Quick Start
### Using uvx (Recommended)
Run directly without installation:
```bash
# Run in current directory
uvx gemini-mcp-server
# Run with specific project root
uvx gemini-mcp-server --project-root /path/to/project
```
### Local Development
```bash
# Clone the repository
git clone https://github.com/taehun-kmu/gemini-mcp-server
cd gemini-mcp-server
# Install with uv
uv pip install -e .
# Run the server
gemini-mcp-server
```
## Prerequisites
1. **Node.js 18+** - Required for Gemini CLI
2. **Python 3.8+** - Required for MCP server
3. **Gemini CLI** - Install and authenticate:
```bash
# Install Gemini CLI
npm install -g @google/gemini-cli
# Authenticate (run once)
gemini
```
## Configuration
Create a `gemini-config.json` file in your project root:
```json
{
"enabled": true,
"auto_consult": true,
"cli_command": "gemini",
"timeout": 60,
"rate_limit_delay": 2.0,
"model": "gemini-2.5-flash",
"log_consultations": true
}
```
### Environment Variables
Override configuration with environment variables:
- `GEMINI_ENABLED`: Enable/disable integration
- `GEMINI_AUTO_CONSULT`: Enable/disable automatic consultation
- `GEMINI_CLI_COMMAND`: CLI command (default: "gemini")
- `GEMINI_TIMEOUT`: Command timeout in seconds
- `GEMINI_RATE_LIMIT`: Delay between consultations
- `GEMINI_MODEL`: Model to use (default: "gemini-2.5-flash")
## MCP Tools
The server exposes three MCP tools:
1. **consult_gemini**: Get second opinions from Gemini
- `query`: The question or topic
- `context`: Additional context
- `comparison_mode`: Request structured comparison format
2. **gemini_status**: Check integration status and statistics
3. **toggle_gemini_auto_consult**: Enable/disable automatic consultation
- `enable`: true/false or omit to toggle
## Claude Code Integration
Configure Claude Code to use this MCP server by adding to your MCP configuration:
```json
{
"mcpServers": {
"gemini": {
"command": "uvx",
"args": ["gemini-mcp-server"],
"env": {
"GEMINI_ENABLED": "true"
}
}
}
}
```
Note: Add `"--project-root", "/path/to/project"` to args if you need to specify a different project directory.
## Development
### Project Structure
```
gemini-mcp-server/
āāā gemini_mcp/
ā āāā __init__.py
ā āāā __main__.py # CLI entry point
ā āāā gemini_integration.py # Gemini integration logic
ā āāā server.py # MCP server implementation
āāā pyproject.toml # Package configuration
āāā README.md # This file
āāā LICENSE # MIT License
āāā setup-gemini-integration.sh # Setup script
āāā gemini-config.json # Example configuration
```
### Running Tests
```bash
# Install dev dependencies
uv pip install -e ".[dev]"
# Run tests
pytest
# Format code
ruff format gemini_mcp
ruff check gemini_mcp
```
## License
MIT License - see LICENSE file for details.
This server cannot be deployed
Maintenance
ActivityInactive
ResponsivenessNo recent community issues