Skip to main content

April 2026

How to set up MCP image generation in Cursor

Your launch post needs an OG image. You have three minutes before the standup. Here is the working path from "Cursor open" to "PNG in public/og/launch.png" without leaving the editor.

Cursor 0.45 added first-class MCP server support, which means an agent inside the editor can call any compliant tool server the same way it calls a file edit. AgentFramer ships an MCP endpoint with five tools wired to a managed image, video, and audio backend: generate_image, generate_video, generate_audio, get_generation, and get_credits. Once the connection is live, the agent treats media generation like any other capability. No SDK install, no Python sidecar, no per-provider key juggling.

This is the full setup. Real config files, the JSON payload Cursor actually sends, the prompts that work, and the failure modes that eat the most time when you skip ahead.

What you need

  • Cursor 0.45 or newer. MCP support shipped in 0.45.
  • An AgentFramer workspace. Sign up here if you don't have one.
  • A repo open in Cursor. Anything works.
  • Three minutes.

Step 1: copy your MCP URL

In the AgentFramer dashboard, the home tab shows a single MCP URL for your workspace. It looks like https://mcp.agentframer.com/mcp/ws_… with a token in the path. The token is workspace-scoped, so anyone with the URL can burn your credits. Treat it like a database password: never paste it into a public repo, a screenshot, or a Slack channel that gets indexed.

Click the copy button. Copy the entire string, token included. The most common reason "Cursor can't connect" is a half-copied URL.

Step 2: add the server in Cursor

Open Cursor, then Settings → MCP → Add new MCP server. Cursor accepts both URL-based servers (HTTP MCP) and command-based servers (stdio). AgentFramer is URL-based, so choose that option.

Give the server a name like agentframer, paste the URL, and save. Within a second or two, Cursor handshakes the server and reads the tool list. You should see a green dot next to the server name, and the five tools listed under it. If the dot stays red, jump to the gotchas at the bottom.

Step 3: scope it per-project (optional, recommended)

The Settings UI writes to your global config at ~/.cursor/mcp.json. That works, but a per-repo config at .cursor/mcp.json is usually what you want, because it commits the connection alongside the project and keeps team members on the same tool surface. Cursor reads project-level config first and merges the global on top.

Drop this in .cursor/mcp.json:

{
  "mcpServers": {
    "agentframer": {
      "url": "https://mcp.agentframer.com/mcp/ws_REPLACE_WITH_TOKEN"
    }
  }
}

Add .cursor/mcp.json to .gitignore if your token sits in it directly. A cleaner pattern: keep a checked-in template at .cursor/mcp.example.json, and have each teammate copy it and paste their own workspace URL. Workspace tokens are per-user, so this also gives you per-developer usage attribution in the dashboard.

Step 4: pin defaults with .cursorrules

An agent with five new tools and no guidance will pick the most expensive model on its first try. Cursor reads project rules from .cursorrules at the repo root, or from any .mdc file under .cursor/rules/. Use one to pin the model, set a budget ceiling, and describe how images should land in the repo.

# Image generation rules

When generating images via the agentframer MCP server:

- Default to FLUX schnell for drafts and exploration.
- Escalate to FLUX 1.1 pro only for finals or when I say "high quality".
- Never spend more than $1 per session without confirming with me.
- Save assets under public/og/ for OG images, public/img/ for everything else.
- After generation, write the URL to scripts/og.url before downloading.
- If a tool returns insufficient_credits, stop and ask. Do not retry.

You can read more about model trade-offs on the models page and credit economics on pricing. Two lines in .cursorrules is usually enough to keep the agent from drifting toward $0.20 generations when a $0.003 draft would do.

Step 5: generate something real

Open Cursor chat and paste a concrete brief. Try this:

"Generate a 1200×630 OG image for the launch post titled 'MCP-native media generation' on a dark background with a soft purple gradient. Save the URL to scripts/og.url, then download the file to public/og/launch.png."

Behind the scenes, Cursor expands that into a tool call. The actual payload that hits the MCP server looks roughly like this:

{
  "name": "generate_image",
  "arguments": {
    "model": "flux-schnell",
    "prompt": "Launch post OG image, headline 'MCP-native media generation', dark background, soft purple gradient, clean editorial layout",
    "width": 1200,
    "height": 630,
    "seed": 42
  }
}

The tool returns a generation id and a URL. Cursor polls get_generation until the status flips to succeeded, then writes the URL to scripts/og.url and runs curl (or whatever your shell tooling is) to download the PNG into public/og/launch.png. You watch this happen in the chat. Total time on a draft model is usually under five seconds.

Iterate by replying in the same thread: "tighten the gradient", "more contrast on the headline", "regenerate at FLUX 1.1 pro for the final". The agent reuses the seed and prompt context, so each revision is a small delta rather than a fresh roll.

Common gotchas

  • Half-copied URL. The token is part of the path, not a header. If Cursor shows a red dot or "failed to connect", re-copy the entire URL from the dashboard.
  • "No tools available" in chat. Cursor caches the tool list at startup. After adding a server, fully quit and relaunch Cursor (Cmd-Q on macOS, not just close window).
  • insufficient_credits. The tool returns a structured error. Have the agent run get_credits to confirm balance, then top up in the dashboard. Do not let the agent retry in a loop, set a rule against it.
  • Project rules ignored. If .cursorrules is not picked up, check that it sits at the repo root and that you opened the repo as a Cursor workspace (not a single file).
  • Token in git history. If you committed a token by accident, rotate it from the dashboard immediately. Old tokens are revoked on rotation.

Beyond image

The same connection covers the rest of the surface. Ask Cursor to "generate a 6-second video of the OG image animating in" and it calls generate_video. Ask for a "30-second voiceover of the launch headline in a calm narrator voice" and it calls generate_audio. No second integration, no second token. The tool-call patterns guide has end-to-end recipes for chained workflows like image-to-video and prompt-to-podcast.

Where Cursor MCP image generation falls short

This setup is excellent for the 80 percent case: dev-time assets, OG images, draft mocks, README hero shots, blog inline figures, quick concept exploration. It is the wrong tool for three jobs.

  • Heavy art direction. If your brief runs to a page, with reference images, character sheets, and per-shot composition notes, you want a dedicated tool with an inpainting canvas, layer control, and node-based pipelines. A chat thread is a poor surface for that workload.
  • Brand-locked aesthetics. If every output has to match a tightly controlled visual system (specific fonts, illustration style, mascot proportions), you need finetuned models, brand-conditioning embeddings, and a designer in the loop. Cursor plus an off-the-shelf MCP model will drift on every third generation.
  • Large catalog batches. If you are rendering 10,000 product variants for an e-commerce catalog, do not run that through an editor chat. Hit the AgentFramer API or batch pipeline directly with structured inputs, idempotency keys, and a job queue. The MCP-in-Cursor flow is interactive by design and does not amortize well over thousands of calls.

For everything else (the image you needed five minutes ago, in the editor where you already are) this is the shortest path. Wire it up once, pin sane defaults, and your agent stops being a code-only tool. For a deeper tour of the MCP surface, see the MCP help docs.