PixRelay
Uses a locally signed-in OpenAI Codex CLI/ChatGPT subscription as the image generation and editing backend, enabling text-to-image, image-to-image edits, transparent outputs, and batch requests without requiring an OpenAI API key.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
PixRelay 「借笔」
Let any AI agent harness — Google Antigravity, Claude Code, Cursor, Gemini CLI, OpenCode, Windsurf, VS Code Copilot Agent, Cline/Roo — generate and edit images via your local signed-in Codex CLI (ChatGPT subscription). No
OPENAI_API_KEYrequired.
中文文档 (README.zh-CN.md) · Compatibility Matrix · Harness Guides
Live Output Example (Generate → -i last Edit)
Step 1: Generate ( | Step 2: Follow-up edit ( |
"Minimal flat studio illustration of an orange tabby cat holding a fountain pen" (24.6 s via warm daemon) | "Change the background to a twilight indigo night sky with golden stars and warm desk lamp glow" (27.7 s via |
Related MCP server: chatgpt-desktop-image-mcp
Why PixRelay?
c2c_img proved that a local signed-in Codex CLI can act as a fast, headless image_gen backend using your existing ChatGPT login. PixRelay ("借笔" — borrowing the brush) rebuilds that engine in TypeScript and opens it up to every harness:
One Engine, Three Surfaces: MCP Server (universal, zero shell-approval friction), CLI (JSON contract compatible with shell workflows), and Agent Skills / Rules (art direction & interaction conventions).
One Shared Warm Daemon: Multiple harnesses and MCP servers share a single background
codex app-serverover a0600Unix domain socket / Windows named pipe with random-token auth, a concurrency queue (default3), idle auto-exit (15m), and automatic binary-upgrade replacement.Dual-Engine Resilience: Falls back automatically to lean
codex exec --ephemeral(with 17 non-image tools disabled and PNGIENDearly-stop) whenever the daemon cannot serve a request.Cross-Session Edit Continuity: Records
history.jsonlso any harness can passimages: ["last"](or-i last) for follow-up edits ("make it brighter", "swap the background") without tracking paths manually.Timeout-Proof MCP: Emits
notifications/progressheartbeats during synchronous renders, supportsasync: true+pixrelay_jobpolling/cancellation, and writes extended timeouts where harnesses support them.Native Inline Previews: Returns resized inline thumbnails (
≤ 1024px,≤ 1 MB), JSON metadata,file://resource_link, andstructuredContentin every MCP tool result.
Architecture
flowchart LR
subgraph H["Agent Harnesses"]
CC["Claude Code"]
AG["Antigravity"]
CU["Cursor / Windsurf / VS Code"]
GE["Gemini CLI / OpenCode / Cline"]
end
subgraph P["PixRelay"]
MCP["pixrelay mcp<br/>stdio (one per harness)"]
CLI["pixrelay CLI<br/>gen / doctor / install / daemon"]
SK["Skill & Rules<br/>pixrelay-img"]
D["pixrelay daemon<br/>Unix socket / pipe + token<br/>queue + concurrency cap + history"]
EX["exec engine<br/>codex exec --ephemeral"]
PP["Post-processing<br/>aspect / crop / format / thumbnail"]
end
CC -->|MCP or Skill+CLI| MCP
AG -->|MCP + Skill| MCP
CU -->|MCP + Rules| MCP
GE -->|MCP + Skill| MCP
SK -.shell fallback.-> CLI
MCP -->|socket + token| D
CLI -->|socket + token| D
D -->|JSON-RPC stdio| AS["codex app-server<br/>warm shared process"]
D -.automatic fallback.-> EX
AS --> PP
EX --> PP
PP --> OUT[("Output Dir<br/>+ history.jsonl")]Prerequisites
Node.js ≥ 18
Codex CLI signed in with your ChatGPT account:
Bundled automatically with the ChatGPT desktop app on macOS, or install via
npm i -g @openai/codexSign in once:
codex login
Quick Start
1. Check your environment (no quota spent)
npx -y pixrelay doctor2. Install into your harness(es)
Preview changes first with --dry-run:
npx -y pixrelay install --harness auto --scope user --dry-runApply (safely merges existing JSON configs and creates .bak backups):
# Auto-detect installed harnesses
npx -y pixrelay install --harness auto --scope user
# Or target a specific harness
npx -y pixrelay install --harness antigravity --scope user
npx -y pixrelay install --harness claude-code --scope user
npx -y pixrelay install --harness cursor --scope project3. Supported Harnesses
Harness | Primary Surface | Guide |
Claude Code | MCP + Skill / Plugin | |
Google Antigravity | MCP + Skill | |
Cursor | MCP + | |
Gemini CLI | MCP (600s timeout) + Skill | |
OpenCode | MCP + Skill | |
Windsurf | MCP + Rules | |
VS Code (Copilot Agent) | MCP ( | |
Cline / Roo Code | MCP (300s timeout) + Rules |
MCP Surface (pixrelay mcp)
Tools
Tool | Purpose | Key Parameters |
| Text-to-image, image-to-image, editing |
|
| Poll or cancel an async job |
|
| List recent generated images |
|
| Non-destructive diagnostics | (none) |
Prompts
pixrelay_art_direction: Full structured prompting recipes, aspect-ratio defaults, and edit continuity guidelines.
CLI Surface (pixrelay)
# Generate a preview image (saved to ~/Pictures/pixrelay/)
pixrelay gen "Minimal flat editorial illustration of a ginger cat holding a fountain pen, warm cream backdrop, no text"
# Exact pixel asset (OG card 1200x630 WebP)
pixrelay gen -o public/og.webp -s 1200x630 -q 85 "Clean geometric developer tool banner..."
# Transparent sticker
pixrelay gen -t -o assets/mascot.png "Cute ceramic cat sticker, thick white die-cut border, isolated on a fully transparent background"
# Edit the most recently generated image
pixrelay gen -i last -o assets/mascot-warm.png "Edit Image 1: shift lighting to warm golden hour; keep pose, outline, and expression identical."
# Parallel JSONL batch from stdin
printf '{"prompt":"Warm coffee mug icon","out":"a.png"}\n{"prompt":"Cool tea cup icon","out":"b.png"}\n' | pixrelay gen --batch -
# Daemon & protocol diagnostics
pixrelay daemon status
pixrelay daemon stop
pixrelay history --limit 10
pixrelay schema-checkSecurity & Safe Defaults
Local, single-user only: The daemon listens exclusively on a
0600Unix domain socket (macOS/Linux) or local Windows named pipe with constant-time random token authentication. There is no network/remote listener.Sandboxed Codex runs: Every generation runs inside an empty temporary working directory with
sandbox: read-only,approvalPolicy: never, andshell_tool/ browser / plugin tools disabled.MCP output path allowlist: In MCP mode, output files are restricted to your active workspace and
~/Pictures/pixrelayby default (preventing path-traversal writes). Add extra directories viaPIXRELAY_ALLOWED_DIRSor~/.config/pixrelay/config.json.Input image header verification: Reference images are checked for both allowed extensions and valid magic bytes (PNG/JPEG/WebP/GIF) so non-image files cannot be exfiltrated via
localImage.
Development & Testing
All unit, end-to-end engine/daemon, and MCP contract tests run offline against tests/fake-codex/fake-codex.mjs without needing a Codex login or spending quota:
npm install
npm run typecheck
npm run build
npm testDisclaimer & Attribution
Not affiliated with OpenAI: PixRelay is an independent open-source project powered by your locally installed Codex CLI. You are responsible for complying with OpenAI's Terms of Use; do not use PixRelay to expose a shared service or share accounts.
Built on the shoulders of c2c_img: PixRelay's Codex driver prompt, dual-engine architecture, error classification taxonomy, early-stop strategy, and prompting guidelines are adapted from
actionow-ai/c2c_img(MIT License, Copyright © 2026 actionow). See LICENSE and NOTICE.
License
MIT
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Generate images from Claude, ChatGPT, Cursor and Codex with 12 top AI image models and 10 tools: up to 4 images per call, SVG vectorization, editing and more. Remote MCP with OAuth, no API keys. Pay per image, no subscription.
Generate images from Claude, ChatGPT, Cursor and Codex with 12 top AI image models. Up to 4 images per call, SVG vectorization, background removal, upscaling and image-to-video. Remote MCP with OAuth, no API keys.
LLM chat, text tools, image generation, editing, batch image jobs, and asynchronous video generation
Generate images, video, music and voice from your CLI or AI agent. On-brand AI media toolkit.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceGenerates and edits images through the Codex CLI using an existing ChatGPT subscription, with queued jobs, progress reporting, and artifact URLs for MCP clients.MIT
- AlicenseAqualityBmaintenanceImage generation for Claude Code, Claude Desktop and any MCP client, using your existing ChatGPT subscription. Drives the already-signed-in Codex desktop app over the Chrome DevTools Protocol - no API key, and no Codex agent quota. Supports iterative refinement through a reusable conversation. Windows only; requires the Codex desktop app.2MIT
- AlicenseNot gradedqualityBmaintenanceExposes Codex's built-in image generation to any MCP-capable agent, returning file paths, pixel dimensions, and the prompts used, with support for image-to-image editing via reference images. Ships scenario presets (Xiaohongshu, video cover, poster, book/album cover and more) plus built-in prompt assembly and catalog listing tools so agents can generate or preview prompts without spending credits.140MIT
- AlicenseNot gradedqualityBmaintenanceEnables any MCP-compatible agent to generate and edit images using an existing Codex/ChatGPT subscription, exposing image generation and editing as tool calls.27 npmMIT