Skip to main content
Glama

OpenRouter Image MCP Server

by JonathanJude

๐Ÿ–ผ๏ธ๐Ÿค– OpenRouter Image MCP Server

npm version License: MIT TypeScript Node.js

๐Ÿ”ฅ Supercharge your AI agents with powerful image analysis capabilities! ๐Ÿ”ฅ

A blazing-fast โšก MCP (Model Context Protocol) server that enables AI agents to see and understand images using OpenRouter's cutting-edge vision models. Perfect for screenshots, photos, diagrams, and any visual content! ๐Ÿ“ธโœจ


๐ŸŒŸ What Makes This Special?

  • ๐ŸŽฏ Multi-Model Support: Choose from Claude, Gemini, GPT-4 Vision, and more!

  • ๐Ÿš€ Lightning Fast: Built with TypeScript and optimized for performance

  • ๐Ÿ”ง Flexible Input: Support for file paths, URLs, and base64 data

  • ๐Ÿ’ฐ Cost-Effective: Smart model selection for the best price-to-quality ratio

  • ๐Ÿ›ก๏ธ Production Ready: Robust error handling, retries, and comprehensive logging

  • ๐ŸŽจ Easy Integration: Works seamlessly with Claude Code, Cline, Cursor, and more!


๐Ÿš€ Quick Start

Prerequisites ๐Ÿ“‹

  • Node.js 18+ โšก

  • OpenRouter API Key ๐Ÿ”‘ (Get one at openrouter.ai)

  • Your favorite MCP client ๐Ÿค– (Claude Code, Cline, etc.)

Installation ๐Ÿ“ฆ

# ๐ŸŒŸ Option 1: Use immediately with npx (recommended) npx openrouter-image-mcp # ๐Ÿš€ Option 2: Install globally for frequent use npm install -g openrouter-image-mcp # ๐Ÿ› ๏ธ Option 3: Clone and build locally git clone https://github.com/JonathanJude/openrouter-image-mcp.git cd openrouter-image-mcp npm install npm run build npm install -g .

๐Ÿ’ก Why npx is recommended: No installation required, always gets the latest version, and works perfectly for MCP server usage!

Configuration โš™๏ธ

The MCP server requires an OpenRouter API key. You can configure it in several ways:

Method 1: Environment Variables (Recommended)

# ๐Ÿ”‘ Set your API key export OPENROUTER_API_KEY=sk-or-v1-your-api-key-here # ๐ŸŽฏ Set model (uses free model by default) export OPENROUTER_MODEL=google/gemini-2.0-flash-exp:free

Method 2: .env File

# ๐Ÿ“‹ Copy the environment template cp .env.example .env # โœ๏ธ Edit with your credentials nano .env

Add your OpenRouter credentials to .env:

# ๐Ÿ”‘ Required OPENROUTER_API_KEY=sk-or-v1-your-api-key-here # ๐Ÿ†“ Model (FREE by default - great for getting started!) OPENROUTER_MODEL=google/gemini-2.0-flash-exp:free # ๐ŸŽ›๏ธ Optional settings LOG_LEVEL=info MAX_IMAGE_SIZE=10485760 RETRY_ATTEMPTS=3

Method 3: Direct Configuration in MCP Client

Add the API key directly in your MCP client configuration (see examples below).


๐Ÿ  Works Locally - No Restarts Needed! ๐ŸŽฏ

๐Ÿš€ HUGE ADVANTAGE: This MCP server works perfectly locally with zero manual intervention once configured! No restarts, no manual server starts, no fiddling with settings. It just works! โœจ

๐Ÿ”„ How It Works Automatically

  1. ๐ŸŽฏ Configure once โ†’ Set up your MCP client one time

  2. ๐Ÿš€ Auto-launches โ†’ Client starts the server automatically

  3. ๐Ÿ”ง Connects โ†’ Validates API and loads models instantly

  4. ๐Ÿ› ๏ธ Ready to use โ†’ All 3 tools available immediately

