Skip to main content
Glama

MCP OpenVision

CI Versión de PyPI Versiones de Python Licencia: MIT Invítame a un café insignia de herrería

Descripción general

MCP OpenVision es un servidor de Protocolo de Contexto de Modelo (MCP) que ofrece funciones de análisis de imágenes basadas en modelos de visión de OpenRouter. Permite a los asistentes de IA analizar imágenes mediante una interfaz sencilla dentro del ecosistema MCP.

Related MCP server: MCP OpenVision

Instalación

Instalación mediante herrería

Para instalar mcp-openvision para Claude Desktop automáticamente a través de Smithery :

npx -y @smithery/cli install @Nazruden/mcp-openvision --client claude

Usando pip

pip install mcp-openvision

Uso de UV (recomendado)

uv pip install mcp-openvision

Configuración

MCP OpenVision requiere una clave API de OpenRouter y se puede configurar a través de variables de entorno:

  • OPENROUTER_API_KEY (obligatorio): Su clave API de OpenRouter

  • OPENROUTER_DEFAULT_MODEL (opcional): El modelo de visión a utilizar

Modelos de visión de OpenRouter

MCP OpenVision funciona con cualquier modelo de OpenRouter compatible con funciones de visión. El modelo predeterminado es qwen/qwen2.5-vl-32b-instruct:free , pero puede especificar cualquier otro modelo compatible.

Algunos modelos de visión populares disponibles a través de OpenRouter incluyen:

  • qwen/qwen2.5-vl-32b-instruct:free (predeterminado)

  • anthropic/claude-3-5-sonnet

  • anthropic/claude-3-opus

  • anthropic/claude-3-sonnet

  • openai/gpt-4o

Puede especificar modelos personalizados configurando la variable de entorno OPENROUTER_DEFAULT_MODEL o pasando el parámetro model directamente a la función image_analysis .

Uso

Pruebas con MCP Inspector

La forma más sencilla de probar MCP OpenVision es con la herramienta MCP Inspector:

npx @modelcontextprotocol/inspector uvx mcp-openvision

Integración con Claude Desktop o Cursor

  1. Edite su archivo de configuración MCP:

    • Windows: %USERPROFILE%\.cursor\mcp.json

    • macOS: ~/.cursor/mcp.json o ~/Library/Application Support/Claude/claude_desktop_config.json

  2. Agregue la siguiente configuración:

{
  "mcpServers": {
    "openvision": {
      "command": "uvx",
      "args": ["mcp-openvision"],
      "env": {
        "OPENROUTER_API_KEY": "your_openrouter_api_key_here",
        "OPENROUTER_DEFAULT_MODEL": "anthropic/claude-3-sonnet"
      }
    }
  }
}

Corriendo localmente por el desarrollo

# Set the required API key
export OPENROUTER_API_KEY="your_api_key"

# Run the server module directly
python -m mcp_openvision

Características

MCP OpenVision proporciona la siguiente herramienta principal:

  • image_analysis : Analiza imágenes con modelos de visión, admitiendo varios parámetros:

    • image : Se puede proporcionar como:

      • Datos de imagen codificados en Base64

      • URL de la imagen (http/https)

      • Ruta de archivo local

    • query : Instrucciones de usuario para la tarea de análisis de imágenes

    • system_prompt : Instrucciones que definen el rol y el comportamiento del modelo (opcional)

    • model : Modelo de visión a utilizar

    • temperature : controla la aleatoriedad (0,0-1,0)

    • max_tokens : Longitud máxima de respuesta

Elaboración de consultas eficaces

El parámetro query es crucial para obtener resultados útiles del análisis de imágenes. Una consulta bien elaborada proporciona contexto sobre:

  1. Propósito : ¿Por qué estás analizando esta imagen?

  2. Áreas de enfoque : Elementos o detalles específicos a los que prestar atención

  3. Información requerida : El tipo de información que necesita extraer

  4. Preferencias de formato : cómo desea que se estructuren los resultados

Ejemplos de consultas efectivas

Consulta básica

Consulta mejorada

"Describe esta imagen"

Identifica todos los productos minoristas visibles en la imagen del estante de esta tienda y calcula su rango de precios.

"¿Qué hay en esta imagen?"

Analice esta exploración médica en busca de anomalías, centrándose en el área resaltada y brindando posibles diagnósticos.

"Analiza este gráfico"

Extraiga los datos numéricos de este gráfico de barras que muestra las ventas trimestrales e identifique las tendencias clave de 2022 a 2023.

"Lea el texto"

Transcriba todo el texto visible del menú de este restaurante, conservando los nombres de los platos, las descripciones y los precios.

Al proporcionar contexto sobre por qué necesita el análisis y qué información específica está buscando, ayuda al modelo a centrarse en los detalles relevantes y producir información más valiosa.

