# gemini-mcp-tool的windows版本
## 基本信息
- Slug: `orzcls-gemini-mcp-tool-windows`
- Source: modelscope
- Publisher: orzcls/gemini-mcp-tool-windows
- Categories: communication / developer-tools / search
- Hosted: Yes
- License: MIT License
- Source URL: https://www.modelscope.cn/mcp/servers/orzcls/gemini-mcp-tool-windows
## 简介
暂无描述。
## 安装提示

```bash
2. **[Google Gemini CLI](https://github.com/google-gemini/gemini-cli)** installed and **configured** ```powershell npm install -g @google/generative-ai-cli # Verify installation gemini --version
```

## MCP Server 详情

# 🚀 Gemini MCP Tool - Windows Fixed Version
这个 MCP 能让 AI 与Google Gemini CLI 进行交互。

通过利用 Gemini 的强大分析能力，这个工具可以处理大型文件和代码库，尤其适合需要大量上下文理解的场景。
[![npm version](https://badge.fury.io/js/gemini-mcp-tool-windows-fixed.svg)](https://badge.fury.io/js/gemini-mcp-tool-windows-fixed)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

> **Latest Version v1.0.21** - Fixed cross-terminal compatibility issues and fetch-chunk format errors

A **Windows-compatible** Model Context Protocol (MCP) server that enables AI assistants to interact with Google's Gemini CLI. This is a fixed version specifically designed to work seamlessly on Windows environments with PowerShell support.

> **Note**: This is an enhanced version of the [original gemini-mcp-tool](https://github.com/jamubc/gemini-mcp-tool) with Windows-specific fixes and improvements.

## 🆕 Latest Updates (v1.0.21)

- 🔧 **Fixed Cross-Terminal Compatibility** - Resolved Node.js path not found issues in different terminal environments
- 📦 **Fixed fetch-chunk Format Error** - Fixed MCP protocol format mismatch in chunked responses
- 🛡️ **Enhanced PATH Environment Variable Handling** - Automatically adds common Node.js installation paths
- ✅ **Full Compatibility with All Terminals** - Supports PowerShell, CMD, VS Code Terminal, Trae AI, CherryStudio, etc.
- 🚀 **Improved Error Handling** - Better error messages and debug output

### v1.0.3 Updates

- 🆕 **PowerShell Path Parameter Support** - Added optional `powershellPath` parameter allowing users to customize PowerShell executable path
- ✅ **Fixed PowerShell Execution Error** - Resolved `spawn powershell.exe ENOENT` issue
- ✅ **Improved Windows Compatibility** - Automatic detection of available PowerShell versions
- ✅ **Fixed Undefined Variable Error** - Fixed `args` variable issue in `executeCommandWithPipedInput` function
- ✅ **Enhanced Error Handling** - Better error messages and debug output
- ✅ **Backward Compatibility** - Existing configurations require no modification, automatically uses default detection logic

## ✨ Features

- **🪟 Windows Compatible**: Full PowerShell support with Windows-specific path handling
- **📊 Large Context Window**: Leverage Gemini's massive token window for analyzing entire codebases
- **📁 File Analysis**: Analyze files using `@filename` syntax
- **🔒 Sandbox Mode**: Safe code execution environment
- **🔗 MCP Integration**: Seamless integration with MCP-compatible AI assistants (Trae AI, Claude Desktop)
- **⚡ NPX Ready**: Easy installation and usage with NPX
- **🔧 Environment Variable Support**: Flexible API key configuration

This Windows-fixed version resolves:
- PowerShell parameter passing issues
- Character encoding problems with Chinese/Unicode text
- Command line argument escaping on Windows
- Environment variable handling
  
## 📋 Prerequisites

Before using this tool, ensure you have:

1. **[Node.js](https://nodejs.org/)** (v16.0.0 or higher)
   ```powershell
   node --version  # Should be v16+
   ```
2. **[Google Gemini CLI](https://github.com/google-gemini/gemini-cli)** installed and **configured**
   ```powershell
   npm install -g @google/generative-ai-cli
   
   # Verify installation
   gemini --version
   ```
3. **API Key**: Get your API key from [Google AI Studio](https://makersuite.google.com/app/apikey)

## 📦 Installation

### Quick Start with NPX (Recommended)

```powershell
# Use latest version (recommended)
npx gemini-mcp-tool-windows-fixed@1.0.21

# Or use latest version tag
npx -y gemini-mcp-tool-windows-fixed@latest
```

### Global Installation

```powershell
# Install latest version
npm install -g gemini-mcp-tool-windows-fixed@1.0.21

# Run the tool
gemini-mcp-tool-windows-fixed
```

### Updating Existing Installation

If you previously installed an older version:

```powershell
# Uninstall old version and install latest
npm uninstall -g gemini-mcp-tool-windows-fixed
npm cache clean --force
npm install -g gemini-mcp-tool-windows-fixed@1.0.21
```

## ⚙️ MCP Client Configuration

### Claude Code (One-Line Setup)

```bash
# One-command setup for Claude Code
claude mcp add gemini-cli -- npx -y gemini-mcp-tool-windows-fixed@1.0.21
```

**Verify Installation:**
Type `/mcp` inside Claude Code to verify the `gemini-cli` MCP is active. <mcreference link="https://github.com/jamubc/gemini-mcp-tool" index="1">1</mcreference>

### Alternative: Import from Claude Desktop
If you already have it configured in Claude Desktop:

1. Add to your Claude Desktop config (see below)
2. Import to Claude Code:
   ```bash
   claude mcp add-from-claude-desktop
   ```

### Trae AI (Recommended)

1. Open: `%APPDATA%\Trae\User\mcp.json`
2. Add this configuration:

```json
{
  "mcpServers": {
    "gemini-cli": {
      "name": "gemini-cli",
      "description": "Windows-compatible Gemini MCP Tool",
      "baseUrl": "",
      "command": "npx",
      "args": [
        "-y",
        "gemini-mcp-tool-windows-fixed@1.0.21"
      ],
      "env": {
        "GEMINI_API_KEY": "YOUR_ACTUAL_API_KEY_HERE"
      },
      "isActive": true,
      "providerUrl": "https://github.com/orzcls/gemini-mcp-tool-windows-fixed"
    }
  }
}
```

### Claude Desktop

1. Open: `%APPDATA%\Claude\claude_desktop_config.json`
2. Add this configuration:

```json
{
  "mcpServers": {
    "gemini-cli": {
      "command": "npx",
      "args": ["-y", "gemini-mcp-tool-windows-fixed@1.0.21"],
      "env": {
        "GEMINI_API_KEY": "YOUR_ACTUAL_API_KEY_HERE"
      }
    }
  }
}
```

## 🔑 API Key Configuration

### Option 1: MCP Configuration (Recommended)

Replace `YOUR_ACTUAL_API_KEY_HERE` in the configuration above with your actual API key.

### Option 2: Environment Variable

```powershell
# Temporary (current session)
$env:GEMINI_API_KEY = "your-actual-api-key"

# Permanent (user level)
[Environment]::SetEnvironmentVariable("GEMINI_API_KEY", "your-actual-api-key", "User")

# Verify
echo $env:GEMINI_API_KEY
```

### Configuration File Locations

**…

