Gemini MCP Server
Integrates with Google Gemini AI to provide image generation and editing, context-aware chat, audio transcription, sandboxed Python code execution, video analysis, and image analysis using Gemini models.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Gemini MCP Server
一个功能完整的 Google Gemini AI MCP 服务器,提供7种AI工具和智能提示增强系统。
🚀 功能特性
AI 工具集
图像生成 - 使用 Gemini 2.0 Flash 从文本描述生成图像
图像编辑 - 通过自然语言指令编辑现有图像
智能对话 - 支持上下文感知的交互式对话
音频转录 - 将音频文件转换为文本,支持逐字转录模式
代码执行 - 在安全沙箱环境中运行 Python 代码
视频分析 - 分析视频内容,生成摘要、转录和洞察
图像分析 - 从图像中提取对象、文本和详细描述
智能提示系统
自学习 - 自动从成功的交互中学习
上下文检测 - 识别研究、编码、调试等不同场景
模式识别 - 识别使用模式和用户偏好
提示增强 - 优化提示以提高 AI 模型性能
持久化记忆 - 跨会话存储学习到的偏好
Related MCP server: Gemini MCP Server
📦 快速开始
安装依赖
git clone https://github.com/nemo/gemini-mcp-server.git
cd gemini-mcp-server
npm install配置 API 密钥
从 Google AI Studio 获取 Gemini API 密钥
创建环境配置文件:
cp .env.example .env编辑
.env文件,添加你的 API 密钥:GEMINI_API_KEY=你的API密钥 OUTPUT_DIR=/path/to/output/directory # 可选 DEBUG=false # 可选
运行服务器
npm start
# 或启用调试日志
npm run dev🔧 集成配置
Claude Desktop 配置
在 Claude Desktop 配置文件中添加(claude_desktop_config.json):
{
"mcpServers": {
"gemini": {
"command": "node",
"args": ["/path/to/gemini-mcp-server/gemini-server.js"],
"env": {
"GEMINI_API_KEY": "你的API密钥"
}
}
}
}配置文件位置:
Windows:
%APPDATA%\Claude\claude_desktop_config.jsonmacOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonLinux:
~/.config/Claude/claude_desktop_config.json
其他 MCP 客户端配置
本服务器遵循标准 MCP 协议,可与任何支持 MCP 的客户端集成。
🛠️ 工具使用说明
1. 图像生成 (generate_image)
从文本描述生成图像。
参数:
prompt(必需) - 图像描述文本context(可选) - 智能增强上下文
示例:
{
"prompt": "一座日落时分的宁静山景,色彩鲜艳",
"context": "artistic"
}2. 图像编辑 (gemini-edit-image)
使用自然语言编辑图像。
参数:
image_path(必需) - 图像文件路径edit_instruction(必需) - 编辑指令context(可选) - 上下文
示例:
{
"image_path": "/path/to/image.jpg",
"edit_instruction": "在夜空中添加流星"
}3. 智能对话 (gemini-chat)
与 Gemini AI 进行对话交互。
参数:
message(必需) - 你的消息或问题context(可选) - 上下文(consciousness/code/debugging)
示例:
{
"message": "用简单的语言解释量子计算",
"context": "general"
}4. 音频转录 (gemini-transcribe-audio)
将音频文件转换为文本。
参数:
file_path(必需) - 音频文件路径language(可选) - 语言提示context(可选) - 使用 "verbatim" 进行逐字转录preserve_spelled_acronyms(可选) - 保留拼写的缩写词
支持格式: MP3, WAV, FLAC, AAC, OGG, WEBM, M4A
标准转录示例:
{
"file_path": "/path/to/audio.mp3",
"language": "zh"
}逐字转录示例:
{
"file_path": "/path/to/audio.mp3",
"context": "verbatim",
"preserve_spelled_acronyms": true
}5. 代码执行 (gemini-code-execute)
在安全沙箱中执行 Python 代码。
参数:
code(必需) - 要执行的 Python 代码context(可选) - 上下文
示例:
{
"code": "import math\nprint(math.pi * 2)",
"context": "code"
}6. 视频分析 (gemini-analyze-video)
分析视频内容。
参数:
file_path(必需) - 视频文件路径analysis_type(可选) - summary/transcript/objects/detailed/customcontext(可选) - 上下文
支持格式: MP4, MOV, AVI, WEBM, MKV, FLV
示例:
{
"file_path": "/path/to/video.mp4",
"analysis_type": "detailed"
}7. 图像分析 (gemini-analyze-image)
从图像中提取详细信息。
参数:
file_path(必需) - 图像文件路径analysis_type(可选) - summary/objects/text/detailed/customcontext(可选) - 上下文
支持格式: JPEG, PNG, WebP, HEIC, HEIF, BMP, GIF
示例:
{
"file_path": "/path/to/image.jpg",
"analysis_type": "objects"
}📊 文件大小限制
图像: 20MB
音频: 20MB
视频: 100MB
🧪 测试
# 基础功能测试
npm test
# 智能系统测试
node test-tool-intelligence-full.js
# 内部存储测试
node test-internal-storage.js
# 逐字转录测试
node test-verbatim-mode.js🏗️ 项目结构
src/
├── server.js # MCP 协议处理
├── config.js # 配置管理
├── tools/ # 工具实现
│ ├── index.js # 工具注册和分发
│ ├── base-tool.js # 抽象基类
│ ├── chat.js # 对话工具
│ ├── image-generation.js # 图像生成
│ ├── image-editing.js # 图像编辑
│ ├── audio-transcription.js # 音频转录
│ ├── code-execution.js # 代码执行
│ ├── video-analysis.js # 视频分析
│ └── image-analysis.js # 图像分析
├── intelligence/ # 智能提示系统
│ ├── index.js # 智能协调器
│ ├── context-detector.js # 上下文识别
│ ├── prompt-enhancer.js # 提示增强
│ └── preference-store.js # 模式存储
├── gemini/ # Gemini API 集成
│ ├── gemini-service.js # API 服务层
│ └── request-handler.js # 请求格式化
└── utils/ # 工具函数
├── logger.js # 日志系统
└── file-utils.js # 文件操作🐛 故障排除
缺少 GEMINI_API_KEY 错误
# 确保 .env 文件存在并包含 API 密钥
cp .env.example .env
# 编辑 .env 并添加: GEMINI_API_KEY=你的密钥文件未找到错误
确保文件路径是绝对路径且文件存在
检查文件权限和格式
智能系统未学习
# 检查数据目录权限
ls -la data/
# 验证 tool-preferences.json 可写启用调试模式
DEBUG=true npm start
# 或
npm run dev📄 许可证
本项目采用 MIT 许可证 - 可自由使用、修改和分发。
🙏 致谢
Google Gemini AI - 核心 AI 能力
Model Context Protocol - 实现无缝集成
Node.js & NPM - 运行时和包管理
准备好体验智能 MCP 服务器了吗? 立即开始使用!🚀
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Use AI models for chat, image, and video generation from Claude Code and other MCP hosts.
OCR, transcription, file extraction, and image generation for AI agents via MCP.
Generate AI video, images and audio, and browse your history, from any MCP client.
Generate images, video, audio and short films with 140+ AI models from any MCP client.
Related MCP Servers
- AlicenseAqualityDmaintenanceAllows AI assistants to generate and transform high-quality images from text prompts using Google's Gemini model via the MCP protocol.334MIT
- FlicenseNot gradedqualityDmaintenanceMCP server that connects Claude Desktop to Google Gemini, enabling multimodal analysis with file attachments (video, image, audio, PDF).-
- FlicenseNot gradedqualityDmaintenanceIntegrates Google's Gemini API with MCP-compatible clients for chat, real-time web search, knowledge queries, code/text analysis, and content generation.-
- AlicenseNot gradedqualityDmaintenanceEnables image generation and editing using Google Vertex AI's Imagen API through natural language commands in MCP clients like Claude Desktop.65 npm1MIT