Gpt
FreeNot checkedA local MCP server that enables Claude to generate images using the OpenAI API.
About
A local MCP server that enables Claude to generate images using the OpenAI API.
README
A tiny local MCP server that lets Claude generate images with the OpenAI API.
It runs on your machine, so it reaches OpenAI over your network — which is why it works even though Claude's own sandbox can't call api.openai.com directly.
Two tools (on purpose)
Both generate an image the same way; they differ only in how the result comes back, so you can compare:
| Tool | Returns | Best for | Tradeoff |
|---|---|---|---|
generate_image_to_file |
A file path (writes the PNG to disk) | Real, full-res assets | Lossless, cheap on context. Claude reads the file from disk. |
generate_image_bytes |
The image inline (base64 image block) | Small previews / icons | Claude sees it immediately, but can't perfectly re-save large images, and big files are heavy to pass. |
Rule of thumb: use generate_image_to_file for anything you want to keep; use generate_image_bytes to eyeball a quick result.
Setup
cd gpt-mcp
npm install
Get an API key from https://platform.openai.com/api-keys. For local testing you can copy .env.example → .env and paste it in. In Cowork / Claude Code you instead pass it via the server config (below).
Test it standalone (optional)
The MCP Inspector gives you a UI to call the tools directly:
OPENAI_API_KEY=sk-... npm run inspect
Register it with Claude
Claude Code (CLI):
claude mcp add gpt-mcp \
-e OPENAI_API_KEY=sk-your-key \
-e GPT_MCP_OUTPUT_DIR="/Users/kavindu/Documents/Claude/Projects/personal finance tracker/financial-app/src/assets" \
-- node "/Users/kavindu/Documents/Claude/Projects/personal finance tracker/gpt-mcp/src/index.js"
Config file (Cowork / Claude Desktop / any MCP client) — add under mcpServers:
{
"mcpServers": {
"gpt-mcp": {
"command": "node",
"args": [
"/Users/kavindu/Documents/Claude/Projects/personal finance tracker/gpt-mcp/src/index.js"
],
"env": {
"OPENAI_API_KEY": "sk-your-key",
"GPT_MCP_OUTPUT_DIR": "/Users/kavindu/Documents/Claude/Projects/personal finance tracker/financial-app/src/assets"
}
}
}
}
After it's connected, Claude can call generate_image_to_file / generate_image_bytes.
Parameters
Both tools accept:
prompt(required) — what to draw.size—1024x1024·1536x1024·1024x1536·auto(defaultauto).quality—low·medium·high·auto(defaultauto; higher = more cost).background—transparent·opaque·auto. Usetransparentfor logos/icons.output_format—png·webp·jpeg(defaultpng).
generate_image_to_file additionally accepts:
filename— name without extension (default: a slug of the prompt + timestamp).output_dir— where to save (default:GPT_MCP_OUTPUT_DIR, else./generated-images).
Environment variables
| Var | Required | Purpose |
|---|---|---|
OPENAI_API_KEY |
yes | Your OpenAI key. |
OPENAI_IMAGE_MODEL |
no | Defaults to gpt-image-1. |
GPT_MCP_OUTPUT_DIR |
no | Default save folder for generate_image_to_file. |
Notes
- Images cost money on your OpenAI account (billed per image, higher quality costs more).
- The server only logs to stderr — stdout is reserved for the MCP protocol.
node18+ required (uses built-infetch).
Install Gpt in Claude Desktop, Claude Code & Cursor
unyly install gpt-mcpInstalls into Claude Desktop, Claude Code, Cursor & VS Code — handles npx, uvx and build-from-source repos for you.
First time? Get the CLI: curl -fsSL https://unyly.org/install | sh
Or configure manually
Run in your terminal:
claude mcp add gpt-mcp -- npx -y gpt-mcpFAQ
Is Gpt MCP free?
Yes, Gpt MCP is free — one-click install via Unyly at no cost.
Does Gpt need an API key?
No, Gpt runs without API keys or environment variables.
Is Gpt hosted or self-hosted?
Self-hosted: the server runs locally on your machine via the install command above.
How do I install Gpt in Claude Desktop, Claude Code or Cursor?
Open Gpt on unyly.org, pick your client tab (Claude Desktop, Claude Code, Cursor) and press Install — the config is generated automatically, no JSON editing.
Related MCPs
Fetch
Web content fetching and conversion for efficient LLM usage.
AWS KB Retrieval
Retrieval from AWS Knowledge Base using Bedrock Agent Runtime.
by modelcontextprotocolSpring AI MCP Server
Provides auto-configuration for setting up an MCP server in Spring Boot applications.
llm-analysis-assistant
A very streamlined mcp client that supports calling and monitoring stdio/sse/streamableHttp, and can also view request responses through the /logs page. It also
by xuzexin-hzCompare Gpt with
Not sure what to pick?
Find your stack in 60 seconds
Author?
Embed badge for your README
Browse similar
All ai MCPs
