npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@jordyvd/openrouter-imagegen-mcp

v1.0.3

Published

MCP server for AI image generation via OpenRouter with S3 storage

Readme

ImageGen MCP Server

An MCP (Model Context Protocol) server for AI image generation and editing using OpenRouter and Google Gemini.

Features

  • Generate images from text prompts using Gemini Flash Image Preview
  • Edit existing images with natural language instructions (e.g., "make the sky orange")
  • S3 image hosting - upload images to S3-compatible storage (MinIO, Cloudflare R2, etc.) and return public URLs
  • Conversation persistence - pick up where you left off with saved conversation history
  • Automatic image saving - all generated images saved to disk with metadata
  • API request logging - debug logs saved to conversation folders

Prerequisites

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/imagegen-mcp.git
    cd imagegen-mcp
  2. Install dependencies:

    bun install
  3. Get an API key from OpenRouter

Configuration

Claude Desktop (Windows)

Add to your Claude Desktop config at %APPDATA%\Claude\claude_desktop_config.json:

{
  "mcpServers": {
    "imagegen": {
      "command": "bun",
      "args": ["run", "C:\\path\\to\\imagegen-mcp\\index.ts"],
      "env": {
        "OPENROUTER_API_KEY": "your-api-key-here"
      }
    }
  }
}

Claude Desktop (Windows with WSL2)

If running Bun through WSL:

{
  "mcpServers": {
    "imagegen": {
      "command": "wsl",
      "args": ["bun", "run", "/home/user/projects/imagegen-mcp/index.ts"],
      "env": {
        "OPENROUTER_API_KEY": "your-api-key-here"
      }
    }
  }
}

Claude Desktop (macOS/Linux)

{
  "mcpServers": {
    "imagegen": {
      "command": "bun",
      "args": ["run", "/path/to/imagegen-mcp/index.ts"],
      "env": {
        "OPENROUTER_API_KEY": "your-api-key-here"
      }
    }
  }
}

S3 Image Hosting (Optional)

For server deployments (e.g., Coolify, Docker), you can configure S3-compatible storage to host images and return public URLs instead of local file paths.

Environment Variables

| Variable | Required | Description | |----------|----------|-------------| | S3_ENDPOINT | Yes | S3-compatible endpoint URL (e.g., https://minio.example.com) | | S3_BUCKET | Yes | Bucket name for storing images | | S3_ACCESS_KEY_ID | Yes | S3 access key ID | | S3_SECRET_ACCESS_KEY | Yes | S3 secret access key | | S3_PUBLIC_URL_BASE | Yes | Public URL base for accessing images (e.g., https://cdn.example.com/bucket) | | S3_REGION | No | S3 region (default: auto) | | S3_PREFIX | No | Path prefix for uploaded images (default: images) |

Example: Coolify with MinIO

# In your Coolify environment variables:
OPENROUTER_API_KEY=sk-or-...
S3_ENDPOINT=https://minio.yourdomain.com
S3_BUCKET=imagegen
S3_ACCESS_KEY_ID=your-access-key
S3_SECRET_ACCESS_KEY=your-secret-key
S3_PUBLIC_URL_BASE=https://minio.yourdomain.com/imagegen
S3_REGION=auto
S3_PREFIX=generated

Example: Cloudflare R2

S3_ENDPOINT=https://your-account-id.r2.cloudflarestorage.com
S3_BUCKET=imagegen
S3_ACCESS_KEY_ID=your-r2-access-key
S3_SECRET_ACCESS_KEY=your-r2-secret-key
S3_PUBLIC_URL_BASE=https://your-r2-public-url.com

When S3 is configured, generated images will be uploaded and the tool will return IMAGE_URL: https://... instead of IMAGE_PATH: /local/path/....

Usage

Once configured, the following tools are available in Claude:

generate_image

Create a new image from a text prompt.

Example: "Generate an image of a cat sitting on a rainbow"

edit_image

Modify an existing image with natural language instructions. The model receives the previous image and attempts to make only the requested changes.

Example: "Make the cat's fur orange" or "Add sunglasses to the cat"

handle_generated_image

Opens the generated image in your system's default image viewer. Called automatically after generation.

list_conversations

View all saved image generation conversations with their IDs and descriptions.

clear_conversation

Delete a specific conversation or all conversations from disk.

How It Works

  1. Image Generation: Prompts are sent to Gemini Flash Image Preview via OpenRouter
  2. Image Editing: The previous image is sent inline with edit instructions for better results
  3. Persistence: Images saved to images/{conversation_id}/ with messages.json tracking history
  4. Logging: API requests/responses logged to request-{timestamp}.json for debugging

File Structure

imagegen-mcp/
├── index.ts          # Main MCP server
├── images/           # Generated images and conversation data
│   └── {conv-id}/
│       ├── *.png           # Generated images
│       ├── messages.json   # Conversation history
│       ├── README.md       # Conversation summary
│       └── request-*.json  # API logs
├── package.json
└── tsconfig.json

Development

Run the server directly:

OPENROUTER_API_KEY=your-key bun run index.ts

License

MIT