@staticpayload/gemini-mcp

@staticpayload/gemini-mcp

Bridges Google's Gemini CLI to MCP-compatible AI assistants, enabling prompt execution, model listing, and raw CLI commands.

Category
访问服务器

README

<p align="center"> <img src="https://img.shields.io/badge/MCP-Protocol-7c3aed?style=for-the-badge&logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZmlsbD0id2hpdGUiIGQ9Ik0xMiAyQzYuNDggMiAyIDYuNDggMiAxMnM0LjQ4IDEwIDEwIDEwIDEwLTQuNDggMTAtMTBTMTcuNTIgMiAxMiAyem0wIDE4Yy00LjQxIDAtOC0zLjU5LTgtOHMzLjU5LTggOC04IDggMy41OSA4IDgtMy41OSA4LTggOHoiLz48L3N2Zz4=" alt="MCP Protocol"> <img src="https://img.shields.io/badge/Google-Gemini-4285F4?style=for-the-badge&logo=google&logoColor=white" alt="Google Gemini"> <img src="https://img.shields.io/badge/Node.js-20+-339933?style=for-the-badge&logo=node.js&logoColor=white" alt="Node.js 20+"> <img src="https://img.shields.io/badge/License-GPL--3.0-blue?style=for-the-badge" alt="GPL-3.0 License"> </p>

<h1 align="center"> <br> ✦ @staticpayload/gemini-mcp <br> </h1>

<h4 align="center"> Bridge Google's Gemini CLI to any MCP-compatible AI assistant </h4>

<p align="center"> <a href="#-quick-start">Quick Start</a> • <a href="#-tools">Tools</a> • <a href="#-usage">Usage</a> • <a href="#-configuration">Configuration</a> • <a href="#-autonomous-setup">Autonomous Setup</a> • <a href="#-how-it-works">How It Works</a> </p>

<br>

<div align="center">

┌─────────────────────────────────────────────────────────────────┐
│                                                                 │
│   Claude / Cursor / Any MCP Client                              │
│                    │                                            │
│                    ▼                                            │
│   ┌─────────────────────────────────────┐                       │
│   │     @staticpayload/gemini-mcp       │                       │
│   │   ┌─────────┐ ┌─────────┐ ┌───────┐ │                       │
│   │   │ prompt  │ │ models  │ │  raw  │ │   ◄── MCP Tools       │
│   │   └────┬────┘ └────┬────┘ └───┬───┘ │                       │
│   └────────┼───────────┼─────────┼──────┘                       │
│            │           │         │                              │
│            └───────────┼─────────┘                              │
│                        ▼                                        │
│            ┌───────────────────────┐                            │
│            │    Gemini CLI         │   ◄── Your existing auth   │
│            │    (gemini binary)    │       & configuration      │
│            └───────────────────────┘                            │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘

</div>

<br>


✨ Features

<table> <tr> <td width="50%">

🔌 Zero Configuration

Uses your existing Gemini CLI installation and authentication. No API keys to manage, no duplicate auth flows.

🚀 Universal Access

Register once, use Gemini from Claude, Cursor, Windsurf, or any MCP-compatible client.

</td> <td width="50%">

⚡ Production Ready

Health checks, graceful shutdown, 5-minute timeouts, proper signal handling. Built for reliability.

🛠️ Three Powerful Tools

Prompt execution, model listing, and raw CLI access for advanced use cases.

</td> </tr> </table>


🚀 Quick Start

Prerequisites

# Install Gemini CLI globally
npm install -g @google/gemini-cli

# Authenticate (run once)
gemini

Run the MCP Server

npx @staticpayload/gemini-mcp

That's it. The server starts and waits for MCP connections via stdio.


🔧 Tools

gemini_prompt

Send a prompt to Gemini and get a response.

Parameter Type Required Description
prompt string The prompt to send
model string Model override (e.g., gemini-2.5-flash)

gemini_models

List all available Gemini models.

No parameters required.

gemini_raw

Execute any Gemini CLI command with raw arguments.

Parameter Type Required Description
args string[] CLI arguments array

Example: ["--version"] or ["-p", "Hello", "-m", "gemini-2.5-pro"]


📋 Usage

With Claude Desktop

Add to your Claude configuration (~/.claude/config.json):

{
  "mcpServers": {
    "gemini": {
      "command": "npx",
      "args": ["@staticpayload/gemini-mcp"]
    }
  }
}

With Claude CLI

claude mcp add gemini -- npx @staticpayload/gemini-mcp

With Cursor / Windsurf

Add to your MCP settings:

{
  "gemini": {
    "command": "npx",
    "args": ["@staticpayload/gemini-mcp"]
  }
}

⚙️ Configuration

Environment Variables

Variable Description
GEMINI_CLI_PATH Override the Gemini binary location
GEMINI_API_KEY Gemini API key (if not using OAuth)
GOOGLE_APPLICATION_CREDENTIALS Service account credentials path

Inherited Configuration

The server inherits your full environment, so existing Gemini configuration works automatically:

~/.config/gemini/          ← CLI configuration
~/.gemini/settings.json    ← Gemini settings
GEMINI_* env vars          ← All Gemini environment variables
gcloud auth                ← Application default credentials

🤖 Autonomous Setup

For production deployments with Vertex AI authentication and zero interactive prompts, use the automated setup:

# 1. Copy environment template
cp .env.example .env

# 2. Edit .env with your GCP project
# PROJECT_ID=your-gcp-project-id

# 3. Authenticate with gcloud
gcloud auth application-default login

# 4. Run automated setup
./setup-gemini.sh

# 5. Use Gemini autonomously
./run-gemini.sh

Features:

  • ✅ Vertex AI authentication (no API keys)
  • ✅ No permission prompts for file/shell/web operations
  • ✅ GA/Preview model routing
  • ✅ MCP server integration
  • ✅ Sandbox directory (avoids macOS permission issues)

See GEMINI_SETUP.md for complete documentation.



🔬 How It Works

┌──────────────┐     stdio      ┌─────────────────┐     spawn     ┌─────────────┐
│  MCP Client  │ ◄────────────► │  gemini-cli-mcp │ ◄───────────► │ gemini CLI  │
│  (Claude)    │   JSON-RPC     │    (Node.js)    │   child proc  │  (binary)   │
└──────────────┘                └─────────────────┘               └─────────────┘
  1. MCP Client sends JSON-RPC requests over stdio
  2. gemini-cli-mcp translates MCP tool calls to Gemini CLI commands
  3. Gemini CLI executes with your existing auth & config
  4. Response flows back through the same path

The server is a thin translation layer—all heavy lifting happens in Gemini CLI.


🏗️ Architecture

@staticpayload/gemini-mcp/
├── src/
│   └── index.js      # MCP server (single file, ~300 lines)
├── package.json      # npm package with bin entry
└── README.md

Design Principles:

  • Single responsibility: translate MCP ↔ Gemini CLI
  • Zero global state
  • Fail fast with clear errors
  • Minimal dependencies (@modelcontextprotocol/sdk, zod)

🐛 Troubleshooting

"Gemini CLI not found"

# Ensure gemini is installed and in PATH
which gemini

# Or set the path explicitly
export GEMINI_CLI_PATH=/path/to/gemini

"Auth method not set"

# Option 1: Run Gemini CLI once to authenticate
gemini

# Option 2: Set API key
export GEMINI_API_KEY=your-api-key

Server not responding

Check stderr output for health check results:

[gemini-mcp] Gemini CLI: /usr/local/bin/gemini (0.22.4)

📄 License

GPL-3.0 © 2025


<p align="center"> <sub>Built with lazyness for fun</sub> </p>

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选