The editor writes the component. It should make the image too.
A placeholder rectangle is a small lie you tell yourself at the start of a build and pay for at the end. With an image MCP server connected, Cursor fills those rectangles as it goes — real art, correctly sized, compressed, referenced from the file it just wrote.
Where the file goes
~/.cursor/mcp.jsonEvery project on this machine. Keep your key here.
.cursor/mcp.jsonThis repository only. Committable — reference an env var, never the raw key.
{
"mcpServers": {
"imagemcp": {
"url": "https://mcp.imagemcpserver.com/mcp",
"headers": {
"x-api-key": "sk-img-gen-your_key_here"
}
}
}
}no local process — Cursor talks to the endpoint itself
{
"mcpServers": {
"imagemcp": {
"command": "npx",
"args": [
"-y", "mcp-remote", "https://mcp.imagemcpserver.com/mcp",
"--header", "x-api-key:sk-img-gen-your_key_here"
]
}
}
}works with any MCP client that can spawn a process
After saving, reload Cursor and check the MCP section of settings — the server should report as connected with its tools listed. If it does not, the JSON is usually the culprit.
What it feels like in agent mode
“Build the testimonials section. Use real avatars, not initials — generate them, keep the style consistent, and make sure nothing is over 60 KB.”
list_modelspicks a fast model for six near-identical portraitsmulticall → generate_transparent_image × 6one reference image keeps all six in the same stylecompress_image × 6WebP at quality 70 — avatars render at 56pxWrite TestimonialCard.jsxthe component and the assets land in the same commitWrite the rules once
Cursor follows project rules far more consistently than it follows a preference you mentioned three prompts ago. A short block about images saves you from re-explaining aspect ratios and file sizes on every feature.
- Name the aspect ratios your layout actually uses.
- State a maximum file size — it turns compression into a habit.
- Say when to ask before spending credits.
- Point at a reference image so a series stays a series.
.cursor/rules/images.mdc
Images come from the imagemcp MCP server. - Heroes are 21:9, cards are 4:3, avatars are 1:1. - Always compress to WebP before writing into /public. Nothing over 200 KB. - Reuse public/brand/reference.png as a referenceImage so styles match. - Ask before generating more than five images in one run.
Cursor setup questions
Where do I put the MCP config in Cursor?
Two places. ~/.cursor/mcp.json applies to every project on your machine. .cursor/mcp.json inside a repository applies to that project only and can be committed so the whole team gets the same tools — as long as the key itself is not in it.
Should I use the direct URL or the npx bridge?
Try the direct url + headers form first; it needs no Node process. If your Cursor version does not pick it up, fall back to the mcp-remote command form, which works with any MCP client that can spawn a process.
Do the tools work in Composer and in the chat?
Anywhere the agent can call tools. The practical value shows up in agent mode, where it can generate an asset and edit the file that references it in the same run.
How do I stop it generating images I did not ask for?
Put the rule in your project rules file: only generate images when explicitly asked, and always check the credit balance first. Agents follow written instructions about tools far more reliably than they follow implied ones.
Is there a way to see what it spent?
Yes. Every call from every client lands in the request log in the dashboard with its tool, model and exact credit cost — that is the ledger, not the chat transcript.