โšก Local Setup Benefits

  • ๐Ÿ”ฅ Fire-and-forget: Set up once, forget forever

  • โšก Lightning startup: ~5 seconds total ready time

  • ๐Ÿ”„ Persistent across restarts: Survives laptop shutdowns

  • ๐Ÿ“ฑ Cross-platform: Works on any OS with Node.js

  • ๐ŸŽฏ Zero maintenance: No babysitting required


๐Ÿ”ง MCP Configuration

Option 1: Using npx (Recommended - No Installation Required)

The easiest way to use this MCP server is with npx, which automatically downloads and runs the package without any installation:

For Claude Code

Add to ~/.claude.json:

{ "mcp": { "servers": { "openrouter-image": { "command": "npx", "args": ["openrouter-image-mcp"], "env": { "OPENROUTER_API_KEY": "sk-or-v1-your-api-key-here", "OPENROUTER_MODEL": "google/gemini-2.0-flash-exp:free" } } } } }

For Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{ "mcpServers": { "openrouter-image": { "command": "npx", "args": ["openrouter-image-mcp"], "env": { "OPENROUTER_API_KEY": "sk-or-v1-your-api-key-here", "OPENROUTER_MODEL": "google/gemini-2.0-flash-exp:free" } } } }

For Other MCP Clients

  • Cursor: ~/.cursor/mcp.json

  • Cline: ~/.cline/mcp.json

  • Windsurf: MCP settings file

  • Other agents: Check your agent's MCP documentation

โœจ Benefits of npx:

  • ๐Ÿš€ No installation needed - works immediately

  • ๐Ÿ”„ Always latest version - automatically updates

  • ๐Ÿ“ฑ Cross-platform - works everywhere Node.js is installed

  • ๐Ÿงน Clean system - no global packages required

Option 2: Global Installation (For Frequent Users)

If you plan to use this MCP server frequently, install it globally:

npm install -g openrouter-image-mcp

Then use this configuration:

{ "mcp": { "servers": { "openrouter-image": { "command": "openrouter-image-mcp", "env": { "OPENROUTER_API_KEY": "sk-or-v1-your-api-key-here", "OPENROUTER_MODEL": "google/gemini-2.0-flash-exp:free" } } } } }

Benefits of global installation:

  • โšก Faster startup - no download time

  • ๐ŸŒ Works offline - once installed

  • ๐Ÿ”ง Simpler command - shorter configuration

Option 3: Local Development

If you cloned the repo locally for development:

{ "mcpServers": { "openrouter-image": { "command": "node", "args": ["/path/to/openrouter-image-mcp/dist/index.js"], "env": { "OPENROUTER_API_KEY": "sk-or-v1-your-api-key-here", "OPENROUTER_MODEL": "google/gemini-2.0-flash-exp:free" } } } }

๐ŸŽฏ Pro Tip: Replace the API key with your actual OpenRouter key. The free model works great for most use cases!

๐Ÿ’ก Recommendation: Start with npx (Option 1) - it's the easiest and most reliable way to get started!

๐Ÿ’ก Pro Tips for Local Setup

๐ŸŽฏ Path Management

  • Absolute paths work best: /path/to/openrouter-image-mcp/dist/index.js

  • Avoid relative paths: May break when switching directories

  • Use your actual path: Update the examples with your real project location

๐Ÿ”ง Environment Variables

  • Set in : Keep your API key secure

  • OR set in system: export OPENROUTER_API_KEY=sk-or-v1-...

  • Test quickly: Run OPENROUTER_API_KEY=... node dist/index.js

๐Ÿš€ Quick Verification

# ๐Ÿ” Test if server works export OPENROUTER_API_KEY=sk-or-v1-your-key export OPENROUTER_MODEL=google/gemini-2.5-flash-lite-preview-09-2025 node dist/index.js # โœ… Should see logs: "Starting OpenRouter Image MCP Server"

