Image generation in Antigravity: MCP server setup
Antigravity wants serverUrl, not url: add the entry to ~/.gemini/config/mcp_config.json, or .agents/mcp_config.json inside a workspace, and it reloads on save. Antigravity gives the agent a browser and an editor at once, so it can look at what it built. The one thing it still cannot do is produce the artwork that page needs.
Add the server
- Where the config lives
- ~/.gemini/config/mcp_config.json (global) · .agents/mcp_config.json (workspace)
- The key it nests under
- mcpServers
- 1
Create an API key. Create a key in the imagemcpserver dashboard.
- 2
Open the raw config. Agent panel → … → MCP Servers → Manage MCP Servers → View raw config.
- 3
Add the entry with serverUrl. Antigravity uses serverUrl for remote connections, not url.
- 4
Save to reload. Antigravity reloads MCP configuration on save — no restart required.
{
"mcpServers": {
"imagemcp": {
"serverUrl": "https://mcp.imagemcpserver.com/mcp",
"headers": { "x-api-key": "sk-img-gen-…" }
}
}
}Agent panel → … → MCP Servers
→ Manage MCP Servers → View raw config
That opens the same mcp_config.json you would edit by hand.
Save it and Antigravity reloads the server list; no restart.
Secrets can be referenced as ${VAR_NAME} rather than pasted.serverUrl — the Windsurf inheritance
Antigravity declares remote SSE, streamable HTTP and websocket connections through a serverUrl field. That is the same spelling Windsurf uses and it is shared ancestry rather than coincidence, but it means a config lifted from Cursor or Claude Code — both of which say url — will not connect. Note also that the file sits under ~/.gemini/, which it shares with Gemini CLI despite the two using different keys.
The endpoint and the key are identical in every client. The wrapper around them is not, and that wrapper is where almost every “correct” config that does nothing goes wrong. Checked September 2026 against Antigravity’s own documentation — see the sources below.
Three ways to send the key
The server resolves your API key from any of these, checked in this order. That matters when a client only gives you a URL field and no way to set a header — you are not stuck, and you do not need a bridge process.
Query parameter
?apikey=sk-img-gen-…Checked first. The fallback for a client whose config is a bare URL field.
x-api-key header
x-api-key: sk-img-gen-…The documented default, and what every client below uses unless noted.
Authorization header
Authorization: Bearer sk-img-gen-…Accepted as a bearer token, which is what a client with only a token field will send.
A key in a query string ends up in shell history, process listings and any log the client keeps, so prefer a header where the client allows one. Where it does not, treat the whole URL as the secret and rotate it as freely as you would a password.
What each tool costs
Wherever Antigravity lets you approve tools individually, the useful line to draw is not between image tools and other tools — it is between calls with a fixed price and calls that route to a model.
get_user_infolist_modelsfree
Safe to auto-approve wherever the client supports it. These are how the agent finds out what it can afford before it spends anything.
compress_imageconvert_format1 credit
Deterministic and cheap. Auto-approving these makes an optimisation pass over a whole folder painless.
remove_backgroundtext_to_svgupscale_image5–15 credits
Fixed prices, no model routing. Auto-approve once you trust the workflow.
generate_imageedit_imagegenerate_transparent_imagemulticallmodel-priced
These route to an image model and are the ones that can run up a bill in a loop. Keep approval on.
Antigravity questions
Where is the Antigravity MCP config file?
Globally at ~/.gemini/config/mcp_config.json, or per workspace at .agents/mcp_config.json in the project root. The IDE can open it for you via the agent panel’s MCP Servers screen.
Is it url or serverUrl in Antigravity?
serverUrl. Remote SSE, streamable HTTP and websocket connections all declare the endpoint in serverUrl, so a config using url will not connect. Checked September 2026.
Antigravity and Gemini CLI both use ~/.gemini — is the config shared?
They share the directory, not the file or the schema. Gemini CLI reads settings.json and wants httpUrl; Antigravity reads config/mcp_config.json and wants serverUrl. Configuring one does not configure the other.
How do I keep the API key out of the file?
Reference it as ${VAR_NAME} — Antigravity does environment variable substitution, which is the documented way to keep secrets out of a committed workspace config.
Do I need to restart after editing?
No. Save the file and Antigravity reloads the MCP server configuration automatically.
Sources & references