Ejemplo de uso

# Analyze an image from a URL
result = await image_analysis(
    image="https://example.com/image.jpg",
    query="Describe this image in detail"
)

# Analyze an image from a local file with a focused query
result = await image_analysis(
    image="path/to/local/image.jpg",
    query="Identify all traffic signs in this street scene and explain their meanings for a driver education course"
)

# Analyze with a base64-encoded image and a specific analytical purpose
result = await image_analysis(
    image="SGVsbG8gV29ybGQ=...",  # base64 data
    query="Examine this product packaging design and highlight elements that could be improved for better visibility and brand recognition"
)

# Customize the system prompt for specialized analysis
result = await image_analysis(
    image="path/to/local/image.jpg",
    query="Analyze the composition and artistic techniques used in this painting, focusing on how they create emotional impact",
    system_prompt="You are an expert art historian with deep knowledge of painting techniques and art movements. Focus on formal analysis of composition, color, brushwork, and stylistic elements."
)

Tipos de entrada de imágenes

La herramienta image_analysis acepta varios tipos de entradas de imágenes:

  1. Cadenas codificadas en Base64

  2. URL de imágenes : deben comenzar con http:// o https://

  3. Rutas de archivo :

    • Rutas absolutas : rutas completas que comienzan con / (Unix) o letra de unidad (Windows)

    • Rutas relativas : rutas relativas al directorio de trabajo actual

    • Rutas relativas con project_root : use el parámetro project_root para especificar un directorio base

Uso de rutas relativas

Al utilizar rutas de archivos relativas (como "ejemplos/imagen.jpg"), tiene dos opciones:

  1. La ruta debe ser relativa al directorio de trabajo actual donde se ejecuta el servidor.

  2. O bien, puede especificar un parámetro project_root :

# Example with relative path and project_root
result = await image_analysis(
    image="examples/image.jpg",
    project_root="/path/to/your/project",
    query="What is in this image?"
)

Esto es particularmente útil en aplicaciones donde el directorio de trabajo actual puede no ser predecible o cuando desea hacer referencia a archivos utilizando rutas relativas a un directorio específico.

Desarrollo

Configurar el entorno de desarrollo

# Clone the repository
git clone https://github.com/modelcontextprotocol/mcp-openvision.git
cd mcp-openvision

# Install development dependencies
pip install -e ".[dev]"

Formato de código

Este proyecto utiliza Black para el formato automático del código. El formato se aplica mediante GitHub Actions:

  • Todo el código enviado al repositorio se formatea automáticamente con Black

  • Para las solicitudes de extracción de los colaboradores del repositorio, Black formatea el código y lo confirma directamente en la rama de extracción.

  • Para las solicitudes de extracción de bifurcaciones, Black crea una nueva PR con el código formateado que se puede fusionar con la PR original.

También puedes ejecutar Black localmente para formatear tu código antes de confirmar:

# Format all Python code in the src and tests directories
black src tests

Ejecutar pruebas

pytest

Proceso de liberación

Este proyecto utiliza un proceso de lanzamiento automatizado:

  1. Actualice la versión en pyproject.toml siguiendo los principios de control de versiones semántico

    • Puede utilizar el script auxiliar: python scripts/bump_version.py [major|minor|patch]

  2. Actualice el CHANGELOG.md con detalles sobre la nueva versión

    • El script también crea una entrada de plantilla en CHANGELOG.md que puedes completar.

  3. Confirme y envíe estos cambios a la rama main

  4. El flujo de trabajo de GitHub Actions hará lo siguiente:

    • Detectar el cambio de versión

    • Crear automáticamente una nueva versión de GitHub

    • Activar el flujo de trabajo de publicación que publica en PyPI

Esta automatización ayuda a mantener un proceso de lanzamiento consistente y garantiza que cada lanzamiento esté versionado y documentado correctamente.

Apoyo

Si este proyecto te resulta útil, considera comprarme un café para apoyar el desarrollo y mantenimiento continuos.

Licencia

Este proyecto está licenciado bajo la licencia MIT: consulte el archivo de LICENCIA para obtener más detalles.

Available Tools

1 tool
image_analysisA
Analyze an image using OpenRouter's vision capabilities.

This tool allows you to send an image to OpenRouter's vision models for analysis.
You provide a query to guide the analysis and can optionally customize the system prompt
for more control over the model's behavior.

