2Xapi.com GPT-image MCP Server
Generates images via OpenAI-compatible text-to-image APIs, with configurable endpoints, models, sizes, and optional AI moderation.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@2Xapi.com GPT-image MCP ServerGenerate an image of a cozy cabin in the snowy mountains at sunset."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
2Xapi.com GPT-image MCP Server
把 OpenAI 兼容的文生图接口封装成 MCP 工具。接入 Claude Code / Codex / Cursor / Claude Desktop 等客户端后,对话里说「画一只柴犬」就能出图。每位用户使用自己的 API Key,消耗计费到各自账号。
🤖 AI 一键部署:把仓库地址发给任何 AI(Codex / Claude),它会读
AGENTS.md自动完成部署⚡ 一键脚本(二选一):
./install.sh(需先发布 GitHub Release):IMAGE_API_KEY=你的key ./install.sh,自动检测 claude/codex 并接入./deploy.sh(本地构建,不依赖 Release):./deploy.sh --client codex --key 你的key
📄 部署文档:
GPT-image MCP Server部署文档.md(约 5 分钟,含给 AI 的提示词模板)🐍 Python 版:
src/(手动部署用,支持uvx/uv run)⚡ npm 版:
gpt-image-mcp-server/(一键安装,推荐)
一键安装(npm 版,推荐)
前提:Node.js 18+。发布到 GitHub Releases 后:
Claude Code
claude mcp add -s user gpt-image \
--env IMAGE_API_KEY=你的key \
-- npx -y https://github.com/wenkezhi8/2Xapi.com-GPT-image-MCP-Server/releases/download/v0.1.0/gpt-image-mcp-server-0.1.0.tgzCodex
codex mcp add GPT-image \
--env IMAGE_API_KEY=你的key \
-- npx -y https://github.com/wenkezhi8/2Xapi.com-GPT-image-MCP-Server/releases/download/v0.1.0/gpt-image-mcp-server-0.1.0.tgzClaude Desktop / Cursor(手动配置)
{
"mcpServers": {
"GPT-image": {
"command": "npx",
"args": ["-y", "https://github.com/wenkezhi8/2Xapi.com-GPT-image-MCP-Server/releases/download/v0.1.0/gpt-image-mcp-server-0.1.0.tgz"],
"env": {
"IMAGE_API_KEY": "你的key"
}
}
}
}Related MCP server: Flow2API MCP Server
环境变量
变量 | 作用 | 必填 |
| 你自己的 API Key(计费到你的账号) | ✅ |
| 覆盖接口根地址(到 | 按需 |
| 覆盖配置文件保存路径(默认 | 按需 |
key 与端点必须配套:你的 key 是哪家供应商的,端点就填哪家的。
默认端点说明
本项目默认端点:
https://2xa.cc.cd/v1—— 这是 2xapi.com 中转站的 OpenAI 兼容生图接口(官网 https://2Xapi.com),本 MCP 默认配套的就是这个方案。使用 2xapi.com 中转站的 API Key 可直接运行,无需配置端点。
如果想使用其他 API 端点(OpenAI 官方、Azure、其他中转站等),需要自己更换:
一键安装/npx 方式:设置环境变量
IMAGE_API_BASE_URL=https://你的端点/v1Python 版:修改
config.json的api_base_url字段更换后 key 必须与该端点配套,否则报 401。
工具
工具 | 作用 |
| 文生图,返回图片 URL(可自动存本地) |
| 查看当前配置(API Key 自动打码) |
| 对话里改端点 / key / 模型 / 尺寸,立即生效 |
| 配置 AI 审核闸门(可选,fail-open) |
| 列出后端可用模型 |
目录结构
.
├── GPT-image MCP Server部署文档.md ← 部署文档(必读)
├── gpt-image-mcp-server/ ← npm 版(TypeScript,一键安装)
├── src/ ← Python 版(uvx/uv run)
├── pyproject.toml / uv.lock
└── LICENSE安全
config.json含真实 API Key,已被.gitignore排除,不要提交、不要外发。分发代码前删除
config.json;只保留config.example.json模板。
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityDmaintenanceMCP server that wraps OpenAI's image generation and editing APIs, enabling text-to-image and image-to-image operations via tools.Last updated14737ISC
- Alicense-qualityDmaintenanceWraps Flow2API / OpenAI-compatible image generation upstream into an MCP service, providing image generation, history, and caching tools.Last updated12MIT
- Alicense-qualityCmaintenanceExposes multiple image generation backends as independent MCP tools for generating images with configurable models and parameters.Last updatedMIT
- Flicense-qualityCmaintenanceProvides image generation capabilities via Manus AI as MCP tools for Claude AI.Last updated
Related MCP Connectors
OCR, transcription, file extraction, and image generation for AI agents via MCP.
Generate on-brand images from your AI agent: design, edit, and render templates over MCP.
Generate images, GIFs, and PDFs from HTML, URLs, or templates — from your AI agent.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/wenkezhi8/2Xapi.com-GPT-image-MCP-Server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server