gpt-image-mcp
Click on "Deploy 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., "@gpt-image-mcpgenerate a watercolor image of a lighthouse 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.
gpt-image-mcp
GPT Image 图像生成与编辑的 MCP Server,为 LLM 客户端提供标准化的工具调用能力。
特性
三种运行方式:stdio、Streamable HTTP、Cloudflare Workers,共用同一套工具代码。
双输出:每次调用同时返回 Markdown 文本与满足
outputSchema的structuredContent。统一结果约定:成功走
content+structuredContent,失败走isError通道。可扩展骨架:
src/gpt-image/预留领域目录,新增工具只需实现registerXxxTools。零配置启动:无需 API Key,
npx即可运行。
Related MCP server: McpHub
目录
快速开始
直接运行(stdio,默认传输方式):
npx -y -p @aemeath-projects/gpt-image-mcp gpt-image-mcp在 Claude Code 中注册:
claude mcp add gpt-image -- npx -y -p @aemeath-projects/gpt-image-mcp gpt-image-mcpClaude Desktop 配置示例:
{
"mcpServers": {
"gpt-image": {
"command": "npx",
"args": ["-y", "-p", "@aemeath-projects/gpt-image-mcp", "gpt-image-mcp"]
}
}
}Windows 下若客户端找不到
npx,可将command改为cmd,并在args开头加入/c。
工具
所有工具都声明 annotations。成功时返回 Markdown 文本与 structuredContent;
失败时返回 isError: true 与单行错误信息。
工具 | 用途 | 关键参数 | 注解 |
| 回显输入文本及其字符数,验证链路 |
|
|
当前仓库处于脚手架阶段,仅提供 echo 示例工具。gpt-image 领域工具将在后续版本加入。
运行方式
stdio
npx -y -p @aemeath-projects/gpt-image-mcp gpt-image-mcp从源码运行:
pnpm build
pnpm start # 等价于 node dist/cli.jsStreamable HTTP
pnpm start:http # 等价于 node dist/cli.js --transport http默认监听 http://127.0.0.1:3000/mcp。健康检查固定为 GET /health,不受 --path 影响。
# 健康检查
curl -s http://127.0.0.1:3000/health
# 列出工具
curl -s -X POST http://127.0.0.1:3000/mcp \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
# 调用 echo
curl -s -X POST http://127.0.0.1:3000/mcp \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
-d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"echo","arguments":{"text":"hello"}}}'响应为 SSE,result.structuredContent 是结构化数据,result.content 是对应的 Markdown:
event: message
data: {"jsonrpc":"2.0","id":2,"result":{"content":[{"type":"text","text":"# 回声\n\nhello\n\n字符数:5"}],"structuredContent":{"text":"hello","length":5}}}Node 侧默认绑定 127.0.0.1,并启用 localhost 级别的 Host/Origin 校验。监听 0.0.0.0
或经反向代理暴露时,必须显式配置 MCP_ALLOWED_HOSTS 与 MCP_ALLOWED_ORIGINS。
Cloudflare Workers
pnpm worker:dev # http://127.0.0.1:8787/mcp
pnpm worker:check # 仅打包校验,不部署
pnpm worker:deploy # 手动部署,仅用于调试日常发布使用 Cloudflare Workers Builds:在 Dashboard 连接 Git 仓库,生产分支设为
master,Root directory 为 /,Build command 为 pnpm run build,Deploy command 为
npx wrangler deploy,构建环境变量只需 NODE_VERSION=26。运行时变量
ALLOWED_HOSTS、ALLOWED_ORIGINS 在 Worker 的 Variables 中配置。Worker 端 MCP 端点
固定为 /mcp,健康检查为 /health。
配置
CLI 参数优先级高于环境变量。MCP_ALLOWED_ORIGINS 与 MCP_ALLOWED_HOSTS 未显式配置时,
绑定 localhost 会自动使用 SDK 的 localhost 白名单。
CLI 参数 | 环境变量 | 默认值 | 说明 |
|
|
| 传输方式 |
|
|
| HTTP 监听地址 |
|
|
| HTTP 监听端口 |
|
|
| MCP 端点路径 |
— |
| 未设置 | 允许的 Host 主机名,逗号分隔 |
— |
| 未设置 | 允许的 Origin 主机名,逗号分隔 |
| — | — | 显示帮助 |
| — | — | 显示版本 |
Worker 运行时使用 ALLOWED_HOSTS、ALLOWED_ORIGINS(逗号分隔),空值表示不启用对应校验。
数据来源
当前版本不访问外部数据源,
echo仅回显输入内容。接入 gpt-image 接口后,将在此补充 API 地址、鉴权方式与数据处理说明。
开发
环境要求:Node.js >= 24.22.1,pnpm 12.15.0(由 packageManager 固定)。
pnpm install
pnpm build构建产物输出到 dist/:
dist/index.js:公共库入口dist/http.js:web-standard HTTP handlerdist/cli.js:命令行入口(含 shebang)dist/chunk-*.js:代码分割产生的共享 chunk
常用脚本:
脚本 | 说明 |
| tsup watch 构建 |
| ESLint 检查 |
| ESLint 自动修复 |
| Prettier 检查 |
| Prettier 格式化 |
| TypeScript 类型检查 |
| MCP Inspector 调试(需先构建) |
| 本地 Worker 开发 |
| Worker 打包校验 |
| 版本号、CHANGELOG、tag 与提交 |
| Commitizen 交互式提交 |
完整脚本(含 bump:patch / bump:minor / bump:major、changelog、start:http 等)
见 package.json。
目录结构:
src/
├── cli.ts # bin 入口,stdio/http 分流
├── config.ts # CLI 与环境变量解析
├── env.ts # 列表环境变量解析(Worker 可用)
├── errors.ts # ToolError 业务错误基类
├── http.ts # 共享 web-standard fetch handler
├── index.ts # 公共库 barrel
├── node.ts # node:http + toNodeHandler
├── server.ts # McpServer 工厂与工具注册
├── version.ts # 服务名与版本号
├── worker.ts # Cloudflare Worker 入口
├── gpt-image/ # 领域目录(待实现)
│ └── client.ts # 接口错误类与后续请求封装
└── tools/ # 工具域
├── echo.ts # 示例工具
└── register.ts # 统一的成功/失败结果封装新增工具时,按 src/tools/echo.ts 的模式实现 registerXxxTools(server),在
src/server.ts 中注册,并在 src/gpt-image/ 中补充数据访问代码。
http.ts、server.ts、worker.ts、env.ts、version.ts、tools/**、gpt-image/**
保持 Node-free,由 ESLint no-restricted-imports 约束;Node 适配器 node.ts 仅在 HTTP
模式下动态加载。
This server cannot be deployed
Maintenance
Related MCP Connectors
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
214 tools for AI agents over one MCP endpoint: image, video, audio, 3D, data, storage, mail, GPUs.
The OpenRouter for tools. One MCP connection gives any AI agent 254 hosted tools, pay per call.
Build your own tools from chat: design, test and host them on a shareable MCP server URL.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables MCP clients to discover and execute operational tools such as database mutations and system diagnostics over stdio, with deterministic structured outputs and Langfuse observability.ISC
- AlicenseNot gradedqualityAmaintenanceEnables AI tools to uniformly discover, inspect, and call tools, prompts, and resources from multiple upstream MCP servers through a small set of fixed MCP tools, over stdio or HTTP.2MIT
- AlicenseNot gradedqualityCmaintenanceEnables you to create and run your own custom MCP tools using plain Node.js, then connect them to AI clients like Claude, Cursor, or Windsurf.3 npmMIT
- AlicenseNot gradedqualityAmaintenanceEnables AI clients such as Claude, Cursor, VS Code, and Windsurf to manage workspaces, projects, tasks, and AI agents through natural language, using a hosted OAuth-authenticated endpoint or a local stdio package. It also ships an OpenAPI codegen tool for generating MCP tools from any OpenAPI spec.3,052 npmMIT