๐Ÿ› Troubleshooting Local Issues

โŒ "Command not found"

# โœ… Use absolute path to node "$(which node)" "/path/to/openrouter-image-mcp/dist/index.js"

โŒ "File not found"

# โœ… Verify the built file exists ls -la /path/to/openrouter-image-mcp/dist/index.js # ๐Ÿ“ Rebuild if missing npm run build

โŒ "API key required"

# โœ… Check your environment variables echo $OPENROUTER_API_KEY # ๐Ÿ”ง Or create .env file echo "OPENROUTER_API_KEY=sk-or-v1-your-key" > .env

๐ŸŒŸ Local Development Workflow

  1. ๐Ÿ› ๏ธ Build once: npm run build

  2. โš™๏ธ Configure once: Add MCP config to your AI agent

  3. ๐Ÿ”„ Restart agent: Pick up the new configuration

  4. ๐ŸŽฏ Use immediately: No manual server management needed!


๐Ÿ”ฅ Usage Examples

With Claude Code ๐Ÿค–

Add this to your ~/.claude.json:

{ "mcp": { "servers": { "openrouter-image": { "command": "npx", "args": ["openrouter-image-mcp"], "env": { "OPENROUTER_API_KEY": "sk-or-v1-your-api-key-here", "OPENROUTER_MODEL": "google/gemini-2.0-flash-exp:free" } } } } }

With Claude Desktop ๐Ÿ–ฅ๏ธ

Add this to your claude_desktop_config.json:

{ "mcpServers": { "openrouter-image": { "command": "npx", "args": ["openrouter-image-mcp"], "env": { "OPENROUTER_API_KEY": "sk-or-v1-your-api-key-here", "OPENROUTER_MODEL": "google/gemini-2.0-flash-exp:free" } } } }

๐ŸŽฏ Amazing Things You Can Do!

# ๐Ÿ“ธ Analyze any screenshot "Analyze this screenshot: /path/to/screenshot.png" # ๐Ÿ” Extract text from images "What text do you see in this document: /path/to/scan.jpg" # ๐ŸŽจ Review UI designs "Review this UI mockup for accessibility issues: /path/to/design.png" # ๐Ÿ“ฑ Debug mobile apps "Analyze this mobile app screenshot for UX problems: /path/to/app.png" # ๐ŸŒ Analyze webpages "What can you tell me about this webpage: https://example.com/screenshot.png"

๐Ÿ› ๏ธ Available Tools

๐Ÿ–ผ๏ธ analyze_image - General Image Analysis

Perfect for photos, diagrams, charts, and general visual content!

Parameters:

  • type ๐Ÿ“ Input type: file, url, or base64

  • data ๐Ÿ“ธ Image data (path, URL, or base64 string)

  • prompt ๐Ÿ’ญ Custom analysis prompt

  • format ๐Ÿ“Š Output: text or json

  • maxTokens ๐Ÿ”ข Maximum response tokens (default: 4000)

  • temperature ๐ŸŒก๏ธ Creativity 0-2 (default: 0.1)

๐ŸŒ analyze_webpage_screenshot - Webpage Specialist

Designed specifically for web page analysis and debugging!

Features:

  • ๐ŸŽฏ Layout analysis

  • ๐Ÿ“ฑ Content extraction

  • ๐Ÿ”— Navigation review

  • ๐Ÿ“ Form analysis

  • โ™ฟ Accessibility evaluation

  • ๐Ÿ“Š Structured JSON output

๐Ÿ“ฑ analyze_mobile_app_screenshot - Mobile App Expert

Specialized for mobile application UI/UX analysis!

Features:

  • ๐ŸŽ iOS/๐Ÿค– Android platform detection

  • ๐ŸŽจ UI design review

  • ๐Ÿ‘† User experience evaluation

  • โ™ฟ Accessibility analysis

  • ๐Ÿ“Š UX heuristic scoring

  • ๐Ÿš€ Performance insights


