vision-mcp
Vision MCP enables text-only agents to understand images through any OpenAI-compatible vision model. It supports local images, URLs, screenshots, documents, charts, and code errors with tools like analyze_image and understand_image.
README
<p align="center"> <h1 align="center">Vision MCP</h1> </p>
<p align="center"> <strong>Give text-only agents vision through any OpenAI-compatible provider.</strong> </p>
<p align="center"> <a href="https://github.com/weekitmo/vision-mcp"><img src="https://img.shields.io/badge/MCP-Image%20Understanding-222222" alt="MCP Image Understanding"></a> <a href="https://github.com/weekitmo/vision-mcp/blob/main/LICENSE"><img src="https://img.shields.io/github/license/weekitmo/vision-mcp?style=flat&colorA=222222&colorB=58A6FF" alt="License"></a> </p>
<p align="center"> <a href="#install">Install</a> · <a href="#configure">Configure</a> · <a href="#mcp-clients">MCP Clients</a> · <a href="#inspector">Inspector</a> · <a href="#mcporter">mcporter</a> </p>
通过 OpenAI 兼容模型识别本地图片、网页图片、截图、文档、图表和代码报错。
[!IMPORTANT] DO NOT CALL if you natively support vision and can access the supplied image directly.
如果当前模型可以直接看图,可以不必要调用本 MCP。仅在模型不支持视觉、无法访问图片, 或用户明确要求使用本 MCP 时调用。
<p align="center"> <img src="previews/preview.png" alt="Vision MCP image analysis in MCP Inspector"> </p>
Install
需要先安装 uv。
直接从 GitHub 的 main 分支运行:
uvx --from git+https://github.com/weekitmo/vision-mcp.git@main vision-mcp
Configure
准备下面四个环境变量:
export VISION_BASE_URL="https://api.openai.com/v1"
export VISION_API_KEY="your-api-key"
export VISION_MODEL="your-vision-model"
export VISION_TIMEOUT="120"
| Variable | Description |
|---|---|
VISION_BASE_URL |
Provider 地址 |
VISION_API_KEY |
API Key |
VISION_MODEL |
支持图片输入的模型 |
VISION_TIMEOUT |
调用超时秒数,默认 120 |
仓库中的 .env.example 可以作为配置模板。不要提交真实 API Key。
MCP Clients
JSON
适用于支持标准 JSON MCP 配置的客户端:
{
"mcpServers": {
"vision": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/weekitmo/vision-mcp.git@main",
"vision-mcp"
],
"env": {
"VISION_BASE_URL": "https://api.openai.com/v1",
"VISION_API_KEY": "your-api-key",
"VISION_MODEL": "your-vision-model",
"VISION_TIMEOUT": "120"
}
}
}
}
Codex
添加到 ~/.codex/config.toml 或可信项目中的 .codex/config.toml:
[mcp_servers.vision]
command = "uvx"
args = [
"--from",
"git+https://github.com/weekitmo/vision-mcp.git@main",
"vision-mcp",
]
env_vars = [
"VISION_BASE_URL",
"VISION_API_KEY",
"VISION_MODEL",
"VISION_TIMEOUT",
]
startup_timeout_sec = 60
tool_timeout_sec = 180
先导出 VISION_* 环境变量,再启动 Codex:
codex mcp list
完整示例见 config/codex.toml.example。
Grok
添加到 ~/.grok/config.toml 或项目中的 .grok/config.toml:
[mcp_servers.vision]
command = "uvx"
args = [
"--from",
"git+https://github.com/weekitmo/vision-mcp.git@main",
"vision-mcp",
]
enabled = true
startup_timeout_sec = 60
tool_timeout_sec = 180
先导出 VISION_* 环境变量,再启动 Grok:
grok mcp list
完整示例见 config/grok.toml.example。
Inspector
一条命令启动 MCP Inspector:
./scripts/test-ui.sh
脚本固定使用 @modelcontextprotocol/inspector@2.1.0。
在 Inspector 中:
- 打开
vision-local。 - 在
Environment Variables中填写四个VISION_*配置。 - 连接 Server。
- 打开
Tools。 - 选择
analyze_image或understand_image。 - 填写图片路径和问题,运行工具。
Inspector 的本地配置保存在 .inspector/mcp.json,该文件不会被 Git 提交。
mcporter
初始化项目配置:
./scripts/setup-mcporter.sh
查看工具:
mcporter list vision --schema --all-parameters
识别一张图片:
mcporter call vision.analyze_image \
image=/absolute/path/to/screenshot.png \
prompt="提取图片中的所有文字" \
mode=ocr \
detail=high \
--timeout 120000
比较多张图片:
mcporter call vision.understand_image \
--args '{
"images": [
"/absolute/path/before.png",
"/absolute/path/after.png"
],
"prompt": "比较两张图片的差异",
"mode": "compare"
}' \
--timeout 120000 \
--output json
查看内置使用说明:
mcporter resource vision
mcporter resource vision vision://docs/quickstart
mcporter resource vision vision://docs/tools
Tools
analyze_image
用于识别单张图片,适合 Inspector、mcporter 和命令行调用。
image 本地路径、HTTP(S) URL 或 data URL
prompt 希望模型回答的问题
mode 识别模式
ascii_mode 是否使用 ASCII 表达布局
detail 图片解析精度
max_tokens 最大输出长度
understand_image
用于多图识别、图片比较,以及需要兼容不同图片参数格式的客户端。
images 图片列表
prompt 希望模型回答的问题
mode 识别模式
ascii_mode 是否使用 ASCII 表达布局
detail 图片解析精度
max_tokens 最大输出长度
可用模式:
auto · describe · ocr · document · ui · chart · compare ·
spatial · code
支持 PNG、JPEG、WEBP 和 GIF。单次最多识别 10 张图片。
From Source
需要修改或调试时:
git clone https://github.com/weekitmo/vision-mcp.git
cd vision-mcp
uv sync --frozen
uv run vision-mcp
在 MCP 客户端中从源码启动:
{
"mcpServers": {
"vision": {
"command": "uv",
"args": [
"--directory",
"/absolute/path/to/vision-mcp",
"run",
"--frozen",
"vision-mcp"
],
"env": {
"VISION_BASE_URL": "https://api.openai.com/v1",
"VISION_API_KEY": "your-api-key",
"VISION_MODEL": "your-vision-model",
"VISION_TIMEOUT": "120"
}
}
}
}
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。