This Model Context Protocol (MCP) server integrates Gemini CLI with Claude Code, enabling comprehensive codebase analysis. It leverages Gemini's 1M token context window and code2prompt for efficient context extraction, providing both full-system architecture reviews and targeted component analysis.
npm install -g @google/gemini-cli
Authenticate with your Google account:
gemini
# Follow OAuth setup prompts
# macOS/Linux with Homebrew
brew install mufeedvh/tap/code2prompt
# Or build from source
cargo install code2prompt
cd /Users/ryangould/Dev/gemini-cli-mcp
npm install
npm run build
Add to your Claude Code MCP settings (usually ~/.config/claude-desktop/mcp_settings.json):
{
"mcpServers": {
"gemini-cli-mcp": {
"command": "node",
"args": [
"/Users/ryangould/Dev/gemini-cli-mcp/dist/server.js"
],
"env": {}
}
}
}
Restart Claude Code to load the new MCP server.
Performs a complete codebase architectural review using Gemini CLI.
Parameters:
Usage Example:
// Called by Claude Code sub-agent
gemini_comprehensive_review({
workingDir: "/path/to/your/project"
})
Analyzes specific files or folders with focused insights.
Parameters:
Usage Example:
// Called by Claude Code sub-agent
gemini_targeted_analysis({
workingDir: "/path/to/your/project",
targetPaths: ["src/api/", "src/controllers/auth.js"],
analysisContext: "Security review of authentication components"
})
The gemini-code-analyzer sub-agent is automatically available in Claude Code once the MCP server is configured.
Example Commands:
You can also call the MCP tools directly through Claude Code's tool interface:
Ensure Gemini CLI is installed and in your PATH:
gemini
# Follow OAuth setup prompts
Install code2prompt:
brew install mufeedvh/tap/code2prompt
Re-authenticate with Gemini CLI:
gemini
# Follow OAuth setup prompts
The MCP server logs to stderr. Monitor logs when running:
npm run dev
The comprehensive review automatically excludes common patterns:
Add custom exclusions via the excludePatterns parameter.
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "gemini-cli-mcp" '{"command":"node","args":["/Users/ryangould/Dev/gemini-cli-mcp/dist/server.js"],"env":[]}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:
{
"mcpServers": {
"gemini-cli-mcp": {
"command": "node",
"args": [
"/Users/ryangould/Dev/gemini-cli-mcp/dist/server.js"
],
"env": []
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.json~/.config/Claude/claude_desktop_config.json2. Add this to your configuration file:
{
"mcpServers": {
"gemini-cli-mcp": {
"command": "node",
"args": [
"/Users/ryangould/Dev/gemini-cli-mcp/dist/server.js"
],
"env": []
}
}
}
3. Restart Claude Desktop for the changes to take effect