RE
OfficialAI & MLMedia

Recraft MCP Server: Generate, Edit & Vectorize Images

Generate, edit, upscale and vectorize raster and SVG images on the Recraft MCP server—create custom styles and convert images instantly.

Quick Install
npx -y @recraft-ai/mcp-recraft-server

Overview

The Recraft MCP Server implements a Model Context Protocol (MCP) gateway for image generation, editing, upscaling and vectorization. It exposes an HTTP API that wraps image models and utilities so you can programmatically create raster and SVG assets, apply custom styles, edit images with masks, and convert bitmap artwork into scalable vector graphics. The server is intended for teams and developers who want to integrate image production and conversion into web apps, design systems, or automated pipelines.

Because it follows MCP principles, the server is designed to be modular and model-agnostic: you can run it locally, deploy it behind your own infrastructure, and connect it to multiple back-end model providers. It handles common tasks such as file storage, input validation, multipart uploads, and producing standard responses so clients can be written once and used against different model backends.

Features

  • Generate new raster (PNG/JPEG) images from text prompts or sketches
  • Edit existing images using masks (inpainting and compositing)
  • Upscale images with configurable scale factors and quality settings
  • Vectorize raster images into SVG output for icons or illustrations
  • Support for styles/presets to reproduce custom looks consistently
  • Local storage option and streaming responses for large assets
  • Simple REST endpoints compatible with MCP-style integrations
  • Docker and local development modes for quick setup

Installation / Configuration

Clone the repository, configure environment variables, and run with Docker Compose or locally (Node.js).

  1. Clone the repo
git clone https://github.com/recraft-ai/mcp-recraft-server.git
cd mcp-recraft-server
  1. Create a .env file (example)
# Server
PORT=8080
HOST=0.0.0.0

# Authentication / provider keys (if required by your backends)
RECRAFT_API_KEY=your_provider_key_here

# Storage
STORAGE_PATH=./data

# Optional
ALLOW_CORS=true
  1. Run with Docker Compose
docker-compose up --build
# Server will be available at http://localhost:8080
  1. Run locally (Node-based dev)
npm ci
npm run dev
# or
npm run start

Adjust environment settings to point the server at your preferred model backends or object storage.

Available Resources

The server exposes a compact set of HTTP endpoints to perform the common image operations. Below is a typical mapping — consult the running server’s /openapi or /docs endpoint for the exact contract your deployment provides.

EndpointMethodPurpose
/generatePOSTProduce a new image from a text prompt or parameters
/editPOSTEdit an existing image via mask + prompt (inpainting/compositing)
/upscalePOSTUpscale an uploaded image (scale, quality options)
/vectorizePOSTConvert uploaded raster image into SVG vector output
/stylesGET/POSTList and create reusable style presets

Example: generate an image (JSON)

curl -X POST http://localhost:8080/generate \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A minimal flat icon of a rocket, pastel colors",
    "width": 512,
    "height": 512,
    "style": "flat-icon"
  }' --output rocket.png

Example: edit via multipart (image + mask)

curl -X POST http://localhost:8080/edit \
  -F "image=@/path/to/image.png" \
  -F "mask=@/path/to/mask.png" \
  -F 'prompt=Replace masked area with a blue gradient background'
  -o edited.png

Example: vectorize (returns SVG)

curl -X POST http://localhost:8080/vectorize \
  -F "image=@/path/to/raster.png" \
  -F "threshold=0.5" \
  -o icon.svg

Use Cases

  • E-commerce: Generate product variants (background removal, consistent stylized shots) and automatically upscale photos for different display sizes.
  • Design systems: Convert designer raster icons into clean SVGs and create a library of style presets to keep assets consistent across products.
  • Game development: Batch-generate and stylize sprites and game UI elements using textual prompts and presets.
  • Marketing automation: Produce hero images and social post artwork programmatically, then vectorize logos and icons for responsive layouts.
  • Accessibility and localization: Recreate imagery with alternative color palettes or simplified shapes for accessibility or regional branding.

Developer Notes

  • Authentication: Add API key checks or a reverse proxy if deploying publicly. Use environment variables to supply provider credentials (RECRAFT_API_KEY or equivalents).
  • Storage: By default the server can persist to a local directory. Swap in S3-compatible storage for production by updating configuration/environment.
  • Extensibility: The server is model-agnostic — you can add or swap back-end image generators, upscalers, and vectorizers by implementing the adapter interfaces and wiring them into the configuration.
  • Documentation: After starting the server, look for built-in API docs (e.g., /docs or /openapi.json) to see full request/response schemas for your deployed instance.

Repository and source: https://github.com/recraft-ai/mcp-recraft-server