Token导航 LogoToken导航TokenDH.com
Image Generation MCP logo
设计创作未说明官方级别未说明来源级核验

Image Generation MCP

MCP Server

一个基于MCP协议的AI图像生成服务,支持博客和社交媒体图片的自动生成,可扩展架构支持多种AI提供商。

工具数

0

提示词数

0

GitHub Stars

0

资源数

0
图像生成TypeScriptClaudeClaude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

12-days-of-shipmas-2025

提供方

12-days-of-shipmas-2025

最后核验

2026/5/17 20:21

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

图像生成mcp

](https://www.npmjs.com/package/image-generation-mcp) ![License: MIT](https://opensource.org/licenses/MIT)

一个MCP(模型上下文协议)服务器,用于使用人工智能生成博客和社交媒体图像。目前支持谷歌的Gemini/Nano Banana图像生成模型,其提供商架构旨在易于扩展。

安装: npx -y image-generation-mcp

特性

  • 平台预设:Ghost、Medium、Instagram、Twitter、LinkedIn、YouTube等的预配置维度
  • 多个质量级别:标准(快速)或高(使用Gemini Pro获得更好的质量)
  • 自动保存:图像始终保存到磁盘(永远不会丢失,因为只有base64响应)
  • PNG元数据:每个图像中都嵌入了提示、型号、样式和生成信息
  • 提供商架构:可扩展设计,支持多个AI提供商
  • 安全第一:输入验证、及时清理、安全错误处理

快速开始

环境变量

变量必填描述
GOOGLE_API_KEYGemini的Google AI API密钥
IMAGE_OUTPUT_DIR保存图像的默认目录(默认为 ./generated-images)

从获取API密钥 谷歌AI工作室.

______________________________________________________________________

Claude代码设置

选项1:已发布包(推荐)

# Add to Claude Code (user scope - available in all projects)
claude mcp add image-gen --scope user -e GOOGLE_API_KEY=your-api-key -- npx -y image-generation-mcp

# Or add to current project only
claude mcp add image-gen -e GOOGLE_API_KEY=your-api-key -- npx -y image-generation-mcp

方案2:地方发展

# From the project directory, build first
npm run build

# Add local server to Claude Code
claude mcp add image-gen -e GOOGLE_API_KEY=your-api-key -- node /absolute/path/to/image-generation-mcp/dist/index.js

选项3:手动配置

添加 ~/.claude.json (用户范围)或 .mcp.json (项目范围):

{
  "mcpServers": {
    "image-gen": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "image-generation-mcp"],
      "env": {
        "GOOGLE_API_KEY": "your-api-key-here"
      }
    }
  }
}

对于当地发展:

{
  "mcpServers": {
    "image-gen": {
      "type": "stdio",
      "command": "node",
      "args": ["/absolute/path/to/image-generation-mcp/dist/index.js"],
      "env": {
        "GOOGLE_API_KEY": "your-api-key-here"
      }
    }
  }
}

验证安装

# List configured MCP servers
claude mcp list

# Check status within Claude Code
/mcp

______________________________________________________________________

Claude桌面设置

添加到您的 claude_desktop_config.json:

{
  "mcpServers": {
    "image-gen": {
      "command": "npx",
      "args": ["-y", "image-generation-mcp"],
      "env": {
        "GOOGLE_API_KEY": "your-api-key-here"
      }
    }
  }
}

配置文件位置:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • 窗户: %APPDATA%\Claude\claude_desktop_config.json

______________________________________________________________________

工具

generate_blog_image

为博客文章或社交媒体生成图像。

参数:

参数类型必填说明
promptstring要生成的图像的描述
formatstring平台预设(默认值: ghost-banner)
qualitystringstandardhigh (默认值: standard)
stylestring样式提示(例如,“照片级真实感”、“插图”)
titlestring博客文章标题用于上下文
outputPathstring保存图像的路径(默认为 ./generated-images/ 带时间戳)
providerstring要使用的提供程序(默认值: gemini)

例子:

Generate a blog banner for my post about TypeScript best practices.
Use format: medium-ghost-spooky, style: modern minimalist

list_image_formats

列出所有可用的图像格式预设。

参数:

参数类型必填说明
categorystring按类别筛选: blog, social, video, generic

可用格式

博客平台

格式尺寸比率描述
ghost-banner1200x67516:9Ghost博客文章的特色图片
ghost-feature2000x112516:9Ghost的高分辨率特征图像
medium-ghost-spooky2560x144016:9高级高分辨率博客横幅(QHD)
medium-banner1400x78816:9中等文章横幅图片
substack-header1456x81616:9Substack帖子的标题图像
wordpress-featured1200x67516:9WordPress帖子的特色图片

