GV

goehou/visual-enhancement-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

96 stars 6 forks 质量 85 趋势 8MIT

goehou/visual-enhancement-mcp 是从 https://github.com/goehou/visual-enhancement-mcp. 导入的 MCP 服务器候选

概览

goehou/visual-enhancement-mcp 是从 https://github.com/goehou/visual-enhancement-mcp. 导入的 MCP 服务器候选

概述(AI 翻译)

英文 |简体中文

mcp-vision-server 是一个 MCP stdio 服务器,允许 MCP 客户端分析图像并通过现有兼容 OpenAI 的 Vision 聊天完成 API 运行 OCR。

本文重点介绍如何从MCP客户端配置和使用服务器。

它所提供的

  • vision_analyze:通用图像理解,使用自定义提示词。
  • vision_ocr:OCR提取,带有可选语言和输出格式提示。
  • 图像输入仅通过以下其中一个:
  • imagePath:MCP服务器进程可用的本地绝对图像路径。
  • imageUrl:http://、https://、data:或file:// URL。
  • imageBase64 + imageMediaType:客户端转发的上传附件字节。
  • images:由上述字段组成的数组(最多8个),用于多图像调用,如比较。
  • 兼容OpenAI的上游请求形状:包含文本加上一个或多个image_url部分的聊天完成。
  • 在上游 429/[5xx/网络/超时失败时自动重试并带回撤。
  • 对本地文件、base64 和数据 URL 图像的大小有限制,以避免过多内存消耗。
  • 可选内存缓存,用于相同(工具+提示+图片+选项)调用。

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

mcp-vision-server

English | 简体中文

mcp-vision-server is an MCP stdio server that lets MCP clients analyze images and run OCR through an existing OpenAI-compatible vision Chat Completions API.

This document focuses on how to configure and use the server from an MCP client.

What it provides

  • vision_analyze: general image understanding with a custom prompt.
  • vision_ocr: OCR extraction with optional language and output-format hints.
  • Image input through exactly one of:
    • imagePath: a local absolute image path available to the MCP server process.
    • imageUrl: http://, https://, data:, or file:// URL.
    • imageBase64 + imageMediaType: uploaded attachment bytes forwarded by the client.
    • images: an array (up to 8) of the fields above, for multi-image calls such as comparisons.
  • OpenAI-compatible upstream request shape: Chat Completions with text plus one or more image_url parts.
  • Automatic retry with backoff on upstream 429/5xx/network/timeout failures.
  • Size limits on local file, base64, and data-URL images to avoid excessive memory use.
  • Optional in-memory result cache for identical (tool + prompt + images + options) calls.
  • Structured MCP output in addition to plain text content.

Required configuration

The server needs an upstream vision model endpoint. At minimum configure:

Setting Required CLI option Environment variable Description Example
API base URL Yes --api-base-url VISION_API_BASE_URL Root URL of the upstream OpenAI-compatible API. Prefer scheme + host only; keep the request path in api-path. https://api.openai.com
Model Yes --model VISION_MODEL Default vision-capable model exposed by the upstream API. A tool call can override it with model. gpt-4o-mini
API key Usually --api-key VISION_API_KEY Bearer token sent as Authorization: Bearer . Omit only when your endpoint does not require authentication. sk-xxxx

The final upstream URL is built from:


Example:

VISION_API_BASE_URL=https://api.openai.com
VISION_API_PATH=/v1/chat/completions
=> https://api.openai.com/v1/chat/completions

Full configuration reference

Configuration priority:

CLI arguments > environment variables > defaults
Purpose CLI option Alias Environment variable Default Notes
Upstream API base URL --api-base-url --vision-api-base-url VISION_API_BASE_URL none Required. Use the API root such as https://api.openai.com.
Upstream API path --api-path --vision-api-path VISION_API_PATH /v1/chat/completions Chat Completions endpoint path.
Upstream API key --api-key --vision-api-key VISION_API_KEY none Added as a Bearer token when set.
在 GitHub 查看完整 README

安装

npx -y mcp-vision-server --api-base-url https://your-api.example.com --api-path /v1/chat/completions --api-key sk-xxxx --model your-vision-model --timeout-ms 60000 --max-tokens 4096
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "vision": { "command": "npx", "args": [ "-y", "mcp-vision-server", "--api-base-url", "https://your-api.example.com", "--api-path", "/v1/chat/completions", "--api-key", "sk-xxxx", "--model", "your-vision-model", "--timeout-ms", "60000", "--max-tokens", "4096" ] } } }