How to Generate Images with Cursor Using MCP Tools

Cursor is an AI-powered code editor, but coding projects regularly need visual assets: placeholder images, logo drafts, hero illustrations, social cards. Generating those normally means switching to a browser, opening an image tool, and bringing the result back into your project. With the right MCP connection, Cursor handles it without you leaving the editor.

Why This Matters

AgentPatch exposes a Recraft-based image generation tool through MCP. Recraft produces realistic photos, digital illustrations, and vector-style graphics from text descriptions. Connect it to Cursor and you gain that capability inside every chat and Composer session.

The agent uses the tool when the task calls for it. You don’t write the API call or manage a Recraft account. You describe what you need and Cursor produces it.

Setup

The AgentPatch CLI is designed for AI agents to use via shell access. Install it, and your agent can discover and invoke any tool on the marketplace.

Install (zero dependencies, Python 3.10+):

pip install agentpatch

Set your API key:

export AGENTPATCH_API_KEY=your_api_key

Example commands your agent will use:

ap search "web search"
ap run google-search --input '{"query": "test"}'

Get your API key from the AgentPatch dashboard.

  1. Open Cursor Settings (Cmd+Shift+J on Mac, Ctrl+Shift+J on Windows/Linux).
  2. Navigate to the MCP section in the sidebar.
  3. Click Add new global MCP server.
  4. Cursor opens ~/.cursor/mcp.json. Add the AgentPatch server config:
{
  "mcpServers": {
    "agentpatch": {
      "url": "https://agentpatch.ai/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_API_KEY"
      }
    }
  }
}
  1. Replace YOUR_API_KEY with your actual key from the AgentPatch dashboard.
  2. Save and restart Cursor. It discovers all AgentPatch tools automatically.

Example

You’re scaffolding a landing page and need a hero image. In Cursor’s chat, you ask:

“Generate an abstract illustration of connected nodes forming a network, dark background with bright accent colors. Save it to public/images/hero.png.”

Cursor calls the Recraft image generation tool through AgentPatch, produces the image, and saves it to your project. You can reference it in your markup right away.

Another common case: you’re building a component library and want visual references for documentation.

“Create a clean illustration showing a card component with a header, body text, and action button. Light theme, minimal style.”

Cursor generates the image and you can drop it into your docs without opening another application.

Iteration works naturally in the same conversation:

“Try again with a dark theme and more rounded corners on the card.”

Cursor calls the tool again with the updated description. The feedback loop stays inside the editor.

For more practical tasks, image generation is useful for README diagrams, blog post illustrations, and placeholder content during development. Any situation where you’d normally pause coding to go create an image is a candidate.

Wrapping Up

Image generation is one tool in the AgentPatch marketplace. The same MCP connection also gives Cursor access to web search, Google Maps, email, YouTube transcripts, and more. One configuration, full marketplace access. Visit agentpatch.ai to get started.