gemini mcp连接
一个连接Claude Code的插件 克劳德 到 谷歌双子座 作为原生MCP工具,支持双AI代码审查、计划验证、安全审计和关键的第二意见分析。
  
______________________________________________________________________
运作原理
在修改任何文件之前,Claude会自动将其计划或代码提交给Gemini进行关键的独立审查——逻辑缺陷、安全问题、错误假设、优化。只有在整合了双子座的反馈后,克劳德才会应用这些更改。
双子座像 原生MCP工具,而不是bash脚本。克劳德直接调用它,就像它使用任何其他工具一样。
______________________________________________________________________
安装
一个衬垫(不需要克隆)
macOS/Linux:
curl -fsSL https://raw.githubusercontent.com/StealthyLabsHQ/gemini-mcp-connect/main/install.sh | bashWindows(PowerShell):
irm https://raw.githubusercontent.com/StealthyLabsHQ/gemini-mcp-connect/main/install.ps1 | iex两个脚本都提示您输入Gemini API密钥。获取免费钥匙 aistudio.google.com/apikey.
如果在安装过程中跳过密钥,请稍后使用激活 /gemini:activate YOUR_KEY 克劳德密码。
______________________________________________________________________
仅限MCP(无斜线命令)
claude mcp add --scope user gemini-mcp-connect -e GEMINI_API_KEY=your_key_here -- uvx gemini-mcp-connect______________________________________________________________________
从克隆
macOS/Linux:
git clone https://github.com/StealthyLabsHQ/gemini-mcp-connect
cd gemini-mcp-connect
bash install.shWindows(PowerShell):
git clone https://github.com/StealthyLabsHQ/gemini-mcp-connect
cd gemini-mcp-connect
.\install.ps1______________________________________________________________________
斜杠命令
| 命令 | 描述 |
|---|---|
| `/gemini:model |
|使用所选层查询Gemini| | /gemini:review |关键代码审查(关键/警告/建议)| | /gemini:validate |执行前验证计划(继续/修订/不继续)| | /gemini:security |安全审计-OWASP Top 10,秘密,注入| | /gemini:debug |诊断错误或堆栈跟踪-根本原因+修复| | /gemini:config [setting] [value] |查看或更新设置(思维、温度、媒体等)| | /gemini:status |今日剩余API配额| | /gemini:activate ` |设置Gemini API密钥(无需重新启动)|
/双子座:模型示例
/gemini:model flash what is the difference between TCP and UDP?
/gemini:model pro review this architecture for scalability issues
/gemini:model lite quick summary of this file/gemini:配置示例
/gemini:config → show all current settings
/gemini:config thinking high → set thinking level to HIGH
/gemini:config thinking off → disable thinking (faster)
/gemini:config temperature 0.5 → more deterministic responses
/gemini:config media high → higher media resolution
/gemini:config tokens 32768 → limit output length______________________________________________________________________
层前缀(最快方式)
以以下方式开始任何消息 pro,, flash, 或 lite, 为该任务选择Gemini模型:
pro, refactor this code
flash, search for information on X
lite, quick look at my code无前缀→ pro 默认情况下。
______________________________________________________________________
MCP工具
Claude本机调用这些工具,不需要bash命令。
| 工具 | 默认层 | 描述 |
|---|---|---|
query_gemini(prompt, tier) | pro | 双子座的开放式问题 |
review_code(code, language, tier) | flash | 关键代码审查 |
validate_plan(plan, tier) | pro | 执行前验证计划 |
security_audit(code, language, tier) | pro | 安全审计(OWASP、机密、注入) |
debug_error(error, context, tier) | flash | 诊断错误和堆栈跟踪 |
configure_gemini(setting, value) | - | 查看/更新配置设置 |
activate_gemini(api_key) | - | 在不重新启动的情况下设置API密钥 |
gemini_status() | - | 今天的剩余配额 |
______________________________________________________________________
模型
| 级别 | 型号 | 最适合 |
|---|---|---|
lite | gemini-3.1-flash-lite-preview | 快速检查,快速且便宜 |
flash | gemini-3-flash-preview | 代码审查,速度均衡 |
pro | gemini-3.1-pro-preview | 架构、安全、深度推理(默认) |
______________________________________________________________________
定价
| 级别 | 成本/请求\* | 请求1美元 |
|---|---|---|
lite | ~$0.002 | ~500 |
flash | ~$0.004 | ~250 |
pro | ~$0.016 | ~62 |
\*假设每个请求约2K个输入令牌+约1K个输出令牌。
这 pro 等级限制为 100个请求/天 默认情况下(最高1.60美元/天)。 flash 和 lite 是无限的。
______________________________________________________________________
配置
通过管理 /gemini:config 或者通过设置环境变量(claude mcp add -e).
| 设置 | 变量 | 默认值 | 值 |
|---|---|---|---|
thinking | GEMINI_THINKING_LEVEL | HIGH | OFF / LOW / MEDIUM / HIGH |
temperature | GEMINI_TEMPERATURE | 1.0 | 0.0 – 2.0 |
media | GEMINI_MEDIA_RESOLUTION | MEDIUM | LOW / MEDIUM / HIGH |
tokens | GEMINI_MAX_OUTPUT_TOKENS | 65536 | 1 – 65536 |
top_p | GEMINI_TOP_P | 0.95 | 0.0 – 1.0 |
______________________________________________________________________
插件结构
gemini-mcp-connect/
├── gemini_bridge_mcp.py # MCP server (main entry point)
├── gemini_bridge/ # Python package (CLI + shared core)
├── commands/
│ └── gemini/ # Slash commands
│ ├── model.md # /gemini:model
│ ├── review.md # /gemini:review
│ ├── validate.md # /gemini:validate
│ ├── security.md # /gemini:security
│ ├── debug.md # /gemini:debug
│ ├── config.md # /gemini:config
│ ├── status.md # /gemini:status
│ └── activate.md # /gemini:activate
├── install.sh # macOS/Linux installer
├── install.ps1 # Windows installer
└── pyproject.toml # PyPI packaging______________________________________________________________________
许可证
麻省理工学院- StealtyLabsHQ