๐Ÿ’ฐ Vision Model Recommendations

Model

Cost

Vision Quality

Best For

๐Ÿ†“

google/gemini-2.0-flash-exp:free

FREE

โญโญโญโญโญ

Great for beginners!

General analysis, docs

๐Ÿ†“

meta-llama/llama-3.2-90b-vision-instruct

FREE

โญโญโญโญ

Charts, diagrams, technical content

๐ŸŒŸ

google/gemini-2.5-flash-lite-preview-09-2025

๐Ÿ’ฐ

Very Low

โญโญโญโญโญ

Best value!

High quality at low cost

๐Ÿง 

anthropic/claude-3-5-sonnet-20241022

๐Ÿ’ฐ๐Ÿ’ฐ Medium

โญโญโญโญโญ

Detailed analysis, complex reasoning

๐Ÿ”ฅ

anthropic/claude-3-5-haiku-20241022

๐Ÿ’ฐ๐Ÿ’ฐ๐Ÿ’ฐ Higher

โญโญโญโญโญ

High accuracy, professional use

๐ŸŽฏ Recommended Models

  • ๐Ÿ†“ Start with FREE models: google/gemini-2.0-flash-exp:free works excellently for most use cases

  • ๐Ÿ’ฐ Upgrade when needed: Move to paid models only if you need higher accuracy or specific features

  • ๐Ÿ”ฅ Best performance: anthropic/claude-3-5-sonnet-20241022 for professional analysis

๐Ÿ’ก Cost Tips

  • Free models handle ~80% of use cases perfectly

  • Paid models cost ~$0.001-0.01 per image

  • Monitor usage at OpenRouter Dashboard


๐Ÿ› ๏ธ Development

Local Setup ๐Ÿ”ง

# ๐Ÿด Clone the repository git clone https://github.com/your-username/openrouter-image-mcp.git cd openrouter-image-mcp # ๐Ÿ“ฆ Install dependencies npm install # ๐Ÿ”จ Build the project npm run build # ๐Ÿš€ Start in development mode npm run dev # ๐Ÿงช Run tests npm test # ๐Ÿ” Lint and format npm run lint npm run format


๐Ÿงช Testing

Run Test Suite ๐Ÿงช

# ๐Ÿงช Run all tests npm test # ๐Ÿ“Š Run with coverage npm run test:coverage # ๐Ÿ” Debug mode DEBUG=* npm test

Manual Testing ๐ŸŽฏ

# ๐Ÿ“ธ Test with a sample image node test-image-analysis.js # ๐Ÿ” Test different models OPENROUTER_MODEL=anthropic/claude-sonnet-4 node test-image-analysis.js # ๐Ÿš€ Test with URL input echo '{"type":"url","data":"https://example.com/image.png","prompt":"What do you see?"}' | node dist/index.js

๐Ÿค Contributing

Contributions welcome! Fork the repo, make changes, and submit a pull request. Please follow the existing code style and add tests for new features.


๐Ÿ“„ Supported Image Formats

Format

Extension

MIME Type

Status

๐Ÿ–ผ๏ธ JPEG

.jpg

,

.jpeg

image/jpeg

โœ…

๐Ÿ–ผ๏ธ PNG

.png

image/png

โœ…

๐Ÿ–ผ๏ธ WebP

.webp

image/webp

โœ…

๐Ÿ–ผ๏ธ GIF

.gif

image/gif

โœ…

๐Ÿ“

Max Size

-

-

10MB

(configurable)


๐Ÿ›ก๏ธ Security & Privacy

  • ๐Ÿ” API Keys: Loaded from environment variables only

  • ๐Ÿšซ No Sensitive Logging: Personal data never logged

  • โœ… Input Validation: All parameters validated

  • ๐Ÿ“ Size Limits: Configurable file size restrictions

  • ๐Ÿ”’ HTTPS Only: All API communications encrypted

  • ๐Ÿ—‘๏ธ Data Cleanup: Temporary files automatically removed


