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

@mcpcn/mcp-aliyun-bailian-image-generation

v2.0.7

Published

MCP server for Aliyun Bailian Qwen AI image generation

Readme

阿里云百炼 AI生图 MCP

这是一个基于阿里云百炼平台的AI图像生成MCP(Model Context Protocol)服务器,使用Qwen系列模型生成高质量图片。

功能特性

  • 🎨 支持文本到图像的AI生成
  • 📐 多种图片尺寸支持(正方形、横屏、竖屏)
  • ⚡ 异步任务处理,自动等待完成
  • 🌐 自动在浏览器中打开生成的图片
  • 🔧 简单易用的配置

安装

npm install
npm run build

配置

环境变量

需要设置以下环境变量:

export API_KEY="your-dashscope-api-key"  # 阿里云百炼的API Key
export API_ENDPOINT="custom-endpoint"    # 可选,自定义API端点
export ALIYUN_FORCE_SYNC=true             # 可选,强制同步调用

获取API Key

  1. 访问 阿里云百炼控制台
  2. 在“模型服务”->“API-KEY 管理”中创建新的API Key
  3. 复制API Key并设置为环境变量API_KEY

MCP 配置

在Claude Desktop的配置文件中添加:

{
  "mcpServers": {
    "ai-image-generation": {
      "command": "node",
      "args": ["path/to/AI生图/dist/index.js"],
      "env": {
        "API_KEY": "your-api-key"
      }
    }
  }
}

使用方法

1. 生成图片

generate_image({
  "prompt": "一只可爱的小猫在花园里玩耍",
  "size": "1024*1024",
  "num_images": 1
})

2. 检查任务状态

check_task_status({
  "taskId": "your-task-id"
})

工具说明

generate_image

生成AI图片。

参数:

  • prompt (必需): 图片生成提示词
  • size (可选): 图片尺寸
    • 受阿里云接口支持的尺寸(示例:1328*1328 等)
  • num_images (可选): 生成图片数量 (1-4,默认1)

check_task_status

检查图片生成任务状态。

参数:

  • taskId (必需): 任务ID

使用示例

基础图片生成

生成一张"夕阳下的山峦"的图片

指定尺寸

生成一张1280*720尺寸的"未来科技城市"图片

批量生成

生成4张"可爱的动物朋友们在森林里开派对"的图片

特性说明

  1. 自动打开图片: 生成完成后会自动在默认浏览器中打开图片
  2. 异步/同步: 默认优先异步;若权限不支持自动回退同步;可用 ALIYUN_FORCE_SYNC=true 强制同步
  3. 错误处理: 完善的错误处理和状态反馈
  4. 简化配置: 仅需配置 API_KEY,模型已固定为 qwen-image

注意事项

  1. API限制: 有调用频率限制,请合理使用
  2. 费用: 图片生成可能产生费用,请关注账户余额
  3. 内容审核: 请避免违规内容的提示词
  4. 网络要求: 需要稳定的网络连接

故障排除

常见错误

  1. API_KEY未设置: 确保环境变量API_KEY已正确配置
  2. 网络超时: 检查网络连接和API端点可用性
  3. 任务失败: 检查提示词是否符合内容政策

获取帮助

如果遇到问题,可以:

  1. 检查环境变量配置
  2. 查看控制台错误日志
  3. 确认API密钥有效性

许可证

MIT License