home / mcp / gemini mcp server

Gemini MCP Server

MCP server for Gemini AI image processing - 基于 Gemini 2.5 Flash 的图片处理 MCP 服务

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "ceeon-gemini-mcp": {
      "command": "uvx",
      "args": [
        "gemini-mcp"
      ],
      "env": {
        "ALL_PROXY": "socks5://127.0.0.1:1080",
        "LOG_LEVEL": "INFO",
        "OUTPUT_DIR": "./outputs",
        "GEMINI_API_KEY": "your-api-key"
      }
    }
  }
}

Gemini MCP is an image analysis server that runs autonomously and communicates with MCP-enabled clients to provide fast, streaming visual understanding. It supports multiple image input methods, real-time results, and automatic storage of outcomes, making it a practical tool for visual AI workflows across clients that speak the MCP protocol.

How to use

You connect to the Gemini MCP server from an MCP client (such as Claude Desktop or Cursor) and submit image inputs for analysis. You can feed local file paths, network URLs, or Base64-encoded images, and you’ll receive streaming results that describe the image, identify scenes, and extract text in real time. The server also saves processing outputs and generated images for your convenience.

How to install

Prerequisites: you need a runtime to start the MCP server. You will also need a Gemini API key to authorize requests.

Option A — run with uvx (recommended) and use the built-in server command set.

# Set API key and start the service using uvx
GEMINI_API_KEY=your-api-key uvx gemini-mcp

Option B — install via Python package and run the server directly.

# Install the package
pip install gemini-mcp

# Run the service
GEMINI_API_KEY=your-api-key gemini-mcp

Option C — run from source.

# Clone the repository
git clone https://github.com/chengfeng2025/gemini-mcp-python.git
cd gemini-mcp-python

# Install dependencies
pip install -r requirements.txt

# Run the service
python -m gemini_mcp

Configuration for MCP clients

Configure your MCP client to connect to Gemini MCP using one of the supported runtimes. Below are example configurations for common clients.

{
  "mcpServers": {
    "gemini": {
      "command": "uvx",
      "args": ["gemini-mcp"],
      "env": {
        "GEMINI_API_KEY": "your-api-key"
      }
    }
  }
}

使用示例

在配置好的客户端中,你可以执行以下场景:分析本地图片、分析网络图片、提取图片中的文字、进行场景理解。请使用你的视频/图片输入路径或 URL 来触发分析。

高级配置

环境变量、命令行选项以及相关参数可以微调输出、日志和代理设置。以下是常用环境变量和命令行参数的示例与说明。

# 常用环境变量
GEMINI_API_KEY=your-api-key       # Gemini API 密钥,必需
OUTPUT_DIR=./outputs               # 输出文件保存目录
ALL_PROXY=socks5://127.0.0.1:1080  # SOCKS5 代理地址(如需要)
LOG_LEVEL=INFO                     # 日志级别
```

```
# 查看可用参数
gemini-mcp --help

# 以 HTTP 服务模式运行(若客户端支持)
gemini-mcp --mode http --port 8080

# 启动调试模式
gemini-mcp --debug

# 指定输出目录
gemini-mcp --output-dir /custom/path

故障排除

常见问题及解决思路:API key 未发现、连接超时、客户端无法识别服务等。确保已正确设置 GEMINI_API_KEY 环境变量,并在需要时配置代理。若服务未被客户端识别,请重启客户端以重新加载配置。

# 设置 SOCKS5 代理示例
ALL_PROXY=socks5://127.0.0.1:1080 gemini-mcp

Available tools

analyze_image

Analyzes an image to describe its content, perform scene understanding, and extract text. Accepts image input as a file path, URL, or Base64 data and can return streaming results.