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-client

v1.0.0

Published

MCP client for 豆包即梦生图模型 API

Readme

豆包即梦生图 MCP Client

这是一个基于 Model Context Protocol (MCP) 的客户端,用于封装豆包即梦生图模型(即梦4.0)的图片生成接口。

功能特性

  • 文生图:根据文本提示词生成图片
  • 图片编辑:支持单图编辑和多图融合编辑
  • 生成组图:支持文生组图、单图生组图、多图生组图等
  • 流式响应处理:支持 Server-Sent Events (SSE) 流式响应

安装

npm install

构建

npm run build

配置

在使用之前,需要设置 API Key 环境变量:

export AIMINDSKY_API_KEY="your_api_key"

使用方法

作为 MCP Server 运行

npm start

或者使用开发模式:

npm run dev

MCP 工具

服务器提供以下三个工具:

1. text_to_image - 文生图

根据文本提示词生成图片。

参数:

  • prompt (string, 必需): 图片生成的提示词

示例:

{
  "prompt": "a cat"
}

2. image_edit - 图片编辑

支持单图编辑和多图融合编辑。可以对单张图片进行编辑,或基于多张图片进行融合生成。

参数:

  • prompt (string, 必需): 编辑操作的提示词
  • images (string[], 必需): 图片URL数组,支持1张或多张图片

单图编辑示例:

{
  "prompt": "将图片背景改为海滩,添加日落效果",
  "images": [
    "https://example.com/image1.png"
  ]
}

多图融合编辑示例:

{
  "prompt": "将图1的服装换为图2的服装",
  "images": [
    "https://example.com/image1.png",
    "https://example.com/image2.png"
  ]
}

3. generate_image_sequence - 生成组图

生成多张相关图片(支持文生组图、单图生组图、多图生组图等)。

参数:

  • prompt (string, 必需): 生成组图的提示词
  • images (string[], 可选): 图片URL数组,用于基于图片生成组图

示例:

{
  "prompt": "生成3张女孩和奶牛玩偶在游乐园开心地坐过山车的图片,涵盖早晨、中午、晚上",
  "images": [
    "https://example.com/image1.png"
  ]
}

响应格式

所有工具返回的响应格式:

{
  "success": true,
  "images": [
    {
      "url": "https://...",
      "size": "2048x2048",
      "index": 0
    }
  ],
  "usage": {
    "generated_images": 3,
    "output_tokens": 49152,
    "total_tokens": 49152
  }
}

API 接口

本客户端封装了以下 API 接口:

  • 端点: https://api.aimindsky.com/v1/images/generations
  • 模型: doubao-seedream-4-0-250828
  • 认证: Bearer Token (通过 AIMINDSKY_API_KEY 环境变量设置)

在 Cursor 中测试

快速测试(使用测试脚本)

# 设置 API Key
export AIMINDSKY_API_KEY="your_api_key"

# 运行测试
npm test              # 测试文生图
npm test sequence     # 测试生成组图

在 Cursor IDE 中配置 MCP Server

详细配置步骤请查看 CURSOR_SETUP.md

开发模式快速配置: 查看 DEV_MODE.md 了解如何在开发模式下测试

快速配置

  1. 在 Cursor 设置中添加 MCP Server 配置:
{
  "mcpServers": {
    "jimeng-image-generation": {
      "command": "node",
      "args": ["/绝对路径/jimeng-mcp-client/dist/index.js"],
      "env": {
        "AIMINDSKY_API_KEY": "your_api_key_here"
      }
    }
  }
}
  1. 重启 Cursor

  2. 在 Cursor Chat 中测试:

    • "请使用 text_to_image 工具生成一张小猫的图片"
    • "使用 image_edit 工具编辑图片,将背景改为海滩"
    • "使用 generate_image_sequence 生成3张不同风格的风景图"

开发

项目使用 TypeScript 编写,需要 Node.js 18+ 版本。

开发依赖

  • @modelcontextprotocol/sdk: MCP SDK
  • typescript: TypeScript 编译器
  • tsx: TypeScript 执行器(开发模式)

许可证

MIT