đŒïžđ€ OpenRouter Image MCP Server
đ„ 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 đŠ
bash# đ 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)
bash# đ 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
bash# đ Copy the environment template cp .env.example .env # âïž Edit with your credentials nano .env
Add your OpenRouter credentials to .env:
bash# đ 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
- đŻ Configure once â Set up your MCP client one time
- đ Auto-launches â Client starts the server automatically
- đ§ Connects â Validates API and loads models instantly
- đ ïž 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:
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:
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:
bashnpm install -g openrouter-image-mcp
Then use this configuration:
json{ "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:
json{ "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
.envfile: 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
bash# đ 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"
bash# â Use absolute path to node "$(which node)" "/path/to/openrouter-image-mcp/dist/index.js"
â "File not found"
bash# â Verify the built file exists ls -la /path/to/openrouter-image-mcp/dist/index.js # đ Rebuild if missing npm run build
â "API key required"
bash# â 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
- đ ïž Build once:
npm run build - âïž Configure once: Add MCP config to your AI agent
- đ Restart agent: Pick up the new configuration
- đŻ Use immediately: No manual server management needed!
đ„ Usage Examples
With Claude Code đ€
Add this to your ~/.claude.json:
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:
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!
bash# đž 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, orbase64datađž Image data (path, URL, or base64 string)promptđ Custom analysis promptformatđ Output:textorjsonmaxTokensđą 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:freeworks 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-20241022for 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 đ§
bash# đŽ 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 đ§Ș
bash# đ§Ș Run all tests npm test # đ Run with coverage npm run test:coverage # đ Debug mode DEBUG=* npm test
Manual Testing đŻ
bash# đž 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"
bash# â Solution: Set your API key export OPENROUTER_API_KEY=sk-or-v1-your-key-here # Or add to .env file
đ€ "Invalid or unsupported model"
bash# â 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"
bash# â Test connection curl -H "Authorization: Bearer $OPENROUTER_API_KEY" \ https://openrouter.ai/api/v1/models
đ "Image size exceeds maximum"
bash# â Increase limit or compress image export MAX_IMAGE_SIZE=20971520 # 20MB
đ Debug Mode
bash# đ 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 âą đ Report Issues âą đĄ Suggest Features
Made with â€ïž by the open-source community




