Skip to main content
Glama
dev66613

openrouter-image-gen-mcp

by dev66613

OpenRouter Image Generation MCP Server

An MCP (Model Context Protocol) server that provides image generation capabilities through the OpenRouter API, supporting models like Gemini 2.5 Flash Image Preview.

Features

  • Image Generation: Generate images using Google Gemini 2.5 Flash Image Preview

  • Flexible Options:

    • Save generated images to local files

Related MCP server: jgkme/kilo-image-gen-mcp

Installation

  1. Clone the repository:

git clone https://github.com/a13.team/openrouter-image-gen-mcp.git
cd openrouter-image-gen-mcp
  1. Install dependencies:

npm install
  1. Build the TypeScript code:

npm run build
  1. Set up your OpenRouter API key:

export OPENROUTER_API_KEY="your-api-key-here"

You can get an API key from OpenRouter.

Configuration for Claude Desktop

Add the following to your Claude Desktop configuration file:

macOS/Linux

Location: ~/.config/claude/claude_desktop_config.json

Windows

Location: %APPDATA%\Claude\claude_desktop_config.json

Cursor IDE Configuration

Location: ./cursor/mcp.json

{
  "mcpServers": {
    "openrouter-image-gen": {
      "command": "node",
      "args": ["/path/to/openrouter-image-gen-mcp/dist/index.js"],
      "env": {
        "OPENROUTER_API_KEY": "your-api-key-here"
      }
    }
  }
}

Replace /path/to/openrouter-image-gen-mcp with the actual path to your installation directory.

Available Tools

1. generate_image

Generate images using AI models.

Parameters:

  • prompt (required): Text description of the image to generate

  • model: Model to use (default: google/gemini-2.5-flash-image-preview)

  • n: Number of images to generate (1-4, default: 1)

  • size: Image dimensions (default: 1024x1024)

  • save_to_file: Save images locally (default: false)

  • filename: Base filename for saved images

  • show_full_response: Include full base64 data in response (default: false, returns concise info only)

Example:

{
  "prompt": "A serene Japanese garden with cherry blossoms",
  "model": "google/gemini-2.5-flash-image-preview",
  "save_to_file": true,
  "filename": "japanese_garden"
}

Note: Gemini image generation works through the chat completions API. The model will generate an image based on your prompt and return it as a URL or base64 data in the response. The size parameter is not used for Gemini models.

2. list_models

List all available image generation models.

Development

Build

npm run build

Run in development mode

npm run dev

Start the server

npm start

API Documentation

Troubleshooting

401 Authentication Error

If you get a 401 error, check:

  1. Your API key is correctly set in the environment or Claude Desktop config

  2. The API key starts with sk-or- (OpenRouter format)

  3. The API key is valid and has not expired

  4. You have credits available in your OpenRouter account

Test your API key loading:

node test-api-key.js

Common Issues

  • API Key not loading: Make sure the OPENROUTER_API_KEY is set in your Claude Desktop config's env section

  • Model access denied: Some models require specific permissions or higher tier accounts

  • Image not generating for Gemini: Gemini uses the chat completions endpoint, not the images endpoint

License

WTFPL - Do What The Fuck You Want To Public License

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Else Models:

`google/gemini-3-pro-image-preview`
`google/gemini-2.5-flash-image`
`google/gemini-2.5-flash-image-preview`

Available Tools

2 tools
generate_imageA

Generate images using Google Gemini API. Control image style, aspect ratio, and composition through descriptive text in your prompt.

ParametersJSON Schema
NameRequiredDescriptionDefault
promptYesText description of the image to generate. Include style details (e.g., "photorealistic", "oil painting"), aspect ratio (e.g., "square image", "landscape"), and composition details directly in the prompt.
filenameNoBase filename for saved image (without extension)
save_to_fileNoSave generated image to local file
show_full_responseNoShow full response including base64 data (default: false)

TDQS

A3.7/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must carry the full behavioral burden. It states that images are generated via Gemini API but does not disclose what the tool returns by default, whether it saves files, whether authentication or costs are involved, or any side effects. The schema hints at save_to_file and show_full_response, but the description itself adds little behavioral context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two concise sentences with no wasted words. The primary action is front-loaded, and the second sentence gives practical prompt-construction guidance without bloating the description.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with four parameters fully documented in the schema, the description covers the core invocation guidance. However, without annotations or an output schema, it leaves gaps around default return behavior, file-saving semantics, and operational prerequisites such as API access.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all four parameters. The description reinforces the prompt guidance about style, aspect ratio, and composition, but it does not add meaning beyond what the schema already provides.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb and resource: 'Generate images using Google Gemini API.' It clearly differentiates from the sibling tool list_models, which serves a different purpose, and adds useful guidance that style, aspect ratio, and composition can be controlled through the prompt.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description clearly implies the tool is for generating images, so an agent can infer when to call it. It does not explicitly discuss when not to use it, but no competing image-generation sibling exists among the listed tools, so the omission is minor.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_modelsB

Show information about the Gemini image generation model

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

B3/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. 'Show information' implies a read-only operation, but it does not disclose what data is returned, whether a remote API is called, or whether any rate limits or prerequisites apply.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single short sentence with no filler. It loses one point because 'Show information about' is somewhat vague and 'model' is singular, while the tool name list_models suggests listing multiple models.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Despite being a zero-parameter tool, there is no output schema, no annotations, and no description of what information will be shown or how this tool relates to generate_image. An agent can guess the basic behavior, but important selection and return-value context is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has zero properties and schema coverage is 100%, so there are no parameter semantics to document. The description cannot add meaning to an already complete empty schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a clear verb-resource pair: 'Show information' about 'the Gemini image generation model.' It is distinguishable from the sibling generate_image because one provides model information and the other generates images, though it does not explicitly name or contrast the sibling.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is given about when to call this tool instead of generate_image. The only implied context is that listing model information might precede generation, but the description does not state this or any other selection criteria.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 2 tool updatesv1.0.0
    • First observedgenerate_image
    • First observedlist_models

TDQS

A3.5/5.0
Disambiguation5/5

generate_image and list_models serve clearly different purposes: one creates an image, the other retrieves model metadata. There is no overlap or ambiguity between the two tools.

Naming Consistency5/5

Both tool names follow the same verb_noun pattern using snake_case, making the naming predictable and consistent across the set.

Tool Count3/5

Two tools is on the thin side for an image generation server, but the pair covers the essential generation action and a supporting model lookup. It feels minimal yet not unreasonable.

Completeness4/5

The core image generation workflow is covered by generate_image, and list_models provides useful context for model selection. Minor gaps exist, such as no ability to inspect generation parameters or retrieve past generations, but these are not critical for a simple image generation API.

Maintenance

ActivityInactive
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/dev66613/openrouter-image-gen-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server