D

Draw Things Cursor 连接器

@jaokuohsuan/draw-things-mcp-cursor
0 Stars 631 次浏览 jaokuohsuan 更新于 2026-08-23

一种集成,允许 Cursor AI 通过 Draw Things API 使用自然语言提示生成图像。

MCP 服务配置

复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用

{
  "mcpServers": {
    "draw-things": {
      "args": [],
      "command": "draw-things-mcp-cursor"
    }
  }
}

该服务需要配置环境变量:DRAW_THINGS_URL

可用工具 (1 个)

该服务在 MCP 协议中暴露的工具,AI 可按需调用

generateImage 8 个参数

Generate an image based on a prompt

该工具无需必填参数,直接调用即可

服务介绍

Draw Things MCP

使用 Model Context Protocol (MCP) 将 Draw Things API 集成到 Cursor 中。

先决条件

  • Node.js >= 14.0.0
  • 在 http://127.0.0.1:7888 上运行的 Draw Things API

安装

# Install globally
npm install -g draw-things-mcp-cursor

# Or run directly
npx draw-things-mcp-cursor

Cursor 集成

要在 Cursor 中设置此工具,请参阅 cursor-setup.md 中的详细指南。

快速设置:

  1. 创建或编辑 ~/.cursor/claude_desktop_config.json:
{
  "mcpServers": {
    "draw-things": {
      "command": "draw-things-mcp-cursor",
      "args": []
    }
  }
}
  1. 重启 Cursor
  2. 在 Cursor 中使用:generateImage({"prompt": "一只可爱的小猫"})

命令行使用

生成图片

echo '{"prompt": "your prompt here"}' | npx draw-things-mcp-cursor

参数

  • prompt: 图片生成的文字提示(必需)
  • negative_prompt: 图片生成的负面提示
  • width: 图片宽度(默认:360)
  • height: 图片高度(默认:360)
  • steps: 生成步骤数(默认:8)
  • model: 用于生成的模型(默认:"flux_1_schnell_q5p.ckpt")
  • sampler: 采样方法(默认:"DPM++ 2M AYS")

示例:

echo '{
  "prompt": "a happy smiling dog, professional photography",
  "negative_prompt": "ugly, deformed, blurry",
  "width": 360,
  "height": 360,
  "steps": 4
}' | npx draw-things-mcp-cursor

MCP 工具集成

当作为 MCP 工具在 Cursor 中使用时,该工具将注册为 generateImage 并具有以下参数:

{
  prompt: string;       // Required - The prompt to generate the image from
  negative_prompt?: string;  // Optional - The negative prompt
  width?: number;       // Optional - Image width (default: 360)
  height?: number;      // Optional - Image height (default: 360)
  model?: string;       // Optional - Model name
  steps?: number;       // Optional - Number of steps (default: 8)
}

生成的图片将保存在 images 目录中,文件名格式为:
<sanitized_prompt>_<timestamp>.png

响应格式

成功:

{
  "type": "success",
  "content": [{
    "type": "image",
    "data": "base64 encoded image data",
    "mimeType": "image/png"
  }],
  "metadata": {
    "parameters": { ... }
  }
}

错误:

{
  "type": "error",
  "error": "error message",
  "code": 500
}

故障排除

如果遇到问题:

  • 确保 Draw Things API 正在 http://127.0.0.1:7888 上运行
  • 如果与 Cursor 一起使用,请检查 ~/.cursor/logs 中的日志文件
  • 确保 src/index.js 有执行权限:chmod +x src/index.js

许可证

MIT

相关 MCP 服务