vision-mcp
Enables text-only AI coding agents to analyze images and videos via vision-capable models (Gemini, Grok, OpenRouter), returning text descriptions for reasoning.
README
vision-mcp
MCP server that gives text-only AI coding agents the ability to understand images and videos. Works with OpenCode, Claude Desktop, Claude Code, Cursor, VS Code, and any MCP-compatible client — including agents running on models without native vision.
agent (text-only) → vision-mcp → Gemini / Grok / OpenRouter → text description
Why
Most coding agents run on strong text models (DeepSeek, Claude, etc.) that can't see images. When you paste a screenshot, a UI mockup, or an error screenshot, they say "I can't view images". vision-mcp fixes that: it takes the file, sends it to a vision-capable model, and returns a plain-text description the agent can reason over.
Features
- 2 tools:
analyze_imageandanalyze_video - 3 backends, automatic fallback: Gemini → Grok (xAI) → OpenRouter — first success wins, rest cancelled
- Zero config file: keys come from environment variables only
- Image preprocessing: auto-rotate (EXIF), downscale to ≤1024px, JPEG re-encode — small payloads, fast responses
- Video support: ffmpeg keyframe extraction (up to 8 frames) with timestamps
- Typed & tested: TypeScript, 21 unit/integration tests, MCP protocol verified over real stdio
- No Python: pure Node.js (sharp for images, ffmpeg binary for video)
Requirements
- Node.js ≥ 18
- ffmpeg (for video analysis only; images work without it)
- At least one of these API keys:
| Backend | Env var | Get it |
|---|---|---|
| Gemini (default) | GEMINI_API_KEY |
https://aistudio.google.com/app/apikey |
| Grok (xAI) | XAI_API_KEY |
https://console.x.ai |
| OpenRouter | OPENROUTER_API_KEY |
https://openrouter.ai/keys |
Install
npx from GitHub (recommended — no npm publish needed)
# Run directly (no install)
npx -y github:pongsakornp/vision-mcp
npx clones the repo, installs deps, auto-builds via the
preparescript, and runs the server over stdio.
From source
git clone https://github.com/pongsakornp/vision-mcp.git
cd vision-mcp
npm install
npm run build
Usage
MCP client config
OpenCode (opencode.jsonc):
{
"mcp": {
"vision-mcp": {
"type": "local",
"command": ["npx", "-y", "github:pongsakornp/vision-mcp"],
"environment": {
"GEMINI_API_KEY": "AIza...",
"XAI_API_KEY": "xai-...",
"OPENROUTER_API_KEY": "sk-or-..."
},
"enabled": true
}
}
}
Claude Desktop (claude_desktop_config.json):
{
"mcpServers": {
"vision-mcp": {
"command": "npx",
"args": ["-y", "github:pongsakornp/vision-mcp"],
"env": {
"GEMINI_API_KEY": "AIza..."
}
}
}
}
VS Code / Cursor (.vscode/mcp.json or workspace):
{
"servers": {
"vision-mcp": {
"type": "stdio",
"command": "npx",
"args": ["-y", "github:pongsakornp/vision-mcp"],
"environment": {
"GEMINI_API_KEY": "AIza..."
}
}
}
}
Keys live in the MCP config — no shell profile edits needed. Keep the config out of git if it contains keys.
CLI (for scripting / debugging)
# Spawn the server and talk JSON-RPC over stdio
GEMINI_API_KEY=AIza... node dist/index.js
Tools
analyze_image(path, prompt?)
Analyze an image file (png, jpg, jpeg, webp, bmp, gif, avif, tiff). Path can be absolute, relative, or ~/....
analyze_video(path, prompt?)
Analyze a video (mp4, webm, mov, avi, mkv, flv, wmv, m4v). Extracts up to 8 evenly-spaced keyframes with ffmpeg, then describes the sequence.
Configuration
| Env var | Default | Description |
|---|---|---|
GEMINI_API_KEY |
— | Gemini API key (tried first) |
XAI_API_KEY |
— | Grok/xAI API key (tried second) |
OPENROUTER_API_KEY |
— | OpenRouter key (tried last) |
VISION_GEMINI_MODEL |
gemini-flash-latest |
Gemini model override |
VISION_GROK_MODEL |
grok-4.5 |
Grok model override |
VISION_OPENROUTER_MODEL |
google/gemini-flash-latest |
OpenRouter model override |
VISION_TIMEOUT_MS |
20000 |
Per-backend request timeout |
Backend behavior
- Only backends with keys configured are launched.
- All configured backends run in parallel; the first success wins and the rest are cancelled.
- If all fail, the error reports every backend's failure for diagnosis.
Development
npm run build # compile TypeScript → dist/
npm test # run the 21 tests (vitest)
npm run typecheck # tsc --noEmit
Test coverage: config parsing, backend fallback logic, path resolution, image preprocessing (sharp), video keyframe extraction (real ffmpeg), and the full MCP stdio protocol.
License
MIT — see LICENSE.
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。