npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

jimeng_mcp_image

v1.0.7

Published

即梦4.0 AI图像生成 MCP服务器 - Jimeng 4.0 AI Image Generation MCP Server

Readme

即梦4.0 AI图像生成 MCP服务器

这是一个MCP(Model Context Protocol)服务器,提供即梦4.0 AI图像生成功能。基于火山引擎视觉AI服务。

功能特性

  • ✅ 文本生成图像(Text-to-Image)
  • ✅ 支持自定义分辨率(1K/2K/4K)
  • ✅ 可调节文本影响程度
  • ✅ 支持参考图片(图像编辑)
  • ✅ 返回Base64编码的图片数据
  • ✅ 自动签名认证
  • ✅ 支持通过 npx 直接运行

快速开始

使用 npx(推荐,无需安装)

直接在 Claude Desktop 配置文件中使用:

{
  "mcpServers": {
    "jimeng_mcp_image": {
      "command": "npx",
      "args": ["-y", "jimeng_mcp_image"],
      "env": {
        "VOLCENGINE_ACCESS_KEY_ID": "your-access-key-id",
        "VOLCENGINE_SECRET_ACCESS_KEY": "your-secret-access-key"
      }
    }
  }
}

全局安装

npm install -g jimeng_mcp_image

从源码安装

git clone https://github.com/toller892/jimeng-mcp-server.git
cd jimeng-mcp-server
npm install

获取火山引擎密钥

  1. 访问 火山引擎控制台
  2. 进入"访问控制" > "访问密钥"
  3. 创建新的访问密钥
  4. 复制 Access Key ID 和 Secret Access Key

配置

方法1: 在 Claude Desktop 中配置(推荐)

编辑配置文件:

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

使用 npx(推荐):

{
  "mcpServers": {
    "jimeng_mcp_image": {
      "command": "npx",
      "args": ["-y", "jimeng_mcp_image"],
      "env": {
        "VOLCENGINE_ACCESS_KEY_ID": "your-access-key-id",
        "VOLCENGINE_SECRET_ACCESS_KEY": "your-secret-access-key"
      }
    }
  }
}

使用全局安装:

{
  "mcpServers": {
    "jimeng_mcp_image": {
      "command": "jimeng_mcp_image",
      "env": {
        "VOLCENGINE_ACCESS_KEY_ID": "your-access-key-id",
        "VOLCENGINE_SECRET_ACCESS_KEY": "your-secret-access-key"
      }
    }
  }
}

使用源码:

{
  "mcpServers": {
    "jimeng_mcp_image": {
      "command": "node",
      "args": ["/path/to/jimeng-mcp-server/index.js"],
      "env": {
        "VOLCENGINE_ACCESS_KEY_ID": "your-access-key-id",
        "VOLCENGINE_SECRET_ACCESS_KEY": "your-secret-access-key"
      }
    }
  }
}

方法2: 使用环境变量

export VOLCENGINE_ACCESS_KEY_ID="your-access-key-id"
export VOLCENGINE_SECRET_ACCESS_KEY="your-secret-access-key"

图片保存位置

生成的图片会自动保存在当前工作目录下:

  • 目录: ./generated_images/
  • 文件名格式: jimeng_{taskId}_{序号}_{时间戳}.jpg

示例:

  • 图片保存在 ./generated_images/jimeng_1234567890_1_1732789123456.jpg

2. 重启Claude Desktop

配置完成后,重启Claude Desktop应用。

3. 使用工具

在Claude Desktop中,你可以这样使用:

请使用即梦AI生成一张图片:一只可爱的小猫在花园里玩耍

Claude会自动调用 generate_image 工具。

MCP工具说明

generate_image

生成AI图像的工具。

参数:

  • prompt (必需, string): 图像描述文本
    • 示例: "一只可爱的小猫在花园里玩耍,高清摄影"
  • size (可选, number): 图像面积
    • 1048576 = 1K (1024×1024)
    • 4194304 = 2K (2048×2048) [默认]
    • 16777216 = 4K (4096×4096)
  • scale (可选, number): 文本影响程度 (0-1)
    • 0.3 = 更接近参考图
    • 0.5 = 平衡 [默认]
    • 0.7 = 更接近文本描述
  • forceSingle (可选, boolean): 是否强制单图
    • false = 可能生成多张 [默认]
    • true = 只生成一张
  • imageUrls (可选, array): 参考图片URL数组
    • 用于图像编辑或风格迁移

