Image generation in Roo Code: MCP server setup
Add the Image MCP Server to Roo Code’s global mcp_settings.json or a project .roo/mcp.json with "type": "streamable-http" — omitting type, or writing "http", fails. Roo Code plans a change and then executes it mode by mode. Image tools slot into that plan the same way an edit does, so the asset arrives with the markup rather than after it.
Add the server
- Where the config lives
- mcp_settings.json (global) · .roo/mcp.json (project, wins on conflict)
- The key it nests under
- mcpServers
- 1
Create an API key. Create a key in the Image MCP Server dashboard.
- 2
Open MCP settings. Edit the global mcp_settings.json, or create .roo/mcp.json in the project root.
- 3
Add the entry with an explicit type. Set "type": "streamable-http" — Roo will not guess it from the url.
- 4
Auto-approve the cheap tools. Put the free and single-credit tools in alwaysAllow and keep approval on for model-priced ones.
The server reads the key from an x-api-key header, an Authorization: Bearer header or a ?apikey= query parameter — see authentication. What each tool costs is on the credits page.
{
"mcpServers": {
"imagemcp": {
"type": "streamable-http",
"url": "https://mcp.imagemcpserver.com/mcp",
"headers": { "x-api-key": "sk-img-gen-…" },
"alwaysAllow": [
"get_user_info", "list_models",
"compress_image", "convert_format"
],
"disabled": false
}
}
}{
"mcpServers": {
"imagemcp": {
"command": "npx",
"args": [
"-y", "mcp-remote", "https://mcp.imagemcpserver.com/mcp",
"--header", "x-api-key:${env:IMAGEMCP_API_KEY}"
]
}
}
}The type field is not optional
Roo Code will not infer the transport from the presence of a url. Its docs make type required for a remote server, and it has to be "streamable-http", hyphenated. If a server name exists in both the global file and .roo/mcp.json, the project file wins.
Check it connected in Roo Code
In Roo Code’s MCP server list, imagemcp should be enabled with its tools listed. Then ask for your image credit balance: get_user_info is free, and it is the first call that actually checks the key, because the server lists its tools without one.
Example workflow in Roo Code
Images that arrive with the markup
- 1
Auto-approve by cost
Keep get_user_info, list_models, compress_image and convert_format in alwaysAllow, and leave generation on manual approval.
- 2
Put the images in the plan
Ask Roo to include the images in its plan, so the generate_image calls sit next to the edits that reference them.
- 3
Approve the expensive calls
Each generate_image call stops for approval and bills the model’s rate, 15 credits on the default model; the compression that follows runs without asking, at 1 credit.
When Roo Code will not connect
| Symptom | Usual cause | Fix |
|---|---|---|
| The server fails to connect | type is missing or says "http". | Set "type": "streamable-http". |
| Your global entry is ignored in one repository | .roo/mcp.json defines a server with the same name, and the project file wins. | Rename one of them, or edit the project entry. |
| A committed config needs the key | Roo documents ${env:VAR} substitution for args, not for headers. | Commit the mcp-remote form above, which carries the key in args, and keep header-based entries in the global file. |
Once Roo Code is connected
Roo Code gets the server’s 8 image tools, plus 3 utility tools for the credit balance, the model list and batching: 11 MCP tools in all. The ones most setups reach for first are the AI image generation API, Background removal API and Transparent PNG generator API; each page covers what the tool does and what a call costs. If the protocol itself is new to you, what is MCP explains how a client like Roo Code finds these tools and calls them.
- generate_image · 8–30 creditsAI image generation APIText-to-image and image-to-image, any live model
- remove_background · 8 creditsBackground removal APICut the subject out in one call
- generate_transparent_image · 16–38 creditsTransparent PNG generator APIGenerate and cut out in one call
- Use caseAI images for landing pagesThe complete workflow, with the calls in order and what each one costs.
Setting up another client too? The Kilo Code MCP setup and Cline MCP setup guides use the same endpoint and key in a different config shape.
Roo Code questions
How do I add an MCP server to Roo Code?
Edit mcp_settings.json for a global server, or .roo/mcp.json in the project root for a project-scoped one. The project file takes precedence when a server name appears in both.
Why does my Roo Code MCP server fail to connect?
The type field. Roo Code requires "type": "streamable-http" for a remote HTTP server; "http" or an omitted type will not work.
What does alwaysAllow actually do?
It is a per-tool list of calls Roo can make without stopping to ask. The useful split is by cost: auto-approve the free lookups and the single-credit conversions, keep approval on for anything that calls an image model.
Can I commit the project config?
Yes, as long as the key is not in it. Roo documents ${env:VARIABLE_NAME} substitution inside args, so the committable form runs the mcp-remote bridge and passes --header x-api-key:${env:IMAGEMCP_API_KEY}. Each developer exports the variable in their own environment.
Does this work in Kilo Code too?
Not as written. Kilo Code started as a fork, but its current docs configure MCP servers under an mcp key in kilo.jsonc with "type": "remote", not under mcpServers. The Kilo Code page has its own block.
Sources & references