
How to add openai-gpt-image-mcp to Windsurf
MCP server for OpenAI GPT-4o / gpt-image-1 image generation and editing. Paste the config into ~/.codeium/windsurf/mcp_config.json and restart Windsurf.
Last updated June 14, 2026 · 102★ · stdio · apikey
Windsurf config for openai-gpt-image-mcp
git clone https://github.com/SureScaleAI/openai-gpt-image-mcp.git && cd openai-gpt-image-mcp && yarn install && yarn build{
"mcpServers": {
"openai-gpt-image-mcp": {
"command": "node",
"args": [
"/absolute/path/to/dist/index.js"
],
"env": {
"OPENAI_API_KEY": "sk-..."
}
}
}
}Setup steps
- 1Open Windsurf → Cascade → the hammer/MCP icon → Configure (or edit ~/.codeium/windsurf/mcp_config.json).
- 2Paste the openai-gpt-image-mcp config below.
- 3Fill in placeholder secrets, then save.
- 4Click Refresh in the MCP panel.
- 5openai-gpt-image-mcp's tools become available to Cascade.
Before you start
- Node.js (to run the built dist/index.js)
- Yarn (for install and build)
- An OpenAI API key with image API access (OPENAI_API_KEY), or Azure OpenAI credentials (AZURE_OPENAI_API_KEY, AZURE_OPENAI_ENDPOINT, OPENAI_API_VERSION)
- A verified OpenAI organization (image API access can take 15–20 minutes to activate after verification)
What openai-gpt-image-mcp can do in Windsurf
create-imageGenerate images from a text prompt, with advanced options (size, quality, background, etc). Set n to generate up to 10 images at once. Output can be returned as base64 or saved to disk.
edit-imageEdit or extend images using a prompt and an optional mask (inpainting, outpainting, compositing). Supports both file path and base64 input; provide a mask image to control where edits are applied.
Security
Requires an OpenAI API key (OPENAI_API_KEY) or Azure OpenAI credentials, supplied via the client config env block or an --env-file. Your OpenAI organization must be verified to access the image API; activation can take 15–20 minutes after verification. The key grants billable access to OpenAI's image APIs, so keep it scoped and out of source control.
openai-gpt-image-mcp + Windsurf FAQ
Where is the Windsurf config file?
Windsurf reads MCP servers from ~/.codeium/windsurf/mcp_config.json. Paste the openai-gpt-image-mcp config there under the "mcpServers" key and restart the client.
Is openai-gpt-image-mcp safe to use with Windsurf?
Requires an OpenAI API key (OPENAI_API_KEY) or Azure OpenAI credentials, supplied via the client config env block or an --env-file. Your OpenAI organization must be verified to access the image API; activation can take 15–20 minutes after verification. The key grants billable access to OpenAI's image APIs, so keep it scoped and out of source control.
Which models and providers are supported?
It targets OpenAI's GPT-4o / gpt-image-1 image generation and editing APIs, and also supports Azure OpenAI deployments by supplying AZURE_OPENAI_API_KEY, AZURE_OPENAI_ENDPOINT, and OPENAI_API_VERSION.
How are large images handled?
MCP clients have a hard 1MB limit for tool responses. If the total image size exceeds 1MB, the server automatically saves images to disk and returns the file path(s) instead of base64. Set MCP_HF_WORK_DIR to control where files are saved (defaults to /tmp).
Why can't I access the image API even with a valid key?
You must have a verified OpenAI organization. After verifying, it can take 15–20 minutes for image API access to activate. Also ensure file paths passed to the tools are absolute.