Content

<div align="center">
**Seamless Collaboration Between Claude Code and Gemini CLI**
[](https://opensource.org/licenses/MIT) [](https://www.python.org/downloads/) [](https://modelcontextprotocol.io) [](https://x.com/intent/tweet?text=GeminiMCP:让%20Claude%20Code%20与%20Gemini%20无缝协作%20https://github.com/GuDaStudio/geminimcp%20%23AI%20%23Coding%20%23MCP) [](https://www.facebook.com/sharer/sharer.php?u=https://github.com/GuDaStudio/geminimcp) [](https://www.reddit.com/submit?title=GeminiMCP:让%20Claude%20Code%20与%20Gemini%20无缝协作&url=https://github.com/GuDaStudio/geminimcp) [](https://t.me/share/url?url=https://github.com/GuDaStudio/geminimcp&text=GeminiMCP:让%20Claude%20Code%20与%20Gemini%20无缝协作)
⭐ Star us on GitHub~ Your support means a lot to us! 🙏😊
[English](./docs/README_EN.md) | 简体中文
</div>
---
## 0. Example of results
**1.** This evaluation uses **exactly the same** prompt. The effects of using / not using this project are shown below. As you can see, the front-end webpage using Gemini-MCP is significantly better than the version using only claude code for front-end coding in terms of aesthetic layout and animation effects.
<details>
<summary>Click to view prompt details.</summary>
```
Design an extremely beautiful weather card for ultra-high-definition large-screen poster display.
Overall atmosphere: Deep winter snow scene, Chinese ink painting artistic conception, the picture should have the poetic meaning of "stillness" and "distance", as if you can hear the sound of snow falling at a glance.
Background: The distant view is a continuous mountain range, using the brushstrokes of Chinese ink landscape painting, layered, virtual and real, with a sense of atmospheric perspective; there is a thin mist and clouds lingering in the mountains, and several pine trees or a small pavilion can be vaguely seen, adding oriental charm and a sense of story.
Color tone: Mainly cold cyan blue, ink gray, and pale, with a little warm light or vermilion seal dotted locally, so that the picture has a little human touch in the cold.
Weather card body:
As the main body of the picture, the layout is slightly to the middle right or slightly to the left, and the size is suitable for large-screen reading, leaving enough breathing space and blank space.
Not a frosted glass style, avoid glass state, frosted glass, and strong blur effects.
Use a more advanced card texture: similar to rice paper, fine frosted metal or warm jade, with soft highlights and subtle shadows on one side, and the edges are slightly decorated with traditional Chinese window grilles, moiré patterns or fine line outlines, the overall is minimalist and clean.
Information typesetting is restrained and rhythmic: the city name and current temperature can use Chinese fonts with the temperament of running script/regular script or elegant English fonts that match it, and small-sized text is used for dates, weather descriptions, and air quality, etc., and the Chinese and English mixed arrangement is natural and coordinated.
Snowflake effect (WebGL):
Snowflakes are not simple particle points, but exquisite snowflakes created with WebGL: with a hexagonal symmetrical crystal structure, delicate edges, and shimmering reflections.
Snowflakes are divided into foreground, middle ground, and distant view multiple layers of depth, and the size, transparency, and sharpness change with distance, creating a strong sense of space.
The falling trajectory has slight rotation and swing, with slow acceleration and slight random wind direction changes, and the overall movement is elegant and restrained, without being obtrusive.
Some snowflakes skim the edge of the weather card, forming a slight occlusion relationship, strengthening the immersion of "the card in the snow".
Style requirements:
Overall Chinese style modern integration: ink landscape + minimalist UI design.
The picture has high resolution and is suitable for 16:9 large-screen posters.
The composition emphasizes white space and balance, and is full of oriental charm and the tranquility of the passage of time.
Reflect the "highest level" of fineness, texture and atmosphere, rather than ordinary interface screenshots.
```
</details>
**2.** **Using Gemini-MCP** in Claude Code, you can preview it online via [this link](https://codepen.io/Studio-Guda/full/yyOpBVZ)!
https://github.com/user-attachments/assets/1996980b-da6a-43cf-8c02-6c008f54ed18
**3.** Using only Claude Code, you can preview it online via [this link](https://codepen.io/Studio-Guda/full/ogxpvGY)!
https://github.com/user-attachments/assets/18d59123-e972-410e-824a-7462d3d95dd5
---
## 1. Project Introduction
**Gemini-MCP** is an MCP server that encapsulates Google's Gemini CLI tool into a standard MCP protocol interface, allowing Claude Code to call Gemini to perform AI-assisted programming tasks.
🍟 This project provides [prompts](#2-configure-claude-code-prompts-optional) around **Gemini's powerful front-end design** capabilities to enrich your usage scenarios. We highly recommend that you configure it!
---
## 2. Quick Start
### 0. Prerequisites
- Installed and configured [Claude Code](https://docs.claude.com/docs/claude-code)
- Installed and configured [Gemini CLI](https://github.com/google-gemini/gemini-cli)
- Installed [uv tool](https://docs.astral.sh/uv/getting-started/installation/)
**uv Installation method:**
Windows (PowerShell):
```powershell
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
```
Linux/macOS:
```bash
curl -LsSf https://astral.sh/uv/install.sh | sh
```
> **Note: It is highly recommended that Windows users run this project in WSL!**
### 1. Installation Steps
**1.1** Install GeminiMCP
```bash
claude mcp add gemini -s user --transport stdio -- uvx --from git+https://github.com/GuDaStudio/geminimcp.git geminimcp
```
**1.2** Verify Installation
```bash
claude mcp list
```
> Seeing `gemini: ... - ✓ Connected` indicates successful installation
**1.3** Optional: Configure Auto-Allow
Add `mcp__gemini__gemini` to the allow item in `~/.claude/settings.json`

### 2. Configure claude code prompts (optional)
In order to enable claude code to better complete the collaborative work with gemini, we **strongly recommend that you add the following content to `~/.claude/CLAUDE.md`**
<details>
<summary>Expand to view prompt</summary>
```
## Core Instruction for Gemini MCP
在任何时刻,你必须思考当前过程可以如何与 gemini 进行协作,如何调用 gemini 为你提供的MCP工具作为你**客观全面分析**的保障。
其中你**务必执行**以下几个步骤:
**1** 在你对用户需求**形成初步分析后**,
(1)首先将用户**原始需求(一字不差,严禁转述)**、以及你的初始思路告知gemini;
(2)与gemini进行**充分讨论、辩驳**,以完善需求分析和实施计划。这一步的结束标志为,**必须**确保对用户需求的透彻理解,并**生成切实可行的行动计划**。
**2** 在实施具体编码任务前,你**必须向gemini索要代码实现原型**(要求gemini仅给出unified diff patch,严禁对代码做任何真实修改)。在获取代码原型后,你**只能以此为逻辑参考,再次对代码修改进行重写**,形成企业生产级别、可读性极高、可维护性极高的代码后,才能实施具体编程修改任务。
- **注意:** Gemini 十分擅长前端代码,并精通样式、UI组件设计。在涉及前端代码时,你必须向其索要代码原型(CSS/React/Vue/HTML等前端代码),任何时刻,你**必须以gemini的前端设计(原型代码)为最终的前端代码基点**。
- 例如,当你识别到用户给出了前端设计需求,你的首要行为必须自动调整为,将用户需求原封不动转发给gemini,并让其出具代码示例(此阶段严禁对用户需求进行任何改动、简写等等)。即你必须从gemini获取代码基点,才可以进行接下来的各种行为。
## Gemini Tool Invocation Specification
1. 工具概述
gemini MCP 提供了一个工具 `gemini`,用于调用 Google Gemini 模型执行 AI 任务。该工具拥有极强的前端审美、任务规划与需求理解能力,但在**上下文长度(Effective 32k)**上有限制。
2. 使用方式与规范
**必须遵守的限制**:
- **会话管理**:捕获返回的 `SESSION_ID` 用于多轮对话。
- **后端避让**:严禁让 Gemini 编写复杂的后端业务逻辑代码。
**擅长场景(必须优先调用 Gemini)**:
- **需求清晰化**:在任务开始阶段辅助生成引导性问题。
- **任务规划**:生成 Step-by-step 的实施计划。
- **前端原型**:编写 CSS、HTML、UI 组件代码,调整样式风格。
```
</details>
---
## 3. Tool Description
<details>
<summary>Expand to view gemini tool details</summary>
### gemini Tool
| Parameter | Type | Required | Default Value | Description |
|------|------|------|--------|------|
| `PROMPT` | `str` | ✅ | - | Task instruction sent to Gemini |
| `sandbox` | `bool` | ❌ | `False` | Whether to enable sandbox mode |
| `SESSION_ID` | `str` | ❌ | `""` | Session ID (empty to start a new session) |
| `return_all_messages` | `bool` | ❌ | `False` | Whether to return the complete message history |
| `model` | `str` | ❌ | `""` | Specify the model (default uses Gemini CLI configuration) |
### Return Value Structure
**On success:**
```json
{
"success": true,
"SESSION_ID": "session-uuid",
"agent_messages": "Gemini's reply content..."
}
```
**When return_all_messages is enabled, it additionally includes:**
```json
{
"all_messages": [...]
}
```
**On failure:**
```json
{
"success": false,
"error": "Error message description"
}
```
</details>
---
## 4. FAQ
<details>
<summary>Q1: What is the difference between using Gemini CLI directly?</summary>
GeminiMCP encapsulates Gemini CLI as an MCP protocol, allowing Claude Code to call it programmatically, supporting session management and structured returns.
</details>
<details>
<summary>Q2: Will sessions conflict?</summary>
No. Each session uses an independent `SESSION_ID`, completely isolated.
</details>
---
## 🤝 Contribution Guide
```bash
# Clone the repository
git clone https://github.com/GuDaStudio/geminimcp.git
cd geminimcp
# Install dependencies
uv sync
```
---
## 📄 License
This project is licensed under the [MIT License](LICENSE).
Copyright (c) 2025 [guda.studio](mailto:gudaclaude@gmail.com)
---
<div align="center">
## Give this project a boost with a 🌟~
</div>
[](https://www.star-history.com/#GuDaStudio/geminimcp&type=date&legend=top-left)
Connection Info
You Might Also Like
markitdown
MarkItDown-MCP is a lightweight server for converting URIs to Markdown.
servers
Model Context Protocol Servers
Time
A Model Context Protocol server for time and timezone conversions.
Filesystem
Node.js MCP Server for filesystem operations with dynamic access control.
Sequential Thinking
A structured MCP server for dynamic problem-solving and reflective thinking.
git
A Model Context Protocol server for Git automation and interaction.