vision-mcp
Enables AI-powered vision analysis using local Ollama models. Supports screenshot analysis, OCR, text detection, and health monitoring via MCP protocol.
README
Vision MCP Server 🔍
A powerful Model Context Protocol (MCP) server that provides AI-powered vision analysis capabilities using local Ollama models. Analyze screenshots, extract text, detect UI elements, and debug applications with state-of-the-art vision language models.
🚀 Features
- 🔍 Vision Analysis - Analyze screenshots and describe UI state, errors, or issues
- 📝 OCR Extraction - Extract text from images using VLM or Tesseract
- 🎯 Text Detection - Find specific text with bounding boxes for automation
- 🏥 Health Monitoring - Check Ollama connection and available models
- 🔌 Universal Integration - Works with Electron, Selenium, Playwright, and more
- 🏃♂️ CLI Tool - Standalone command-line interface for any workflow
- ⚡ High Performance - Optimized for 16GB+ VRAM with local models
📦 Installation
Prerequisites
- Node.js 18+
- Ollama (for vision models)
- Claude Code (for MCP integration)
- 16GB+ VRAM recommended for optimal performance
Quick Setup
# 1. Clone the repository
git clone https://github.com/YOUR_USERNAME/vision-mcp.git
cd vision-mcp
# 2. Install dependencies
npm install
# 3. Install Ollama and models
curl -fsSL https://ollama.com/install.sh | sh
ollama serve &
ollama pull llava:7b
# 4. Run setup script
chmod +x setup.sh
./setup.sh
# 5. Test installation
./vlm.mjs health
Claude Code Integration
Add to your ~/.claude.json in the mcpServers section:
{
"mcpServers": {
"vision": {
"type": "stdio",
"command": "/home/ice/vision-mcp-wrapper.sh",
"args": [],
"env": {}
}
}
}
🎯 Quick Start
CLI Usage
# Health check
vlm health
# Analyze screenshot
vlm describe --image screenshot.png --prompt "What errors are visible?"
# Extract text (OCR)
vlm ocr --image document.png --engine tesseract
# Find UI elements
vlm find --image app.png --query "Submit button"
MCP Usage in Claude
Use vision.describe to analyze this screenshot for errors
Use vision.find_text to locate the "Login" button
Use vision.ocr to extract all visible text
Use vision.health to check model status
🛠️ Available Tools
vision.describe
Analyze images and describe UI state, errors, or issues.
Parameters:
image_b64(string): Base64-encoded imageprompt(string, optional): Custom analysis promptmodel(string, optional): Ollama model to usemax_tokens(number, optional): Maximum response tokens
Example:
{
"image_b64": "iVBORw0KGgoAAAANSUhEU...",
"prompt": "Identify any error messages or broken UI elements",
"model": "llava:7b"
}
vision.ocr
Extract text from images using VLM or Tesseract.
Parameters:
image_b64(string): Base64-encoded imageengine(string, optional): "vlm" or "tesseract"model(string, optional): Model for VLM OCRstructured(boolean, optional): Return structured JSON
vision.find_text
Locate specific text and return bounding boxes.
Parameters:
image_b64(string): Base64-encoded imagequery(string): Text to search formodel(string, optional): Ollama model to usefuzzy(boolean, optional): Allow fuzzy matching
vision.health
Check Ollama connection and available models.
🔗 Integration Examples
Electron CDP Integration
// Add to your Electron MCP server
server.registerTool(
"browser_vision_check",
{
title: "Analyze page with AI vision",
inputSchema: z.object({
prompt: z.string().default("Check for errors"),
fullPage: z.boolean().default(false)
})
},
async ({ prompt, fullPage }) => {
const page = await pickPage();
const screenshot = await page.screenshot({
type: "png",
encoding: "base64",
fullPage
});
// Call Vision MCP via Claude
return {
content: [{
type: "text",
text: JSON.stringify({
next_tool: "vision.describe",
args: { image_b64: screenshot, prompt }
})
}]
};
}
);
Selenium Integration
// Shell out to vlm CLI from Selenium MCP
async function analyzeSeleniumPage(driver, prompt) {
const screenshot = await driver.takeScreenshot();
const tmpPath = `/tmp/selenium-${Date.now()}.png`;
await fs.writeFile(tmpPath, Buffer.from(screenshot, "base64"));
const { execFile } = require("child_process");
return new Promise((resolve, reject) => {
execFile("/home/ice/vision-mcp/vlm.mjs",
["describe", "--image", tmpPath, "--prompt", prompt],
(error, stdout) => {
fs.unlink(tmpPath); // Cleanup
if (error) reject(error);
else resolve(JSON.parse(stdout));
}
);
});
}
Playwright in Docker
# docker-compose.yml
services:
playwright:
image: mcr.microsoft.com/playwright:v1.54.2-noble
extra_hosts:
- "host.docker.internal:host-gateway"
environment:
- OLLAMA_HOST=host.docker.internal
// Direct Ollama call from container
async function analyzeWithVision(page, prompt) {
const screenshot = await page.screenshot({ encoding: "base64" });
const response = await fetch("http://host.docker.internal:11434/api/generate", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
model: "llava:7b",
prompt: `Analyze this UI screenshot: ${prompt}`,
images: [screenshot],
stream: false
})
});
const data = await response.json();
return data.response;
}
🤖 Supported Models
Recommended Models by Use Case
| Use Case | Model | Size | Strengths |
|---|---|---|---|
| General UI Analysis | llava:7b ✅ |
4.1GB | Reliable, fast, good reasoning |
| OCR & Text Extraction | minicpm-v:8b-2.6 |
~8GB | State-of-the-art OCR accuracy |
| Document Analysis | qwen2.5vl:7b |
~8GB | Excellent for complex layouts |
| Lightweight | llava:7b |
4.1GB | Best speed/accuracy balance |
Model Installation
# Current default (installed)
ollama pull llava:7b
# Better OCR model
ollama pull minicpm-v:8b-2.6
# Best document analysis (when available)
ollama pull qwen2.5vl:7b
⚙️ Configuration
Environment Variables
| Variable | Default | Description |
|---|---|---|
OLLAMA_HOST |
127.0.0.1 |
Ollama server host |
OLLAMA_PORT |
11434 |
Ollama server port |
VISION_MODEL |
llava:7b |
Default vision model |
OCR_MODEL |
llava:7b |
Default OCR model |
MAX_TOKENS |
1024 |
Maximum response tokens |
Model Switching
# Use different model temporarily
VISION_MODEL=minicpm-v:8b-2.6 vlm describe --image screenshot.png
# Or specify in tool call
vlm describe --image screenshot.png --model minicpm-v:8b-2.6
🔧 Development
Project Structure
vision-mcp/
├── vision-mcp.mjs # Main MCP server
├── vlm.mjs # CLI tool
├── package.json # Dependencies
├── setup.sh # Installation script
├── vision-mcp-wrapper.sh # MCP wrapper
├── integration-examples.md # Integration guides
└── docs/ # Additional documentation
Running Development Server
# Start Ollama
ollama serve &
# Test MCP server
node vision-mcp.mjs
# Test CLI tool
./vlm.mjs health
Adding New Models
- Pull model:
ollama pull model-name - Update defaults in
vision-mcp.mjsandvlm.mjs - Test with:
vlm describe --model model-name --image test.png
🐛 Troubleshooting
Common Issues
🔴 "Ollama not responding"
ollama serve &
curl http://localhost:11434/api/tags
🔴 "Model not found"
ollama list
ollama pull llava:7b
🔴 "Tesseract not found"
# Fedora/RHEL
sudo dnf install tesseract tesseract-langpack-eng
# Ubuntu/Debian
sudo apt install tesseract-ocr
🔴 "Permission denied"
chmod +x vision-mcp.mjs vlm.mjs vision-mcp-wrapper.sh
Debug Mode
# Enable debug output
DEBUG=1 ./vlm.mjs describe --image test.png
# Check MCP server logs
journalctl --user -f | grep vision-mcp
Performance Optimization
# Keep models warm (optional)
curl http://localhost:11434/api/generate \
-d '{"model":"llava:7b","prompt":"warmup","keep_alive":"10m"}'
# Monitor GPU usage
nvidia-smi -l 1
📊 Benchmarks
Performance on 16GB VRAM
| Model | Memory Usage | Speed | Accuracy | Best For |
|---|---|---|---|---|
llava:7b |
~4GB | ⚡⚡⚡ Fast | ⭐⭐⭐ Good | General use, UI analysis |
minicpm-v:8b-2.6 |
~8GB | ⚡⚡ Medium | ⭐⭐⭐⭐ Excellent | OCR, text extraction |
qwen2.5vl:7b |
~8GB | ⚡⚡ Medium | ⭐⭐⭐⭐ Excellent | Document analysis |
🤝 Contributing
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Commit changes:
git commit -am 'Add feature' - Push to branch:
git push origin feature-name - Submit a Pull Request
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
- Ollama - Local model runtime
- LLaVA - Vision language model
- MCP SDK - Protocol implementation
- Claude Code - Development environment
🔗 Related Projects
- Electron CDP MCP - Electron automation
- Selenium MCP - Browser testing
- Playwright MCP - Web automation
Made with ❤️ for the Claude Code ecosystem
🌟 Star this repo if you find it helpful! 🐛 Report issues on GitHub 💬 Join discussions in the community
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。