Gemini MCP Tool is a Model Context Protocol (MCP) server that enables AI assistants to interact with the Gemini CLI. This integration allows you to leverage Gemini's large token window for analyzing extensive files and codebases through Claude, using natural language commands with the @
syntax to reference files.
Before getting started, make sure you have:
Install the Gemini MCP Tool with a single command:
claude mcp add gemini-cli -- npx -y gemini-mcp-tool
After installation, type /mcp
inside Claude Code to verify the gemini-cli MCP is active.
If you already have the tool configured in Claude Desktop:
"gemini-cli": {
"command": "npx",
"args": ["-y", "gemini-mcp-tool"]
}
claude mcp add-from-claude-desktop
Add this configuration to your Claude Desktop config file:
{
"mcpServers": {
"gemini-cli": {
"command": "npx",
"args": ["-y", "gemini-mcp-tool"]
}
}
}
If you installed the tool globally, use this configuration instead:
{
"mcpServers": {
"gemini-cli": {
"command": "gemini-mcp"
}
}
}
Find your Claude Desktop config file at:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/claude/claude_desktop_config.json
Remember to restart your terminal session after updating the configuration.
You can interact with Gemini in natural language or use Claude Code's interface:
/gemini-cli
to see available commandsUse the @
syntax to reference files or directories:
ask gemini to analyze @src/main.js and explain what it does
use gemini to summarize @. the current directory
analyze @package.json and tell me about dependencies
Ask Gemini questions without file references:
ask gemini to search for the latest tech news
use gemini to explain div centering
ask gemini about best practices for React development related to @file_im_confused_about
Run code safely in Gemini's isolated environment:
use gemini sandbox to create and run a Python script that processes data
ask gemini to safely test @script.py and explain what it does
use gemini sandbox to install numpy and create a data visualization
ask-gemini: Get Gemini's perspective on questions or file analysis
@
file referencestrue
for safe code executionsandbox-test: Execute code safely in Gemini's sandbox
Ping: Test tool that echoes back messages
Help: Display Gemini CLI help information
/analyze: Analyze files or ask questions using Gemini
@
file references/sandbox: Test code in Gemini's safe environment
/help: View Gemini CLI help information
/ping: Test server connection
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "gemini-cli" '{"command":"npx","args":["-y","gemini-mcp-tool"]}'
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": {
"command": "npx",
"args": [
"-y",
"gemini-mcp-tool"
]
}
}
}
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.json
2. Add this to your configuration file:
{
"mcpServers": {
"gemini-cli": {
"command": "npx",
"args": [
"-y",
"gemini-mcp-tool"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect