Skip to main content
Glama
README.md
# šŸ” MCP Vision Analyze

A lightweight [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) server for AI image vision analysis. Powered by **OpenRouter** (Google Gemini, Grok, and more).

**Works with:** Claude Desktop, Claude Code CLI, Antigravity, Cursor, Pi Agent, Windsurf, Cline, VS Code, and any MCP-compatible client.

---

## ✨ Features

- šŸ–¼ļø Analyze images from **local file paths** or **HTTP(S) URLs**
- 🧠 Powered by **Google Gemini** models via OpenRouter
- šŸ’° Ultra cheap — ~**$0.0001** per image (free tier available)
- šŸ“ Extract text from screenshots (OCR)
- šŸ› Diagnose error messages in screenshots
- šŸ“Š Analyze charts, diagrams, and UI designs
- šŸš€ No rate limits — production ready
- šŸ”’ Secure — API keys stay local, never stored externally

---

## šŸ“¦ Pricing (OpenRouter)

| Model | Input | Output | Best For |
|-------|-------|--------|----------|
| `google/gemini-2.5-flash-lite` | $0.10/M tokens | $0.40/M tokens | **Default — cheapest** |
| `google/gemini-3.1-flash-lite` | $0.25/M tokens | $1.50/M tokens | Better quality |
| `google/gemini-3-flash-preview` | $0.50/M tokens | $3.00/M tokens | Best reasoning |
| `google/gemini-3.7-flash` | $0.38/M tokens | $1.88/M tokens | Latest model |
| `x-ai/grok-4.5` | $2.00/M tokens | $6.00/M tokens | Grok vision |

> šŸ’” 1 image analysis ā‰ˆ 1,300 input tokens + 150 output tokens ā‰ˆ **$0.0001**
> šŸ’” Free tier available — no credit card needed to start

---

## šŸš€ Quick Start

### 1. Get an API Key

Sign up at [OpenRouter](https://openrouter.ai/) and get your API key from [openrouter.ai/keys](https://openrouter.ai/keys).

### 2. Install

```bash
# Option A: Use directly with npx (recommended)
npx mcp-vision-analyze

# Option B: Clone and install manually
git clone https://github.com/rezkycodes/mcp-vision-analyze.git
cd mcp-vision-analyze
npm install
```

### 3. Configure Your MCP Client

Choose your client below. Set `OPENROUTER_API_KEY` in the `env` block.

#### Claude Desktop (`claude_desktop_config.json`)

```json
{
  "mcpServers": {
    "vision-analyze": {
      "command": "npx",
      "args": ["-y", "mcp-vision-analyze"],
      "env": {
        "OPENROUTER_API_KEY": "sk-or-v1-your-openrouter-key"
      }
    }
  }
}
```

#### Claude Code CLI

```bash
claude mcp add vision-analyze \
  -e OPENROUTER_API_KEY=sk-or-v1-your-openrouter-key \
  -- npx -y mcp-vision-analyze

# Or add to .mcp.json in your project root
```

Or add to `.mcp.json` in your project root:

```json
{
  "mcpServers": {
    "vision-analyze": {
      "command": "npx",
      "args": ["-y", "mcp-vision-analyze"],
      "env": {
        "OPENROUTER_API_KEY": "sk-or-v1-your-openrouter-key"
      }
    }
  }
}
```

#### Antigravity

Add via Settings → MCP, or edit `~/.gemini/antigravity/mcp_config.json`:

```json
{
  "mcpServers": {
    "vision-analyze": {
      "command": "npx",
      "args": ["-y", "mcp-vision-analyze"],
      "env": {
        "OPENROUTER_API_KEY": "sk-or-v1-your-openrouter-key"
      }
    }
  }
}
```

#### Pi Agent (`~/.pi/agent/mcp.json`)

```json
{
  "vision-analyze": {
    "transport": "stdio",
    "command": "npx",
    "args": ["-y", "mcp-vision-analyze"],
    "env": {
      "OPENROUTER_API_KEY": "sk-or-v1-your-openrouter-key"
    },
    "directTools": true
  }
}
```

#### Cursor (`.cursor/mcp.json`)

```json
{
  "mcpServers": {
    "vision-analyze": {
      "command": "npx",
      "args": ["-y", "mcp-vision-analyze"],
      "env": {
        "OPENROUTER_API_KEY": "sk-or-v1-your-openrouter-key"
      }
    }
  }
}
```

#### VS Code (`~/.config/Code/User/mcp.json`)

```json
{
  "servers": {
    "vision-analyze": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "mcp-vision-analyze"],
      "env": {
        "OPENROUTER_API_KEY": "sk-or-v1-your-openrouter-key"
      }
    }
  }
}
```

#### OpenCode (`~/.config/opencode/opencode.json`)

```json
{
  "mcp": {
    "vision-analyze": {
      "type": "local",
      "command": ["node", "/path/to/index.js"],
      "environment": {
        "OPENROUTER_API_KEY": "sk-or-v1-your-openrouter-key"
      },
      "enabled": true
    }
  }
}
```

---

## šŸ› ļø Usage

Once configured, the `vision_analyze` tool becomes available:

### Basic — Analyze a Screenshot

```json
{
  "image_url": "/path/to/screenshot.png",
  "prompt": "What is shown in this screenshot?"
}
```

### Extract Text (OCR)

```json
{
  "image_url": "/path/to/photo.png",
  "prompt": "Extract all text from this image"
}
```

### Diagnose an Error

```json
{
  "image_url": "/path/to/error.png",
  "prompt": "What error is shown and how to fix it?"
}
```

### Use a Different Model

```json
{
  "image_url": "/path/to/image.png",
  "prompt": "Analyze this chart",
  "model": "google/gemini-3-flash-preview"
}
```

### Use Grok Vision

```json
{
  "image_url": "/path/to/image.png",
  "prompt": "Describe this image",
  "model": "x-ai/grok-4.5"
}
```

---

## šŸ“ Project Structure

```
mcp-vision-analyze/
ā”œā”€ā”€ index.js            # MCP server (OpenRouter only)
ā”œā”€ā”€ package.json        # npm metadata
ā”œā”€ā”€ .env.example        # Config template
ā”œā”€ā”€ .env                # Your API keys (git-ignored)
ā”œā”€ā”€ .gitignore          # Git ignore rules
ā”œā”€ā”€ LICENSE             # MIT
└── README.md           # This file
```

---

## šŸ”§ Environment Variables

| Variable | Required | Default | Description |
|----------|----------|---------|-------------|
| `VISION_PROVIDER` | No | `openrouter` | Provider (only `openrouter` supported) |
| `OPENROUTER_API_KEY` | āœ… Yes | — | OpenRouter API key |
| `OPENROUTER_MODEL` | No | `google/gemini-2.5-flash-lite` | OpenRouter model |

---

## šŸ“¦ Available Models

| Model | Cost (input/output per M) | Quality |
|-------|---------------------------|---------|
| `google/gemini-2.5-flash-lite` | $0.10 / $0.40 | ⭐⭐⭐⭐ Best value |
| `google/gemini-3.1-flash-lite` | $0.25 / $1.50 | ⭐⭐⭐⭐ Great |
| `google/gemini-3-flash-preview` | $0.50 / $3.00 | ⭐⭐⭐⭐⭐ Best |
| `google/gemini-3.7-flash` | $0.38 / $1.88 | ⭐⭐⭐⭐⭐ Latest |
| `x-ai/grok-4.5` | $2.00 / $6.00 | ⭐⭐⭐⭐ Grok |

---

## šŸ¤ Supported Image Formats

- JPEG / JPG
- PNG
- GIF
- WebP
- BMP (auto-converted)
- SVG (auto-rasterized)

---

## ā“ FAQ

### How much does it cost?

~$0.0001 per image analysis. Free tier available — no credit card needed.

### Can I use Grok for vision?

Yes! Set `model: "x-ai/grok-4.5"`. Grok is not free on OpenRouter.

### Does it work offline?

No. Internet connection required for API calls.

### Is my image data stored?

No. Images are processed in-memory and sent directly to OpenRouter. Nothing is stored on disk.

---

## šŸ“„ License

MIT

---

## šŸ™ Credits

Inspired by the `vision_analyze` tool from [Hermes Agent](https://github.com/nicepkg/hermes).

TDQS

A4/5.0

Scored across 1 tool

Disambiguation5/5

The server has exactly one tool, so there is no possibility of confusing it with others. Its purpose is clearly stated and distinct.

Naming Consistency5/5

The single tool follows a clean verb_noun pattern (vision_analyze), which is consistent and self-explanatory.

Tool Count3/5

With only one tool, the server is extremely minimal and feels thin for broader workflows, though it is not trivial and adequately serves a focused purpose.

Completeness5/5

For a server dedicated solely to image analysis, the single tool fully covers the intended capability. There are no obvious missing operations within this narrow domain.

Maintenance

ActivityMaintained
ResponsivenessNo issues