Provides intelligent image analysis capabilities using Google Gemini 2.0 Flash model, supporting multimodal analysis, scene recognition, text extraction from images, and processing images from local files, URLs, or Base64 encoding
Gemini MCP - 基于 Gemini 的智能图像分析服务
项目概述
Gemini MCP 是一个基于 Google Gemini 2.0 Flash 模型的 MCP(Model Context Protocol)服务器,专门用于图像分析和处理。它可以无缝集成到 Claude Desktop、Cursor 等支持 MCP 协议的 AI 助手中,提供强大的视觉理解能力。
核心特性
🎯 主要功能
- 多模态分析:支持图片内容理解、场景识别、文字提取等
- 灵活输入:支持本地文件路径、网络 URL、Base64 编码等多种图片输入方式
- 流式响应:实时流式输出分析结果,提升用户体验
- 智能存储:自动保存处理结果和生成的图片
🚀 技术优势
- 零依赖安装:支持 uvx 直接运行,无需预先安装
- 跨平台兼容:支持 macOS、Windows、Linux 等主流操作系统
- 代理支持:内置 SOCKS5 代理支持,适应各种网络环境
- 标准协议:完全符合 MCP 规范,可与任何 MCP 客户端集成
快速开始
方式一:使用 uvx 运行(推荐)
无需安装,直接运行:
方式二:通过 pip 安装
方式三:从源码运行
客户端配置
Claude Desktop 配置
- 打开配置文件:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
- Windows:
%APPDATA%\Claude\claude_desktop_config.json
- macOS:
- 添加以下配置:
Cursor 配置
编辑 ~/.cursor/mcp.json
:
使用示例
在配置好的 Claude Desktop 或 Cursor 中,你可以:
高级配置
环境变量
变量名 | 说明 | 默认值 |
---|---|---|
GEMINI_API_KEY | Gemini API 密钥(必需) | - |
OUTPUT_DIR | 输出文件保存目录 | ./outputs |
ALL_PROXY | SOCKS5 代理地址 | - |
LOG_LEVEL | 日志级别 | INFO |
命令行参数
API 参考
支持的工具
analyze_image
分析图片内容并返回描述。
参数:
image_input
: 图片输入(文件路径、URL 或 Base64)prompt
: 分析提示词(可选)
示例:
开发指南
本地开发
贡献代码
- Fork 项目
- 创建特性分支 (
git checkout -b feature/AmazingFeature
) - 提交更改 (
git commit -m 'Add some AmazingFeature'
) - 推送到分支 (
git push origin feature/AmazingFeature
) - 创建 Pull Request
故障排除
常见问题
Q: 提示 "API key not found"
A: 确保已正确设置 GEMINI_API_KEY
环境变量。
Q: 连接超时错误 A: 检查网络连接,或配置代理:
Q: Claude Desktop 无法识别服务 A: 重启 Claude Desktop 应用以重新加载配置。
项目信息
- 作者: chengfeng2025
- 许可证: MIT
- 版本: 1.0.0
- 更新时间: 2025年1月
- GitHub: gemini-mcp-python
相关链接
许可证
本项目采用 MIT 许可证。详见 LICENSE 文件。
注意:使用本项目需要有效的 Gemini API 密钥。
API 密钥获取方式
- 官方渠道:访问 Google AI Studio 获取官方密钥(需要科学上网)
- 兔子 API:访问 兔子API充值平台 购买兼容官方格式的 API 服务(国内直连,无需梯子,完全兼容 Gemini 官方 API 接口)
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Enables image processing and analysis using Google's Gemini 2.5 Flash model. Supports local files, URLs, and Base64 images with streaming responses and automatic output saving.