Gemini CLI
About
Integrates with the unofficial Google Gemini CLI, allowing file access within configured directories.
Details
- Author
- diversioteam
- Categories
- Developer Tools, AI, File Management
Jump to
Setup
Install Gemini CLI in your MCP client (Claude Desktop, Cursor, Windsurf, and others).
Repository: https://github.com/diversioteam/gemini-cli-mcp
Follow the installation instructions in the repository README, then restart your MCP client.
2. Gemini CLI Installation and Authentication
This MCP server requires the Gemini CLI to be installed and authenticated:
- Install Gemini CLI: Follow the official installation instructions for your platform
- Authenticate: Rungemini auth loginand follow the prompts
- Verify: Test that it works by runninggemini -p "Hello, world!"
If you see an authentication error, make sure you've completed the login process.
You'll need an MCP-compatible client such as:
- Claude Desktop
- Other MCP-compatible AI assistants
Before running the server, verify your setup:
# Check if everything is configured correctly gemini-mcp setup
- Gemini CLI installation
- Authentication status
- Environment configuration
# Method 1: Run from current directory (for development) uv run gemini-mcp # Method 2: Run using uvx from GitHub uvx --from git+https://github.com/DiversioTeam/gemini-cli-mcp gemini-mcp # Method 3: Run if installed globally gemini-mcp # With debug logging LOG_LEVEL=DEBUG gemini-mcp
# Install from GitHub (use -- separator for proper argument parsing) claude mcp add gemini uvx -- --from git+https://github.com/DiversioTeam/gemini-cli-mcp.git gemini-mcp # Or install from PyPI when published claude mcp add gemini uvx -- gemini-mcp
Add this to~/.config/claude-code/mcp-settings.json:
{ "servers": { "gemini": { "command": "uvx", "args": ](#prerequisites)["--from", "git+https://github.com/DiversioTeam/gemini-cli-mcp.git", "gemini-mcp"] } } }
Add this to your Claude Desktop configuration:
macOS:~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:%APPDATA%\Claude\claude_desktop_config.jsonLinux:~/.config/claude/claude_desktop_config.json
{ "mcpServers": { "gemini": { "command": "uvx", "args": ["--from", "git+https://github.com/DiversioTeam/gemini-cli-mcp.git", "gemini-mcp"], "env": { "LOG_LEVEL": "INFO" } } } }
- prompt(required): The prompt to send
- model(optional): The Gemini model to use (default: gemini-2.5-pro)
- context(optional): Additional context to prepend to the prompt
Research a topic with optional file context.
- topic(required): The research topic or question
- files(optional): List of file paths to include as context
- model(optional): The Gemini model to use
Analyze code files for various purposes.
- files(required): List of code files to analyze
- analysis_type(required): Type of analysis - one of:
- review: Code review for issues and improvements
- explain: Detailed explanation of the code
- optimize: Performance and maintainability suggestions
- security: Security vulnerability analysis
- test: Test case suggestions
- content(optional): Text content to summarize
- files(optional): Files to summarize (alternative to content)
- summary_type(optional): Type of summary - one of:
- brief: 2-3 sentence summary (default)
- detailed: Comprehensive summary
- bullet_points: Bullet point format
- executive: Executive summary for decision makers
Note: Eithercontentorfilesmust be provided.
This MCP server implements several security measures:
- Sandboxed file access: By default, file access is restricted to the current working directory
- Path validation: All file paths are validated to prevent directory traversal attacks
- Configurable allowed directories: You can specify allowed directories via:
- Constructor parameter:GeminiMCPServer(allowed_directories=["/path/to/safe/dir"])
- Environment variable:GEMINI_MCP_ALLOWED_DIRS=/path1:/path2:/path3
- All user inputs are properly sanitized before being passed to the CLI
- Command injection is prevented by using subprocess with argument lists (never shell=True)
- File paths are resolved and validated before use
- Always run the server with minimal required permissions
- Regularly update both the MCP server and Gemini CLI
- Monitor logs for any suspicious activity
git clone https://github.com/DiversioTeam/gemini-cli-mcp.git cd gemini-cli-mcp
You can add the server for local testing with Claude Code CLI:
# Method 1: Add from local directory (for development) claude mcp add gemini-local -- uv run gemini-mcp # Method 2: Add from PyPI (when published) claude mcp add gemini uvx -- gemini-mcp # Method 3: Add from GitHub (development version) claude mcp add gemini uvx -- --from git+https://github.com/DiversioTeam/gemini-cli-mcp.git gemini-mcp # Then you can test the functionality immediately # Example: Send prompts, research topics, analyze code, etc.
# Run all tests with coverage uv run pytest # Run specific test file uv run pytest tests/test_tools.py # Run with verbose output uv run pytest -v
# Run linting uv run ruff check . # Run formatting uv run ruff format . # Run type checking uv run mypy src/ # Run security checks uv run ruff check --select S .
Run the setup check to diagnose common issues:
-
"Gemini CLI not found in PATH"
- Ensure Gemini CLI is installed:which gemini
- Add Gemini to your PATH if needed
- Follow the installation guide for your platform
- The server will detect if you're not authenticated
- Rungemini auth loginto authenticate
- Check if your credentials have expired
- The error message will guide you on what to do
- Check that files are within allowed directories
- Use absolute paths or ensure relative paths are correct
- SetGEMINI_MCP_ALLOWED_DIRSfor custom directories
- Rungemini-mcp setupto check your installation
- Ensure you've installed the package:uv pip install -e .
Enable debug logging to see detailed information:
- Fork the repository
- Create a feature branch (git checkout -b feature/amazing-feature)
- Make your changes and add tests
- Ensure all tests pass and code quality checks succeed
- Commit your changes (git commit -m 'Add amazing feature')
- Push to the branch (git push origin feature/amazing-feature)
- Open a Pull Request
This project is licensed under the MIT License - see theLICENSEfile for details.
- Built on top of theModel Context Protocol
- Integrates with Google's Gemini CLI (unofficial integration)
- Inspired by the MCP ecosystem and community
This is a web browser that enables your coding agent, such as Claude Code, to visit websites on your behalf and assist you in identifying bugs or creating UI test cases.
An MCP server that integrates with Ollama to provide tools for file operations, calculations, and text processing. Requires a running Ollama instance.
next-devtools-mcp is a MCP server that provides Next.js development tools and utilities for AI coding assistants like Claude and Cursor.
Word search, crossword, and sudoku generator MCP server with printable PDF worksheets, themed word banks, and verifiable LLM evals. Local-first, from the makers of puzzletide.com.
A demonstration server for ActionKit, providing access to Slack actions via Claude Desktop.
MCP server that lets Claude Code agents delegate tasks to agents in other project directories, with parallel dispatch, sessions, and async jobs.
Statistical regression testing for LLM agents: p-value, effect size, and CI on behavior change.
A Python MCP package that gives your LLM agents complete file system and shell capabilities — production-ready, sandboxed, and wired to any LLM in minutes.
AI-powered code quality analysis to detect best practice violations, security issues, and architectural problems in real-time.
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.