社交媒体

格式尺寸比率描述
instagram-post1080x10801:1Instagram订阅源的方形帖子
instagram-story1080x19209:16Instagram的垂直故事/卷轴
twitter-post1200x67516:9推特/X帖子的图片
linkedin-post1200x628~1.91:1领英帖子的图片
facebook-post1200x630~1.91:1脸书帖子的图片

视频平台

格式尺寸比率描述
youtube-thumbnail1280x72016:9YouTube视频缩略图
youtube-banner2560x144016:9YouTube频道横幅

通用的

格式尺寸比率描述
square1024x10241:1通用方形图像
landscape1920x108016:9标准横向(1080p)
landscape-4k3840x216016:94K风景图像
portrait1080x19209:16标准纵向/垂直图像

PNG元数据

每个生成的PNG图像都包含嵌入的元数据:

字段描述
Description原始提示
AI-Model使用的模型(例如。, gemini-2.5-flash-image)
AI-Provider提供商名称(gemini)
Image-Format使用预设(例如。, twitter-post)
AI-Style样式提示(如果指定)
Title博客文章标题(如果指定)
Creation-TimeISO时间戳
Softwareimage-generation-mcp

查看元数据:

# macOS/Linux
strings your-image.png | grep -E "^(Description|AI-|Title|Creation)"

# Or use exiftool
exiftool your-image.png

安全

此MCP服务器实施了多种安全措施:

  • 输入验证:提示的长度经过验证并经过消毒
  • 快速注射保护:可疑模式被阻止
  • 路径穿越预防:输出路径已验证
  • 安全错误消息:API密钥和敏感数据从不在错误中暴露
  • 不记录秘密:从未记录API密钥

⚠️ 免责声明

这是一个简单的、用vibe编码的MCP服务器,用于生成图像。 它按原样提供是为了方便和教育目的。

你应该知道什么

  1. API密钥安全:您的 GOOGLE_API_KEY 尽可能安全。我们不会将您的API密钥存储、记录或传输到除谷歌API之外的任何地方。您负责:

- 确保API密钥的安全 - 不将其提交到版本控制 - 如果你怀疑它已被攻破,请旋转它

  1. 数据传输:您的提示和生成的图像被发送到/来自谷歌的Gemini API。审查 谷歌的人工智能服务条款 他们的数据处理政策。
  1. 不担保:本软件按“原样”提供,不提供任何形式的保修。作者对使用本软件引起的任何损害、数据丢失、API费用或其他问题不承担任何责任。
  1. API成本:图像生成可能会在您的Google Cloud帐户上产生费用。监控您的使用情况并设置账单提醒。
  1. 内容责任:您对提交的提示和生成的图像负责。请勿使用此工具生成有害、非法或违反政策的内容。

许可证

MIT许可证-请参阅 许可证 完整条款。

使用本软件即表示您已阅读并理解这些条款。

添加新提供商

服务器使用提供者接口模式。要添加新提供程序,请执行以下操作:

  1. 在中创建新文件 src/providers/ 实施 ImageProvider
  2. 在中注册 src/providers/index.ts
// src/providers/my-provider.ts
import { ImageProvider, ImageGenerationOptions, GeneratedImage } from "./types.js";

export class MyProvider implements ImageProvider {
  readonly name = "my-provider";

  isConfigured(): boolean { /* ... */ }
  generateImage(options: ImageGenerationOptions): Promise { /* ... */ }
  getSupportedAspectRatios(): string[] { /* ... */ }
  getMaxResolution(): { width: number; height: number } { /* ... */ }
}

发展

# Install dependencies
npm install

# Build
npm run build

# Run locally
GOOGLE_API_KEY=your-key node dist/index.js

# Watch mode
npm run dev

# Run tests
npm test

# Lint and format
npm run lint
npm run format

发布到npm

# 1. Make sure you're logged in to npm
npm login

# 2. Update version in package.json (if needed)
npm version patch  # or minor, major

# 3. Run all checks
npm run check

# 4. Publish
npm publish

# 5. After publishing, users can install with:
#    npx image-generation-mcp
#    or: npm install -g image-generation-mcp

许可证

麻省理工学院

目录标签

目录标签

图像生成TypeScriptClaudeAI图像生成本地部署社交媒体工具博客工具自动化内容创建图像处理

支持客户端

Claude

接入字段

传输方式(transport,传输协议)

未说明

鉴权方式(authType,认证方式)

session

部署方式(deploymentType,部署类型)

remote-capable

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

未说明sessionremote-capable

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

仍需确认:installCommand

来源信息

继续浏览同类 MCP