Args:
    image: The image as a base64-encoded string, URL, or local file path
    query: Text prompt to guide the image analysis. For best results, provide context
           about why you're analyzing the image and what specific information you need.
           Including details about your purpose and required focus areas leads to more
           relevant and useful responses.
    system_prompt: Instructions for the model defining its role and behavior
    model: The vision model to use (defaults to the value set by OPENROUTER_DEFAULT_MODEL)
    max_tokens: Maximum number of tokens in the response (100-4000)
    temperature: Temperature parameter for generation (0.0-1.0)
    top_p: Optional nucleus sampling parameter (0.0-1.0)
    presence_penalty: Optional penalty for new tokens based on presence in text so far (0.0-2.0)
    frequency_penalty: Optional penalty for new tokens based on frequency in text so far (0.0-2.0)
    project_root: Optional root directory to resolve relative image paths against

Returns:
    The analysis result as text

Examples:
    Basic usage with a file path:
        image_analysis(image="path/to/image.jpg", query="Describe this image in detail")

    Basic usage with an image URL:
        image_analysis(image="https://example.com/image.jpg", query="Describe this image in detail")

    Basic usage with a relative path and project root:
        image_analysis(image="examples/image.jpg", project_root="/path/to/project", query="Describe this image in detail")

    Usage with a detailed contextual query:
        image_analysis(
            image="path/to/image.jpg",
            query="Analyze this product packaging design for a fitness supplement. Identify all nutritional claims,
                  certifications, and health icons. Assess the visual hierarchy and how the key selling points
                  are communicated. This is for a competitive analysis project."
        )

    Usage with custom system prompt:
        image_analysis(
            image="path/to/image.jpg",
            query="What objects can you see in this image?",
            system_prompt="You are an expert at identifying objects in images. Focus on listing all visible objects."
        )
ParametersJSON Schema
NameRequiredDescriptionDefault
imageYes
queryNoDescribe this image in detail
system_promptNoYou are an expert vision analyzer with exceptional attention to detail. Your purpose is to provide accurate, comprehensive descriptions of images that help AI agents understand visual content they cannot directly perceive. Focus on describing all relevant elements in the image - objects, people, text, colors, spatial relationships, actions, and context. Be precise but concise, organizing information from most to least important. Avoid making assumptions beyond what's visible and clearly indicate any uncertainty. When text appears in images, transcribe it verbatim within quotes. Respond only with factual descriptions without subjective judgments or creative embellishments. Your descriptions should enable an agent to make informed decisions based solely on your analysis.
modelNo
max_tokensNo
temperatureNo
top_pNo
presence_penaltyNo
frequency_penaltyNo
project_rootNo

TDQS

A4.3/5.0
Behavior3/5

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

Without annotations, the description carries full burden for behavioral disclosure. It explains that the tool uses OpenRouter's vision models and returns text, and it lists default parameter values. However, it lacks information about external API dependencies, potential latency, failure modes, or rate limits, which are important for an agent to understand. The description is adequate but not comprehensive in this regard.

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 well-structured with a clear introductory sentence, parameter list, return value, and examples. While it is verbose in parts (e.g., the query parameter explanation is lengthy), every sentence adds value. It could be slightly more concise, but it is appropriately sized for the tool's complexity.

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

Completeness5/5

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

Given the tool's complexity (10 parameters, no output schema, no annotations), the description is highly complete. It explains all parameters, specifies return type ('The analysis result as text'), and provides comprehensive examples covering various use cases. The default system prompt is also elaborated, which adds valuable context.

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

Parameters5/5

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

Schema description coverage is 0%, so the description must compensate entirely. It does so excellently by providing detailed explanations for all 10 parameters, including their purpose, defaults, and constraints. For example, it explains that 'query' should include context for better results and provides examples. This enables correct parameter usage without relying on the schema.

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 clearly states the tool's purpose: 'Analyze an image using OpenRouter's vision capabilities.' It specifies the action (analyze), resource (image), and technology (OpenRouter's vision), leaving no ambiguity. With no sibling tools, differentiation is not needed, but the purpose is specific and actionable.

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 provides clear usage guidance through detailed parameter descriptions and multiple examples covering file paths, URLs, contextual queries, and custom system prompts. However, it does not explicitly state when not to use this tool or mention alternatives, though none exist. 'Clear context, no exclusions' accurately reflects this.

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

TDQS

A4.1/5.0
Disambiguation5/5

With only one tool, there is no possibility of confusion between tools. The tool's purpose is clear and unique.

Naming Consistency5/5

A single tool means no inconsistency in naming patterns. The name 'image_analysis' is descriptive and follows a common noun_noun convention.

Tool Count3/5

A single tool for a vision server feels slightly thin. While the one tool is comprehensive, the server scope seems narrow; typically 3-15 tools are expected for a well-scoped server.

Completeness2/5

The server only offers image analysis. Missing other common vision operations like model listing, batch processing, or generation. The surface is incomplete for a vision-focused server.

Maintenance

ActivityInactive
ResponsivenessUnresponsive

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/Nazruden/mcp-openvision'

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