simple-vision-mcp

simple-vision-mcp

A lightweight MCP server for image analysis using any OpenAI-compatible API endpoint, enabling AI agents to analyze images via a single tool.

Category
访问服务器

README

Simple Vision MCP

A lightweight, focused Model Context Protocol (MCP) server designed specifically for image analysis using OpenAI-compatible APIs. Built with TypeScript and the MCP SDK.

Motivation

When working with AI coding agents that don't natively support vision capabilities, you often need a reliable way to analyze images. Many existing MCP vision servers are tightly coupled to specific providers (like OpenRouter or OpenAI) or come with unnecessary complexity.

Simple Vision MCP was created to solve a specific problem: enabling any OpenAI-compatible API endpoint to function as a vision analysis backend. It focuses on doing one thing exceptionally well - analyzing images - while remaining flexible enough to work with any OpenAI-compatible provider.

The Problem We Solved

During setup, we encountered several issues:

  1. Many vision MCP servers only support specific providers (OpenRouter, OpenAI, etc.)
  2. Container-based solutions had stdio communication issues
  3. Python-based servers had dependency conflicts
  4. Existing solutions were overly complex for the basic need

Simple Vision MCP addresses these by:

  • Supporting any OpenAI-compatible API endpoint
  • Running as a native Node.js process (no containers needed)
  • Minimal, focused codebase that's easy to debug and maintain
  • Zero external dependencies beyond the MCP SDK

Features

  • OpenAI-Compatible: Works with any API that follows the OpenAI chat completions format
  • Single Tool Focus: One purpose - image analysis done right
  • TypeScript: Full type safety and modern JavaScript
  • Minimal Dependencies: Only essential dependencies
  • STDIO Communication: Native MCP protocol support
  • Configurable: Full control via environment variables
  • npx Support: Can run directly with npx, no installation required

Installation

Prerequisites

  • Node.js 18 or higher
  • An OpenAI-compatible API endpoint with vision capabilities

Quick Start with npx (Recommended)

No installation required - just run directly:

npx -y @erickstryck/simple-vision-mcp

Global Installation

npm install -g @erickstryck/simple-vision-mcp

From Source

git clone https://github.com/erickstryck/simple-vision-mcp.git
cd simple-vision-mcp
npm install
npm run build

Configuration

Simple Vision MCP is configured entirely via environment variables. Create a .env file or export variables directly:

Variable Description Required Default
VISION_API_KEY Your API key Yes -
VISION_BASE_URL API endpoint base URL Yes https://api.openai.com/v1
VISION_MODEL Model name for vision Yes gpt-4o-mini
VISION_MAX_TOKENS Max response tokens No 4096
VISION_TIMEOUT Request timeout (seconds) No 120
VISION_RESIZE Resize image before analysis (WxH format, e.g., 1920x1080) No -

Example .env File

VISION_API_KEY=your-api-key-here
VISION_BASE_URL=https://your-custom-endpoint.com/api/v1
VISION_MODEL=Qwen3.5-4B-AWQ
VISION_MAX_TOKENS=4096
VISION_TIMEOUT=120
VISION_RESIZE=1920x1080

Usage

Running the Server

# Using npx (recommended - always gets latest version)
npx -y @erickstryck/simple-vision-mcp

# Using global installation
simple-vision-mcp

# From source
npm start

# With environment variables inline
VISION_API_KEY=your-key VISION_BASE_URL=https://api.example.com/v1 VISION_MODEL=your-model npx -y @erickstryck/simple-vision-mcp

OpenCode Configuration

Add to your opencode.json:

{
  "mcp": {
    "vision": {
      "type": "local",
      "command": ["npx", "-y", "@erickstryck/simple-vision-mcp"],
      "env": {
        "VISION_API_KEY": "your-api-key",
        "VISION_BASE_URL": "https://your-endpoint.com/api/v1",
        "VISION_MODEL": "your-vision-model"
      },
      "enabled": true
    }
  }
}

Claude Desktop Configuration

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

{
  "mcpServers": {
    "vision": {
      "command": "npx",
      "args": ["-y", "@erickstryck/simple-vision-mcp"],
      "env": {
        "VISION_API_KEY": "your-api-key",
        "VISION_BASE_URL": "https://your-endpoint.com/api/v1",
        "VISION_MODEL": "your-vision-model"
      }
    }
  }
}

Cursor Configuration

Add to your Cursor MCP settings:

{
  "mcpServers": {
    "vision": {
      "command": "npx",
      "args": ["-y", "@erickstryck/simple-vision-mcp"],
      "env": {
        "VISION_API_KEY": "your-api-key",
        "VISION_BASE_URL": "https://your-endpoint.com/api/v1",
        "VISION_MODEL": "your-vision-model"
      }
    }
  }
}

Available Tools

analyze_image

Analyzes an image and returns a detailed description.

Parameters:

Parameter Type Description Required
image_path string Path to the image file Yes
prompt string Custom analysis prompt No
width number Target width to resize the image before analysis No
height number Target height to resize the image before analysis No

Default Prompt: "Describe this image in detail, including objects, text, colors, composition, and any notable features."

Example:

{
  "name": "analyze_image",
  "arguments": {
    "image_path": "/path/to/image.png",
    "prompt": "What objects are in this image?"
  }
}

Response:

{
  "content": [
    {
      "type": "text",
      "text": "The image shows a red square with..."
    }
  ]
}

Supported Image Formats

  • PNG (.png)
  • JPEG (.jpg, .jpeg)
  • GIF (.gif)
  • WebP (.webp)
  • BMP (.bmp)

Development

Project Structure

simple-vision-mcp/
├── src/
│   ├── config/
│   │   └── index.ts          # Configuration loading
│   ├── services/
│   │   └── visionService.ts  # Vision API client
│   ├── tools/
│   │   └── analyzeImage.ts   # MCP tool definition
│   ├── utils/
│   │   └── imageProcessor.ts # Image processing utilities
│   └── index.ts              # Main entry point
├── bin/
│   └── cli.js                # CLI wrapper
├── tests/
│   ├── config.test.ts
│   ├── imageProcessor.test.ts
│   └── visionService.test.ts
├── package.json
├── tsconfig.json
└── README.md

Building

npm run build

Testing

# Run tests once
npm test

# Watch mode
npm run test:watch

Design Principles

  1. Single Responsibility: Each module has one clear purpose
  2. Dependency Injection: Services receive dependencies via constructor
  3. Functional Core: Business logic is pure and testable
  4. Explicit over Implicit: Clear types and function signatures

Troubleshooting

"VISION_API_KEY environment variable is required"

Ensure you've set the VISION_API_KEY environment variable before starting the server.

"Unsupported image format"

The image format is not supported. Ensure your image is PNG, JPEG, GIF, WebP, or BMP format.

"Vision API error: 401"

Authentication failed. Verify your API key is correct and has access to vision capabilities.

"Vision API error: 4xx/5xx"

Check your VISION_BASE_URL is correct and the API endpoint is accessible.

License

MIT License - see LICENSE file for details.

Contributing

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

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选