๐Ÿ“š Troubleshooting

๐Ÿ”ง Common Issues & Solutions

๐Ÿ”‘ "OPENROUTER_API_KEY environment variable is required"

# โœ… Solution: Set your API key export OPENROUTER_API_KEY=sk-or-v1-your-key-here # Or add to .env file

๐Ÿค– "Invalid or unsupported model"

# โœ… Check available models curl -H "Authorization: Bearer $OPENROUTER_API_KEY" \ https://openrouter.ai/api/v1/models | jq '.data[] | select(.architecture.input_modalities | contains(["image"])) | .id'

๐Ÿ“ก "Failed to connect to OpenRouter API"

# โœ… Test connection curl -H "Authorization: Bearer $OPENROUTER_API_KEY" \ https://openrouter.ai/api/v1/models

๐Ÿ“ "Image size exceeds maximum"

# โœ… Increase limit or compress image export MAX_IMAGE_SIZE=20971520 # 20MB

๐Ÿ› Debug Mode

# ๐Ÿ” Enable detailed logging export LOG_LEVEL=debug npm start # ๐Ÿ“Š Monitor API usage curl -H "Authorization: Bearer $OPENROUTER_API_KEY" \ https://openrouter.ai/api/v1/auth/key

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿš€ Ready to give your AI agents the power of sight?

โญ Star this repo

Made with โค๏ธ by the open-source community

Deploy Server
-
security - not tested
A
license - permissive license
-
quality - not tested

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Enables AI agents to analyze and understand images using OpenRouter's vision models. Supports screenshots, photos, diagrams, and web content with specialized tools for webpage and mobile app analysis.

  1. ๐ŸŒŸ What Makes This Special?
    1. ๐Ÿš€ Quick Start
      1. Prerequisites ๐Ÿ“‹
      2. Installation ๐Ÿ“ฆ
      3. Configuration โš™๏ธ
    2. ๐Ÿ  Works Locally - No Restarts Needed! ๐ŸŽฏ
      1. ๐Ÿ”„ How It Works Automatically
      2. โšก Local Setup Benefits
    3. ๐Ÿ”ง MCP Configuration
      1. Option 1: Using npx (Recommended - No Installation Required)
      2. Option 2: Global Installation (For Frequent Users)
      3. Option 3: Local Development
      4. ๐Ÿ’ก Pro Tips for Local Setup
      5. ๐ŸŒŸ Local Development Workflow
    4. ๐Ÿ”ฅ Usage Examples
      1. With Claude Code ๐Ÿค–
      2. With Claude Desktop ๐Ÿ–ฅ๏ธ
      3. ๐ŸŽฏ Amazing Things You Can Do!
    5. ๐Ÿ› ๏ธ Available Tools
      1. ๐Ÿ–ผ๏ธ analyze_image - General Image Analysis
      2. ๐ŸŒ analyze_webpage_screenshot - Webpage Specialist
      3. ๐Ÿ“ฑ analyze_mobile_app_screenshot - Mobile App Expert
    6. ๐Ÿ’ฐ Vision Model Recommendations
      1. ๐ŸŽฏ Recommended Models
      2. ๐Ÿ’ก Cost Tips
    7. ๐Ÿ› ๏ธ Development
      1. Local Setup ๐Ÿ”ง
    8. ๐Ÿงช Testing
      1. Run Test Suite ๐Ÿงช
      2. Manual Testing ๐ŸŽฏ
    9. ๐Ÿค Contributing
      1. ๐Ÿ“„ Supported Image Formats
        1. ๐Ÿ›ก๏ธ Security & Privacy
          1. ๐Ÿ“š Troubleshooting
            1. ๐Ÿ”ง Common Issues & Solutions
            2. ๐Ÿ› Debug Mode
          2. ๐Ÿ“„ License

            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/JonathanJude/openrouter-image-mcp'

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