Gemini

io.github.PavelGuzenfeld由 GitHub 账号 PavelGuzenfeld 发布v0.1.2更新于 Oct 24, 2026

MCP server that exposes Google Gemini as tools for Claude Code

已验证STDIO仅桌面开发者工具AI 与机器学习

概览

AI 生成的概览

本地 MCP 服务器,把 Google Gemini 模型封装为工具,让助手可以提问、分析代码并进行多轮对话。

可以做什么
  • 向 Gemini 提问或交给它一项任务
  • 按指定指令把代码或文本发送给 Gemini 分析
  • 进行带完整历史记录的多轮对话
  • 列出可用的 Gemini 模型,并按单次调用覆盖模型
适用场景
适合需要另一个模型给出第二意见、对代码或长文本做大上下文分析、从不同视角做代码审查,或在不离开助手的情况下快速总结日志的场景。
运行要求
以本地 Node.js 进程运行,可通过克隆仓库或 npx 安装。需要 Google AI Studio 的 API 密钥,通过 GEMINI_API_KEY 环境变量提供;可选的 GEMINI_MODEL 变量用于设置默认模型。需要能访问 Google 的生成式语言 API。
安装前请注意
API 密钥以明文形式写在客户端配置中,请妥善保管该文件。发送给工具的问题、代码和文本会作为第三方数据传给 Google 的 Gemini API。使用可能受 Google 的配额与计费条款约束。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Gemini,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

gemini-mcp

[npm] [MCP Registry] [Node.js] [License: MIT]

Lightweight MCP server that exposes Google Gemini as tools for Claude Code (or any MCP client).

Use Gemini for second opinions, large-context analysis, code review, or anything where a different model perspective helps.

Tools

ToolDescription
gemini_askAsk Gemini a question or give it a task
gemini_analyzeSend code/text for analysis with a specific instruction
gemini_chatMulti-turn conversation with full history
gemini_modelsList available Gemini models

Quick Start

1. Get an API key

Go to Google AI Studio and create a free API key.

2. Install

Option A — Clone (recommended for Claude Code)

bash
git clone https://github.com/PavelGuzenfeld/gemini-mcp.git ~/.claude/mcp-servers/geminicd ~/.claude/mcp-servers/gemininpm install

Option B — npx (no install)

bash
npx claude-gemini-mcp

3. Register with Claude Code

Add to ~/.claude/settings.json:

json
{  "mcpServers": {    "gemini": {      "command": "node",      "args": ["/home/you/.claude/mcp-servers/gemini/index.js"],      "env": {        "GEMINI_API_KEY": "your-key-here"      }    }  }}

Or with npx:

json
{  "mcpServers": {    "gemini": {      "command": "npx",      "args": ["-y", "claude-gemini-mcp"],      "env": {        "GEMINI_API_KEY": "your-key-here"      }    }  }}

Usage Examples

Ask a question

> Use gemini_ask to explain the difference between std::expected and std::optional
Gemini says: std::optional<T> represents a value that may or may not be present...std::expected<T, E> additionally carries an error value when the expected value is absent...

Analyze code

> Use gemini_analyze to review this function for performance issues:  instruction: "Find performance bottlenecks"  content: <your code here>
Gemini says: Line 12 allocates inside the loop — move the vector outside...

Multi-turn conversation

> Use gemini_chat with messages:  [{"role": "user", "content": "Design a REST API for a task manager"},   {"role": "model", "content": "Here's a RESTful design..."},   {"role": "user", "content": "Now add authentication"}]
Gemini says: Building on the previous design, add JWT-based auth...

Override model per call

> Use gemini_ask with model: "gemini-2.5-flash" to quickly summarize this error log

Environment Variables

VariableDefaultDescription
GEMINI_API_KEY(required)Google AI Studio API key
GEMINI_MODELgemini-2.5-proDefault model for all tools

Models

ModelBest for
gemini-2.5-proBest quality, large context (1M tokens)
gemini-2.5-flashFast, good for most tasks
gemini-2.0-flashFastest, simple tasks

Every tool accepts an optional model parameter to override the default per-call.

Features

  • Retry with exponential backoff on rate limits (429) and server errors (5xx)
  • Graceful error reporting back to the MCP client (no crashes)
  • Per-call model override
  • Zero configuration beyond the API key

Troubleshooting

ProblemSolution
GEMINI_API_KEY is not setAdd the key to your env block in settings.json
429 Too Many RequestsBuilt-in retry handles this — wait a few seconds
Model not foundRun gemini_models to list valid model names
Tools not appearing in Claude CodeCheck ~/.claude/settings.json syntax, restart Claude Code
ECONNREFUSEDCheck network/firewall — the server calls generativelanguage.googleapis.com

Development

bash
git clone https://github.com/PavelGuzenfeld/gemini-mcp.gitcd gemini-mcpnpm installnpm test          # Run smoke testsnode index.js     # Start the MCP server locally

License

MIT

来源:README.md,提交 5532298

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.1.2最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分