gemini-cli-mcp-server
A MCP server wrapper for Google's Gemini CLI that enables AI assistants to perform searches, have conversations, list sessions, and analyze files using Gemini's capabilities.
README
Gemini CLI MCP Server
šÆšµ ę„ę¬čŖ
A simple MCP server wrapper for Google's Gemini CLI that enables AI assistants to use Gemini's capabilities through the Model Context Protocol.
⨠Features
- 4 Tools:
googleSearch,chat,listSessions,analyzeFile - Session Persistence: Resume previous conversations with session IDs (supports custom IDs)
- Internationalization: English and Japanese support
- Cross-Platform: Windows, macOS, and Linux compatible
š Quick Setup
With Claude Code
claude mcp add -s project gemini-cli -- npx gemini-cli-mcp-server --allow-npx
Manual Configuration
{
"mcpServers": {
"gemini-cli-mcp-server": {
"command": "npx",
"args": ["gemini-cli-mcp-server", "--allow-npx"]
}
}
}
š ļø Available Tools
googleSearch
Performs a Google search using Gemini CLI.
| Parameter | Required | Description |
|---|---|---|
query |
ā | The search query |
limit |
Maximum number of results | |
raw |
Return structured results with URLs | |
model |
Gemini model (default: gemini-2.5-pro) |
chat
Have a conversation with Gemini.
| Parameter | Required | Description |
|---|---|---|
prompt |
ā | The conversation prompt |
sessionId |
Resume a previous session (supports custom IDs like "my-task") | |
model |
Gemini model (default: gemini-2.5-pro) |
listSessions
Lists available Gemini CLI sessions. Returns session IDs that can be used with chat's sessionId parameter.
analyzeFile
Analyze files using Gemini's multimodal capabilities.
| Parameter | Required | Description |
|---|---|---|
filePath |
ā | Absolute path to the file |
prompt |
Additional analysis instructions | |
sessionId |
Resume a previous session (maintains context) | |
model |
Gemini model (default: gemini-2.5-pro) |
Supported file types:
- Images: PNG, JPG, JPEG, GIF, WEBP, SVG, BMP
- Text: TXT, MD
- Documents: PDF
š¾ Session Management
You can use Custom Session IDs (Client IDs) to manage conversations. The server automatically maps these to Gemini CLI's internal session IDs.
{
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"name": "chat",
"arguments": {
"prompt": "Hello!",
"sessionId": "my-task-1"
}
},
"id": 1
}
- Persistence: Mappings are stored in memory. They will be reset if the MCP server restarts (Gemini's internal history remains, but the link to your custom ID is lost).
- Listing: Use
listSessionsto see active mappings.
š Language Settings
Tool descriptions and error messages support multiple languages:
# Japanese
MCP_LANGUAGE=ja npx gemini-cli-mcp-server --allow-npx
# English (default)
MCP_LANGUAGE=en npx gemini-cli-mcp-server --allow-npx
System locale (e.g., LANG=ja_JP.UTF-8) is also auto-detected.
š Development
# Clone and install
git clone https://github.com/Cinnamobot/gemini-cli-mcp-server
cd gemini-cli-mcp-server
bun install
# Run tests
bun test
# Build
bun run build
š Credits
This project is based on choplin/mcp-gemini-cli.
Additions from fork
- listSessions tool: List available Gemini CLI sessions
- Session persistence: Resume conversations with
sessionIdparameter - Internationalization: Japanese/English support
- Windows compatibility: Custom
findExecutablefunction (nowhich/wheredependency) - CI/CD: GitHub Actions for automated testing and building
š License
MIT License - see LICENSE file for details.
š Related Links
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.