返回值:

{
  "success": true,
  "taskId": "任务ID",
  "imageFormat": "base64",
  "base64Images": ["BASE64_STRING_1", "BASE64_STRING_2"],
  "imageCount": 2
}

使用示例

示例1: 基础文生图

生成一张图片:春天的樱花树,阳光明媚,高清摄影

示例2: 高分辨率图片

生成一张4K分辨率的图片:未来科技城市,赛博朋克风格

示例3: 艺术风格

生成一张水彩画风格的图片:小桥流水,中国风

保存生成的图片

MCP返回的是Base64编码的图片数据。你可以:

方法1: 在Claude Desktop中查看

Claude会自动处理Base64数据并显示图片。

方法2: 手动保存

如果需要保存到本地,可以使用以下Node.js代码:

import fs from 'fs';

const base64String = "返回的Base64字符串";
const buffer = Buffer.from(base64String, 'base64');
fs.writeFileSync('output.jpg', buffer);

方法3: 在HTML中使用

<img src="data:image/jpeg;base64,BASE64_STRING" alt="AI生成图片" />

测试

直接测试(不通过MCP)

创建测试文件 test.js:

import { generateImage } from './index.js';

const result = await generateImage('一只可爱的小猫');
console.log(result);

运行:

node test.js

故障排除

问题1: 签名错误

原因: Access Key ID 或 Secret Access Key 不正确

解决:

  • 检查环境变量或配置文件中的密钥
  • 确认密钥来自火山引擎控制台
  • 确保没有多余的空格或换行符

问题2: 连接超时

原因: 网络问题或API服务不可用

解决:

  • 检查网络连接
  • 确认可以访问火山引擎API
  • 检查防火墙设置

问题3: Claude Desktop无法识别工具

原因: 配置文件路径错误或格式不正确

解决:

  1. 检查配置文件路径是否正确
  2. 确认JSON格式正确(使用JSON验证工具)
  3. 重启Claude Desktop
  4. 查看Claude Desktop的日志文件

问题4: npx 命令失败

原因: npm 或 node 版本过低

解决:

  • 确保 Node.js >= 18.0.0
  • 更新 npm: npm install -g npm@latest
  • 清除 npx 缓存: npx clear-npx-cache

问题5: 图片生成失败

原因: 提示词不合适或参数错误

解决:

  1. 使用更详细的提示词
  2. 检查参数是否在有效范围内
  3. 查看错误信息
  4. 确认火山引擎账户有足够的配额

技术细节

  • 协议: Model Context Protocol (MCP)
  • 传输: stdio
  • 认证: HMAC-SHA256签名
  • API: 火山引擎视觉AI服务
  • 模型: jimeng_t2i_v40

安全建议

  1. 不要提交密钥到Git

    # 添加到 .gitignore
    echo ".env" >> .gitignore
  2. 使用环境变量

    • 在生产环境中始终使用环境变量
    • 不要在代码中硬编码密钥
  3. 定期轮换密钥

    • 建议每3-6个月更换一次密钥

许可证

MIT

支持

  • 火山引擎官方文档: https://www.volcengine.com/docs/
  • MCP协议文档: https://modelcontextprotocol.io/

版本: 1.0.2 最后更新: 2025-11-28 模型: jimeng_t2i_v40

更新日志

v1.0.6 (2025-11-28)

  • ✅ 简化配置,移除 MCP_WORKSPACE_DIR 环境变量
  • ✅ 图片统一保存在当前工作目录的 generated_images/ 文件夹

v1.0.5 (2025-11-28)

  • ✅ 优化图片保存逻辑

v1.0.2 (2025-11-28)

  • ✅ 新增 MCP_WORKSPACE_DIR 环境变量支持
  • ✅ 允许用户自定义图片保存路径
  • ✅ 修复图片保存在错误路径的问题

v1.0.1 (2025-11-28)

  • ✅ 更新环境变量名称为 VOLCENGINE_*
  • ✅ 优化图片保存逻辑

v1.0.0 (2025-11-26)

  • ✅ 初始版本发布