home / mcp / gemini cli mcp server
MCP server for Gemini CLI code analysis and review
Configuration
View docs{
"mcpServers": {
"artegy-gemini-cli-mcp": {
"command": "node",
"args": [
"/Users/ryangould/Dev/gemini-cli-mcp/dist/server.js"
],
"env": {
"ENV": "YOUR_ENV"
}
}
}
}This MCP server lets you run Gemini CLI and Claude Code analyses inside a self-contained MCP endpoint. You can build, start, and configure it to provide comprehensive codebase reviews and targeted analyses, all orchestrated through Claude Code and code2prompt for efficient context handling and security-aware authentication.
You access the Gemini CLI MCP Server through Claude Code or your MCP client by running the local MCP server that integrates Gemini CLI with Claude Code. Use the provided tools to perform a full codebase architectural review or targeted analysis of specific files or folders. Start the server, then invoke the available MCP tools from Claude Codeβs tool interface or through your MCP client. When you request an analysis, you can specify the working directory for your project and, for targeted analysis, the exact paths you want examined.
Prerequisites you must have installed before you begin.
# 1) Node.js 18+ (for running the MCP server)
# 2) Gemini CLI
# 3) code2prompt
# 4) Claude CodeStep by step commands to set up the MCP server. Run these in sequence on your development machine.
# 1. Install Gemini CLI
npm install -g @google/gemini-cli
gemini
# Follow OAuth setup prompts# 2. Install code2prompt
# macOS/Linux with Homebrew
brew install mufeedvh/tap/code2prompt
# Or build from source
cargo install code2prompt# 3. Install MCP Server Dependencies
cd /Users/ryangould/Dev/gemini-cli-mcp
npm installBuild and run the MCP server, then configure it in Claude Code.
# 1. Build the MCP Server
npm run build# 2. Start the MCP server (production run)
npm startConfigure Claude Code to load the MCP server. Place the following MCP settings entry to register the Gemini CLI MCP Server as a local stdio service.
{
"mcpServers": {
"gemini_cli_mcp": {
"command": "node",
"args": [
"/Users/ryangould/Dev/gemini-cli-mcp/dist/server.js"
],
"env": {}
}
}
}If you encounter issues, check common problems and how to resolve them. Ensure Gemini CLI is installed and accessible, verify code2prompt is installed, and re-authenticate with Gemini CLI if necessary. If the MCP server cannot connect, verify the Claude Code MCP settings, confirm the server path, inspect console logs, and restart Claude Code after changes.
Logging is done to stderr. Run the development command to observe logs in real time.
npm run devThis server uses your existing Gemini CLI OAuth authentication and does not store API keys. Content from your codebase is analyzed by Gemini for insights. Be mindful of data sensitivity and adjust exclusions if needed.
Default exclusions for the comprehensive review include common patterns such as node_modules, .git, logs, build outputs, and coverage folders. You can tailor exclusions via the excludePatterns parameter when running analyses.
Performs a complete codebase architectural review using Gemini CLI across the specified working directory, with optional exclusion patterns.
Analyzes specific files or folders with focused insights, allowing an analysis context to be provided for additional guidance.