{
  "markdown": "# MCP Image Generator 🍌\n\n> Generate and edit images from Codex, Cursor, Claude Code, or any MCP client. mcp-image adds visual direction to your request before sending it to Gemini, OpenAI, or BytePlus Seedream.\n\n[![npm version](https://badge.fury.io/js/mcp-image.svg)](https://www.npmjs.com/package/mcp-image)\n[![npm downloads](https://img.shields.io/npm/dm/mcp-image.svg)](https://www.npmjs.com/package/mcp-image)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nTell it what image to create or what to change in an existing image, and what it is for. The result is saved to disk and returned to your assistant.\n\n## What It Does\n\nBefore generating an image, mcp-image rewrites short requests into more specific prompts. It keeps what you asked for and fills in details such as composition, lighting, and camera angle. The more detail you provide, the less it changes.\n\n**You ask:**\n\n> \"A photo of a roast chicken dinner for a recipe site. It should look like it was actually cooked, and it should be partway through being carved so you can tell how juicy it is.\"\n\n**mcp-image sends to the image model:**\n\n> \"... a beautifully roasted whole chicken, **golden-brown and glistening**, resting on a rustic wooden cutting board. One leg is partially carved, revealing **tender, succulent white meat and rich, glistening juices pooling** around the carving knife ... **shallow depth of field** focused on the carved chicken.\"\n\n![Roast chicken, generated with prompt enhancement](assets/roast-chicken-optimized.jpg)\n\n*Generated with Gemini using the default `fast` quality preset.*\n\nWhat carried through:\n\n- `for a recipe site`: one clear subject, with everything else kept subordinate\n- `actually cooked`: uneven browning and juices across the board\n- `partway through being carved`: the cut face and slices beside it\n- `how juicy it is`: close framing and shallow depth of field around the cut\n\n<details>\n<summary>Compare the same request with prompt enhancement turned off</summary>\n\n<img src=\"assets/roast-chicken-plain.jpg\" alt=\"Baseline result with prompt enhancement turned off\" width=\"480\">\n\n*Baseline from the same request, with prompt enhancement disabled.*\n\nSet `SKIP_PROMPT_ENHANCEMENT=true` to send the original prompt to the image model unchanged.\n\n</details>\n\n## Quick Start\n\nYou need Node.js 22 or later, an MCP-compatible client, and an API key for one image provider.\n\n### 1. Get an API key\n\nAll three providers generate and edit images. Gemini is the default and requires the least configuration.\n\n| Provider | Image size | Output format | Setup |\n|----------|------------|---------------|-------|\n| Gemini (default) | 1K, 2K, 4K | Automatic | [Get a key](https://aistudio.google.com/apikey), then set `GEMINI_API_KEY` |\n| OpenAI | 1K, 2K, 4K | PNG or JPEG | [Get a key](https://platform.openai.com/api-keys), then set `IMAGE_PROVIDER=openai` and `OPENAI_API_KEY` |\n| BytePlus Seedream | 1K, 2K | PNG or JPEG | [Get an AP region key](https://console.byteplus.com/ark/region:ark+ap-southeast-1/apikey), then set `IMAGE_PROVIDER=seedream` and `ARK_API_KEY` |\n\nGoogle Search grounding is available with Gemini only. OpenAI may require organization verification before it can generate images.\n\nThe examples below use Gemini. Replace the provider settings if you prefer OpenAI or Seedream.\n\n### 2. Configure your MCP client\n\n#### Codex\n\nAdd this to `~/.codex/config.toml`:\n\n```toml\n[mcp_servers.mcp-image]\ncommand = \"npx\"\nargs = [\"-y\", \"mcp-image\"]\n\n[mcp_servers.mcp-image.env]\nGEMINI_API_KEY = \"your_gemini_api_key_here\"\nIMAGE_OUTPUT_DIR = \"/absolute/path/to/images\"\n```\n\n#### Cursor\n\nAdd this to `~/.cursor/mcp.json` for all projects, or `.cursor/mcp.json` in a project:\n\n```json\n{\n  \"mcpServers\": {\n    \"mcp-image\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"mcp-image\"],\n      \"env\": {\n        \"GEMINI_API_KEY\": \"your_gemini_api_key_here\",\n        \"IMAGE_OUTPUT_DIR\": \"/absolute/path/to/images\"\n      }\n    }\n  }\n}\n```\n\n#### Claude Code\n\nRun this in your project directory:\n\n```bash\nclaude mcp add mcp-image --env GEMINI_API_KEY=your-api-key --env IMAGE_OUTPUT_DIR=/absolute/path/to/images -- npx -y mcp-image\n```\n\nAdd `--scope user` after `mcp-image` to make it available in every project.\n\nNever commit API keys to version control. Use an absolute `IMAGE_OUTPUT_DIR` in MCP configuration because the server's working directory depends on the client. If omitted, images are written to `./output` relative to that working directory.\n\n### 3. Generate an image\n\nRestart your MCP client after changing its configuration, then ask your AI assistant:\n\n```text\nGenerate a product photo of a ceramic coffee mug on a wooden desk.\n```\n\nThe generated file is saved in the configured output directory and returned to the assistant as an MCP resource.\n\n<details>\n<summary>Run mcp-image from a local checkout</summary>\n\n```bash\npnpm install\npnpm run build\n```\n\nConfigure the MCP client to run the local build instead of `npx -y mcp-image`:\n\n```bash\nnode /absolute/path/to/mcp-image/dist/index.js\n```\n\n</details>\n\n## More Examples\n\n### Edit an existing image\n\nGive the assistant an absolute path to the source image:\n\n```text\nEdit /path/to/image.jpg so the person is facing right.\n```\n\n### Control the result\n\n- `Generate a high-quality product photo of a smartphone with clear text on the screen.`\n- `Generate a cinematic desert landscape in a 21:9 aspect ratio.`\n- `Keep the knight's appearance consistent with the previous image.`\n\nSee the [tool reference](#tool-reference) for the options your assistant can pass explicitly.\n\n## Configuration\n\nChanging the provider changes both prompt enhancement and image generation. The way you ask for an image stays the same.\n\n### Quality\n\n`IMAGE_QUALITY` accepts `fast` (default), `balanced`, or `quality`. Set it in the MCP server environment:\n\n```bash\nIMAGE_QUALITY=balanced\n```\n\nA request-level `quality` option takes precedence. Each provider maps the three values to its own image settings.\n\n### Environment variables\n\n| Variable | Default | Description |\n|----------|---------|-------------|\n| `IMAGE_PROVIDER` | `gemini` | Default provider: `gemini`, `openai`, or `seedream` |\n| `GEMINI_API_KEY` | - | API key for Gemini |\n| `OPENAI_API_KEY` | - | API key for OpenAI |\n| `ARK_API_KEY` | - | ModelArk AP API key for Seedream |\n| `IMAGE_OUTPUT_DIR` | `./output` | Directory where generated images are saved; use an absolute path in MCP configuration |\n| `IMAGE_QUALITY` | `fast` | Default quality preset: `fast`, `balanced`, or `quality` |\n| `SKIP_PROMPT_ENHANCEMENT` | `false` | Set to `true` to send prompts through unchanged |\n\nYou can configure keys for more than one provider and switch per request. A request-level `provider` option takes precedence over `IMAGE_PROVIDER`.\n\n## Tool Reference\n\nYour MCP client calls this tool for you. Open the reference when you need to check an option or provider limitation.\n\n<details>\n<summary><code>generate_image</code> parameters</summary>\n\n| Parameter | Type | Required | Description |\n|-----------|------|----------|-------------|\n| `prompt` | string | Yes | Image description or editing instruction |\n| `quality` | string | No | `fast`, `balanced`, or `quality`; overrides `IMAGE_QUALITY` |\n| `provider` | string | No | `gemini`, `openai`, or `seedream`; overrides `IMAGE_PROVIDER` |\n| `inputImagePath` | string | No | Absolute path to an input image for editing |\n| `fileName` | string | No | Output filename; `.png`, `.jpg`, or `.jpeg` selects the format for OpenAI and Seedream |\n| `aspectRatio` | string | No | `1:1` (default), `2:3`, `3:2`, `3:4`, `4:3`, `4:5`, `5:4`, `9:16`, `16:9`, `21:9`, `1:4`, `1:8`, `4:1`, or `8:1` |\n| `imageSize` | string | No | `1K`, `2K`, or `4K`; availability depends on the provider |\n| `blendImages` | boolean | No | Add blending guidance when combining visual elements |\n| `maintainCharacterConsistency` | boolean | No | Keep a character's appearance consistent across images |\n| `useWorldKnowledge` | boolean | No | Add context for historical figures, landmarks, and factual scenes |\n| `useGoogleSearch` | boolean | No | Gemini only. Use Google Search grounding for current information |\n| `purpose` | string | No | Intended use, such as `cookbook cover` or `social media post` |\n\n</details>\n\n## Troubleshooting\n\n### API key not found\n\nCheck that the key for the selected provider is present in the MCP server's environment:\n\n- Gemini: `GEMINI_API_KEY`\n- OpenAI: `OPENAI_API_KEY`\n- Seedream: `ARK_API_KEY`\n\nRestart the MCP client after changing its configuration.\n\n### Input image file not found\n\nUse an absolute path and make sure the MCP server can read the file. Input images can be PNG, JPEG, or WebP and must be no larger than 10 MB. Seedream editing accepts PNG and JPEG only.\n\n### Provider rejects a request\n\nCheck the requested size in the provider table. `useGoogleSearch` works with Gemini only, and Seedream does not support 4K. For OpenAI permission errors, check your [organization settings](https://platform.openai.com/settings/organization/general). For quota or rate-limit errors, check the selected provider account.\n\n## Image Generation Prompt Skill\n\nThis repository also includes an [Agent Skill](https://agentskills.io) for assistants that already have access to an image generation tool. It teaches the prompt-writing approach used by mcp-image and works independently of this server.\n\nInstall it with:\n\n```bash\nnpx mcp-image skills install --path <skills-directory>\n```\n\nFor example, use `~/.codex/skills`, `~/.cursor/skills`, or `~/.claude/skills` as the destination.\n\n## License\n\nMIT License. See [LICENSE](LICENSE) for details.\n\n---\n\nNeed help? [Open an issue](https://github.com/shinpr/mcp-image/issues) or check [Troubleshooting](#troubleshooting).\n",
  "bytes": 9775,
  "sha": "5ec1eb48c9917b3fa1173b96bc3d855995c406a2364d974772243705bddcee10",
  "repo_slug": "shinpr/mcp-image",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_shinpr_mcp_image_3ba093ef/readme"
}