Image generation in Antigravity: MCP server setup
Add the Image MCP Server to ~/.gemini/config/mcp_config.json, or .agents/mcp_config.json inside a workspace, with its endpoint in serverUrl (url also works) and the key as a header. 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 Image MCP Server dashboard.
- 2
Open the raw config. Agent panel → … → MCP Servers → Manage MCP Servers → View raw config.
- 3
Add the entry with serverUrl. Use serverUrl (or url) for the endpoint and pass the key in headers. Not httpUrl.
- 4
Restart the server. Use ⋮ → Restart in the app’s MCP Servers list, or reload from the /mcp manager in the CLI.
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": {
"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.
In the Antigravity app, Customizations → Installed →
MCP Servers has ⋮ → Restart per server. In the CLI,
/mcp opens the MCP manager, which can reload configs.serverUrl or url, but never httpUrl
Antigravity’s documented field is serverUrl, and url is accepted too, so a block from Cursor or Claude Code connects. What fails is Gemini CLI’s httpUrl spelling and anything on the legacy HTTP+SSE transport, which Antigravity does not support, even though both tools keep their config under ~/.gemini/.
Check it connected in Antigravity
In the Antigravity CLI, /mcp shows a status ring per server; in the app, check imagemcp is listed under MCP Servers. 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 Antigravity
Generate, look, adjust
- 1
Keep the key global
Put the entry in ~/.gemini/config/mcp_config.json, outside the repository, since env-variable substitution is not documented for this file.
- 2
Generate the artwork
Ask the agent for the images the page needs; generate_image is 15 credits on the default model.
- 3
Look, then edit
Antigravity can look at what it built, so ask it to review the page and fix what is off with edit_image, which bills at the model’s rate like generation.
When Antigravity will not connect
| Symptom | Usual cause | Fix |
|---|---|---|
| The entry never connects | It uses httpUrl, copied from Gemini CLI. | Use serverUrl or url; Antigravity does not accept httpUrl. |
| An older SSE endpoint is rejected | Antigravity supports Streamable HTTP only. | Point it at this server’s /mcp endpoint, which is Streamable HTTP. |
| Long generation calls time out | The server’s timeout is shorter than a slow model takes. | Raise timeoutSeconds on the entry. |
Once Antigravity is connected
Antigravity 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, AI image editing API and Background removal 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 Antigravity finds these tools and calls them.
- generate_image · 8–30 creditsAI image generation APIText-to-image and image-to-image, any live model
- edit_image · 8–30 creditsAI image editing APIEdit or restyle an image from a text instruction
- remove_background · 8 creditsBackground removal APICut the subject 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 Gemini CLI MCP setup and Windsurf MCP setup guides use the same endpoint and key in a different config shape.
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, serverUrl or httpUrl in Antigravity?
serverUrl is the documented field and url also works. httpUrl does not, and legacy SSE endpoints are rejected.
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 takes serverUrl or url. Configuring one does not configure the other.
How do I keep the API key out of the file?
Antigravity’s MCP docs do not document environment-variable substitution in mcp_config.json, so do not commit a workspace file with the key in it. Keep the server in the global ~/.gemini/config/mcp_config.json, which lives outside the repository.
Can I hide some of the image tools?
Yes. enabledTools is an allowlist and disabledTools a denylist of tool names on the server entry; anything left out is hidden from the agent.
Sources & references