Draw Things MCP server

Integrates with the Draw Things API to convert text prompts or JSON inputs into JSON-RPC requests, enabling AI image generation capabilities with automatic saving and error handling.
Back to servers
Provider
James Jao
Release date
Mar 06, 2025
Language
TypeScript
Stats
8 stars

This server implements the Model Context Protocol (MCP) to integrate Draw Things API with Cursor, allowing you to generate AI images directly from the Cursor environment. It provides a bridge between Cursor's interface and Draw Things' image generation capabilities.

Prerequisites

Installation

You can install the MCP server globally or run it directly:

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

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

Setup in Cursor

To integrate with Cursor:

  1. Create or edit ~/.cursor/claude_desktop_config.json:
{
  "mcpServers": {
    "draw-things": {
      "command": "draw-things-mcp-cursor",
      "args": []
    }
  }
}
  1. Restart Cursor
  2. Use in Cursor with: generateImage({"prompt": "a cute cat"})

Usage Options

Command Line Usage

You can generate images directly from the command line:

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

Available Parameters

  • prompt: The text prompt for image generation (required)
  • negative_prompt: The negative prompt for image generation
  • width: Image width (default: 360)
  • height: Image height (default: 360)
  • steps: Number of steps for generation (default: 8)
  • model: Model to use for generation (default: "flux_1_schnell_q5p.ckpt")
  • sampler: Sampling method (default: "DPM++ 2M AYS")

Example with Custom Parameters

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

Using as a Tool in Cursor

When used as an MCP tool in Cursor, it's registered as generateImage with these parameters:

{
  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)
}

Generated images are saved in the images directory with filenames in this format: <sanitized_prompt>_<timestamp>.png

Response Format

Success Response

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

Error Response

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

Troubleshooting

If you encounter issues:

  • Ensure Draw Things API is running at http://127.0.0.1:7888
  • Check log files in ~/.cursor/logs if using with Cursor
  • Make sure src/index.js has execution permissions: chmod +x src/index.js

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later