QM

qhdrl12/mcp-server-gemini-image-generator

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

34 stars 25 forks 质量 74 趋势 0MIT

qhdrl12/mcp-server-gemini-image-generator 是从 https://github.com/qhdrl12/mcp-server-gemini-image-generator. 导入的 MCP 服务器候选

概览

qhdrl12/mcp-server-gemini-image-generator 是从 https://github.com/qhdrl12/mcp-server-gemini-image-generator. 导入的 MCP 服务器候选

概述(AI 翻译)

通过 MCP 协议,利用谷歌的 Gemini 模型,从文本提示生成高质量图片。

概述

该 MCP 服务器允许任何 AI 助手使用 Google 的 Gemini AI 模型生成图像。服务器负责提示工程、文本转图像转换、文件名生成和本地图像存储,使得通过任何 MCP 客户端轻松创建和管理 AI 生成图像变得轻松。

特色

  • 使用 Gemini 2.0 闪存实现文本转图像生成
  • 基于文本提示的图像到图像转换
  • 支持基于文件和 base64 编码的图像
  • 基于提示自动智能文件名生成
  • 非英语提示的自动翻译
  • 本地图像存储,可配置输出路径
  • 严格排除生成图像中的文本
  • 高分辨率图像输出
  • 直接访问图像数据和文件路径

可用MCP工具

服务器为AI助手提供以下MCP工具:

1.generate_image_from_text

根据文本提示词创建新图片。

参数:

  • prompt:你想生成图像的文本描述

退货:

  • 包含以下的元组:
  • 原始图像数据(字节)

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

Gemini Image Generator MCP Server

Generate high-quality images from text prompts using Google’s Gemini model through the MCP protocol.

Overview

This MCP server allows any AI assistant to generate images using Google’s Gemini AI model. The server handles prompt engineering, text-to-image conversion, filename generation, and local image storage, making it easy to create and manage AI-generated images through any MCP client.

Features

  • Text-to-image generation using Gemini 2.0 Flash
  • Image-to-image transformation based on text prompts
  • Support for both file-based and base64-encoded images
  • Automatic intelligent filename generation based on prompts
  • Automatic translation of non-English prompts
  • Local image storage with configurable output path
  • Strict text exclusion from generated images
  • High-resolution image output
  • Direct access to both image data and file path

Available MCP Tools

The server provides the following MCP tools for AI assistants:

1. generate_image_from_text

Creates a new image from a text prompt description.

generate_image_from_text(prompt: str) -> Tuple[bytes, str]

Parameters:

  • prompt: Text description of the image you want to generate

Returns:

  • A tuple containing:
    • Raw image data (bytes)
    • Path to the saved image file (str)

This dual return format allows AI assistants to either work with the image data directly or reference the saved file path.

Examples:

  • “Generate an image of a sunset over mountains”
  • “Create a photorealistic flying pig in a sci-fi city”

Example Output

This image was generated using the prompt:

"Hi, can you create a 3d rendered image of a pig with wings and a top hat flying over a happy futuristic scifi city with lots of greenery?"

A 3D rendered pig with wings and a top hat flying over a futuristic sci-fi city filled with greenery

Known Issues

When using this MCP server with Claude Desktop Host:

  1. Performance Issues: Using transform_image_from_encoded may take significantly longer to process compared to other methods. This is due to the overhead of transferring large base64-encoded image data through the MCP protocol.
在 GitHub 查看完整 README

安装

npx -y @smithery/cli install @qhdrl12/mcp-server-gemini-image-gen --client claude
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "gemini-image-generator": { "command": "uv", "args": [ "--directory", "/absolute/path/to/mcp-server-gemini-image-generator", "run", "mcp-server-gemini-image-generator" ], "env": { "GEMINI_API_KEY": "your-actual-gemini-api-key-here", "OUTPUT_IMAGE_PATH": "/absolute/path/to/your/images/directory" } } } }