gemini-image-mcp
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@gemini-image-mcpgenerate a futuristic city skyline at sunset"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
gemini-image-mcp
一个基于 MCP (Model Context Protocol) 的 Node.js 服务:通过本地 OpenAI-compatible 网关(默认 http://127.0.0.1:8317)调用 Gemini 图片模型 gemini-3-pro-image-preview 生成图片,供 Claude Code/Claude Desktop 等 IDE 工具动态使用。
1) 安装
npm installRelated MCP server: Gemini Gen MCP
2) 环境变量(可选)
OPENAI_BASE_URL:OpenAI-compatible 服务地址(默认http://127.0.0.1:8317)OPENAI_API_KEY:如果你的网关需要鉴权就填(可留空)OPENAI_MODEL:默认gemini-3-pro-image-previewOPENAI_IMAGE_SIZE:可选,仅作为未传入size时的默认值;建议让客户端在调用generate_image时自己传sizeOPENAI_IMAGE_MODE:chat|images|auto,默认chat(CLIProxyAPI 这类网关通常用/v1/chat/completions出图;若你的网关支持/v1/images/generations可设为images)OPENAI_IMAGE_RETURN:path|image,默认path(path会把图片保存到本地并返回文件路径,避免 base64 导致 token 暴涨;image返回 MCPimagecontent)OPENAI_IMAGE_OUT_DIR:保存目录(默认debug-output/;相对路径以项目根目录为基准)OPENAI_DEBUG:设为1时会在 stderr 打印上游请求信息(不打印 key)OPENAI_TIMEOUT_MS:默认120000
可参考 .env.example。
3) 本地调试(不用放进 Claude Code)
推荐把 .env.example 复制成 .env,然后在 .env 里填好 OPENAI_API_KEY(.gitignore 已忽略 .env)。
直连上游调试(确认你的
http://127.0.0.1:8317是否能出图):npm run debug:upstream -- --prompt "A beautiful sunset over mountains" --size 1024x1024
走 MCP 工具调试(等价于 Claude Code 调用
generate_image):npm run debug:mcp -- --prompt "A beautiful sunset over mountains" --n 1 --size 1024x1024
图片会输出到 debug-output/。
4) 作为 MCP Server 使用(stdio)
该项目是 stdio 传输方式的 MCP Server,不建议直接在终端手动运行(会等待客户端请求)。
在 Claude Code / Claude Desktop 的 MCP 配置里添加类似如下(按你的实际路径修改):
{
"mcpServers": {
"gemini-image": {
"command": "node",
"args": ["d:/task/myself/nodejs/geminiimagemcp/src/index.js"],
"env": {
"OPENAI_BASE_URL": "http://127.0.0.1:8317",
"OPENAI_API_KEY": "<YOUR_KEY>",
"OPENAI_MODEL": "gemini-3-pro-image-preview"
}
}
}
}也可以直接参考 mcp.example.json。
5) 可用工具
generate_image入参:
prompt(必填),size(可选),n(可选,1-4),output(可选:path|image),outDir(可选)返回:默认返回保存后的图片文件路径(多行);
output=image时返回 MCPimagecontent(base64 + mimeType)
Available Tools
1 toolgenerate_imageA
通过 OpenAI-compatible 接口调用 Gemini 的 "gemini-3-pro-image-preview" 生成图片:默认保存到本地并返回文件路径(避免 base64 导致 token 暴涨);也可用 output=image 返回 MCP image content。
| Name | Required | Description | Default |
|---|---|---|---|
| prompt | Yes | 图片描述/提示词(必填) | |
| size | No | 图片尺寸,默认 1024x1024(按你的网关/模型支持填写) | |
| n | No | 生成张数,默认 1(建议 1-4) | |
| output | No | 返回格式:path(默认,保存后返回路径)或 image(返回 MCP image base64) | |
| outDir | No | 保存目录(可选):相对路径以项目根目录为基准;默认 debug-output/;也可用环境变量 OPENAI_IMAGE_OUT_DIR |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries full burden and explains key behaviors: default saves locally to avoid token issues, can return base64, and supports environment variable for output directory. However, it lacks details on error handling, rate limits, or authentication.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single sentence that is reasonably concise and front-loaded with the core purpose. It could be more structured but is efficient.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given no output schema, the description sufficiently explains return values (file path or MCP image). Parameters are well covered, though error handling and output details could be expanded.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so baseline is 3. The description adds value by explaining the rationale for default output format (path avoids token bloat) and mentions environment variable, thus enhancing parameter understanding.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool generates images via an OpenAI-compatible interface to Gemini model 'gemini-3-pro-image-preview', specifying default saving to local path versus returning base64. It precisely identifies the resource and action.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance on when to use this tool versus alternatives or when not to use it. No siblings are listed, but the description does not provide any explicit usage context or preconditions.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
1 tool update
v0.1.0- First observed
generate_image
TDQS
Scored across 1 tool
With only one tool, there is no possibility of confusion between tools. The single tool has a clearly defined purpose.
Only one tool exists, so naming conventions are inherently consistent. The name 'generate_image' is clear and verbs are used appropriately.
The server focuses on image generation, and one tool is reasonable for this narrow scope. While it is minimal, it fully covers the core functionality without unnecessary complexity.
The tool covers all essential aspects of image generation: it offers both local file saving and MCP image content output. No obvious gaps for the intended purpose.
Maintenance
Related MCP Connectors
MCP server for Qwen Image 3 AI image generation
Generate AI images and videos from any compatible MCP client.
MCP server for Flux AI image generation
Focused MCP server for OpenAI image/audio generation (v2.0.0). Wraps endpoints via HAPI CLI.
Related MCP Servers
- AlicenseBqualityCmaintenanceAn MCP server for image generation using the Gemini API.1332MIT
- AlicenseBqualityCmaintenanceMCP server for generating images and audio using Google's Gemini AI models.22MIT
- AlicenseAqualityDmaintenanceMCP server for Google Gemini image generation with configurable model support, enabling text-to-image generation, image editing, and iterative refinement.640MIT
- FlicenseNot gradedqualityCmaintenanceAn MCP server for AI-powered image processing (generate, edit, vary, analyze) supporting OpenAI, Gemini, Ideogram, and custom relay endpoints.-