Gemini MCP Server
Gemini MCP Server
这是一个使用 Google Gemini API 实现文本生成、图像生成(Imagen)的通用 MCP 服务器。
生成的图像以本地绝对路径的形式返回(图像数据本身不包含在工具调用结果中)。
保存的文件可传递给 ftp-mcp 的 ftp_upload_file 转换为公开 URL,
再通过 wp-mcp 的 wp_upload_media_from_url 注册到 WordPress 的媒体库——本服务器是这一两阶段流程的前置环节。
文本生成的结果则直接作为工具调用的结果返回。
1. 设置
cd gemini-mcp
npm install将 config.json.example 复制为 config.json,并填写在 Google AI Studio(https://aistudio.google.com/apikey)
上颁发的 API 密钥(此文件包含 API 密钥,绝对不要公开、共享或提交到 Git。
已包含在 .gitignore 中)。
cp config.json.example config.json{
"api_key": "AIza................................",
"default_text_model": "gemini-2.5-flash",
"default_image_model": "imagen-4.0-generate-001"
}api_key:在 Google AI Studio 上颁发的 API 密钥。default_text_model:省略generate_text的model参数时使用的模型 ID。default_image_model:省略generate_image的model参数时使用的模型 ID。
模型阵容会随 Google 官方文档随时更新,因此最新的模型 ID 请参阅 https://ai.google.dev/gemini-api/docs/models(文本)/ https://ai.google.dev/gemini-api/docs/imagen(图像)。
即使 API 密钥未设置(保持占位符状态),服务器本身也可以启动。实际调用
generate_text / generate_image 时才会出现 Google 端的认证错误。
Related MCP server: MCP Nano Banana
2. 注册到 Claude Code
在使用 Claude Code 的项目根文件夹内,将 MCP 服务器信息添加到 .mcp.json 中。
{
"mcpServers": {
"gemini": {
"command": "node",
"args": ["/MCPの保存パス/gemini-mcp/index.js"],
"env": {
"GEMINI_MCP_CONFIG_PATH": "/MCPの保存パス/gemini-mcp/config.json"
}
}
}
}注册后请重启 Claude Code 会话,重新加载 MCP 服务器。
3. 提供的工具
gemini_check_config— 确认 API 密钥是否已设置以及默认模型名称(不调用 API)。generate_text— 根据提示词生成文本并直接返回。prompt(必填):输入提示词。system_instruction(可选):指定模型整体行为的系统指令。temperature(可选・0〜2):输出的随机性。model(可选):覆盖default_text_model的模型 ID。返回值:生成模型名称・生成文本。
generate_image— 根据文本提示词生成图像,并保存为指定本地文件夹中的 PNG/JPEG 文件。prompt(必填):要生成的图像描述。output_dir(必填):保存目标目录的绝对路径(不存在时自动创建)。file_prefix(可选・默认image):保存文件名的前缀。number_of_images(可选・默认 1・最大 4):生成张数。aspect_ratio(可选・默认1:1):1:1/3:4/4:3/9:16/16:9。negative_prompt(可选):不希望包含的元素。model(可选):覆盖default_image_model的模型 ID。返回值:生成模型名称・提示词・各保存文件的绝对路径/MIME 类型等。
补充说明
依赖库使用 Google 官方的
@google/genaiSDK。如果被安全过滤器拦截,或响应中不包含内容,则作为错误返回。
图像生成的用途(文章封面图、正文插图等)以及反映到文章正文的步骤, 请参阅
docs/tasks/eyecatch-image.md/docs/tasks/image-embed.md(各项目侧)。
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables 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.2MIT
- FlicenseNot gradedqualityDmaintenanceEnables image generation using the Google Gemini API through a simple text prompt. Generated images are saved locally and hosted online via ImgBB for easy access and sharing.9
- AlicenseNot gradedqualityNot gradedmaintenanceEnables image generation using Google's Gemini 2 API with customizable parameters like aspect ratio, number of samples, and person generation settings.189
- AlicenseBqualityDmaintenanceEnables image generation using Google Gemini models like Gemini 2.0 Flash and Imagen 3.0 with support for custom aspect ratios and negative prompts. It also allows users to list and manage generated images stored in local directories.225MIT
Related MCP Connectors
LLM chat, text summarization and AI image generation
Transform video, audio and images, and generate media from prompts. FFmpeg, captions, models.
Generate images, video & speech with Nano Banana, Veo, Omni and Gemini TTS. Pay as you go.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/nao9net/gemini-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server