Skip to main content
Glama
ai-image-gpt-mcp

ai-image-gpt-mcp

by andyluu98
README.md
# ai-image-gpt-mcp

Standalone **MCP server + CLI for ChatGPT image generation** (image only).

A trimmed, image-focused fork of [ai-slides-mcp](https://github.com/vuhai2002/ai-slides-mcp):
all the slide / PowerPoint features are removed, and the image-generation path is
made **reliable** (one call = one image = one exact returned path, no re-generation).

## What it does

- `aigpt gen "<prompt>"` generates an image via the ChatGPT backend and saves it.
- MCP tools `generate_image` and `login_status` for use inside Claude Code, Codex, etc.
- Multi-account login with quota-aware selection.

## The reliability fix

The original tool returned images into a directory with an auto-generated name,
which made callers guess where the file landed and sometimes **re-generate the same
image** (wasting quota). This fork fixes that:

- `aigpt gen "..." --out shot.png` saves to **exactly** `shot.png` and prints its
  **absolute path** on stdout (one line). Use that path directly.
- `--out <dir>` still works for a directory of `n` images.
- The MCP `generate_image` returns absolute paths in `{"paths": [...]}`.

One generation call produces one image. Never re-run a call to "find" the file.

## Install

Requires Python 3.12+ and [uv](https://docs.astral.sh/uv/).

```bash
git clone https://github.com/andyluu98/ai-image-gpt-mcp.git
cd ai-image-gpt-mcp
uv sync
```

## Login (2-step OAuth with ChatGPT)

```bash
uv run aigpt login
# A browser opens -> log into ChatGPT -> you land on a platform.openai.com page.
# Copy the FULL callback URL, then:
uv run aigpt login --callback "<paste the URL here>"

uv run aigpt accounts   # check logged-in accounts + live quota
```

## Generate

```bash
# one exact file
uv run aigpt gen "a red apple on white, minimal" --out shot.png

# skip prompt auto-expansion (faster, more literal) + set reasoning effort
uv run aigpt gen "..." --out shot.png --no-enhance --thinking standard

# a directory of N images
uv run aigpt gen "..." --n 2 --out ./images

# aspect ratio: 16:9 (default), 1:1, 9:16, 4:3, 3:4, or WxH
uv run aigpt gen "..." --aspect 9:16 --out portrait.png
```

`--thinking` (`auto`/`standard`/`extended`/`max`) raises image reasoning effort;
higher renders text (e.g. Vietnamese diacritics) better but is slower.

## Register as an MCP server

Same shape for Claude Code, Codex, Antigravity:

```json
{
  "mcpServers": {
    "ai-image-gpt": {
      "command": "uv",
      "args": ["run", "--directory", "<absolute path to this repo>", "aigpt-mcp"]
    }
  }
}
```

Exposed tools: `generate_image`, `login_status`.

## Disclaimer

This tool talks to the ChatGPT web backend (vendored `chatgpt2api`), not an official
OpenAI API. **Using it may violate OpenAI's Terms of Service and can get your account
rate-limited or banned.** For experimentation only. You are responsible for your use.

## Credits

- Image + OAuth engine vendored from [chatgpt2api](https://github.com/basketikun/chatgpt2api) (MIT).
- Structure based on [ai-slides-mcp](https://github.com/vuhai2002/ai-slides-mcp).

TDQS

A4.8/5.0

Scored across 2 tools

Disambiguation5/5

The two tools serve entirely different functions: one checks authentication status, the other generates images. There is no overlap or ambiguity between them.

Naming Consistency5/5

Both tool names follow the same verb_noun snake_case pattern: login_status and generate_image. The naming is clear, predictable, and consistent.

Tool Count4/5

With only two tools, the server is minimal but appropriately scoped for its single-purpose image generation functionality. The login_status helper supports the main generate_image tool without unnecessary bloat.

Completeness5/5

The tool set covers the core lifecycle of image generation: checking authentication and generating images with extensive options for style, aspect ratio, enhancement, and thinking effort. There are no obvious gaps for the stated domain.

Maintenance

ActivityInactive
ResponsivenessNo recent community issues