UI视觉MCP服务器
用于多模型视觉分析的MCP服务器。使Claude Code能够使用外部视觉AI模型(GLM、Gemini、GPT-4o等)分析图像。
安装
npm install
npm run build配置
在以下位置创建配置文件 ~/.config/ui-vision-mcp/config.json:
{
"models": [
{
"name": "glm",
"baseUrl": "https://open.bigmodel.cn/api/paas/v4",
"apiKey": "${GLM_API_KEY}",
"model": "glm-4.6v-flash"
},
{
"name": "gemini",
"baseUrl": "https://generativelanguage.googleapis.com/v1beta/openai",
"apiKey": "${GEMINI_API_KEY}",
"model": "gemini-2.5-flash"
}
]
}环境变量 ${VAR_NAME} 格式会自动展开。
自定义配置路径
集 VISION_CONFIG 环境变量使用不同的配置文件路径。
Claude代码设置
添加到 ~/.claude/settings.json:
{
"mcpServers": {
"ui-vision": {
"command": "npx",
"args": ["ui-vision-mcp"],
"env": {
"VISION_CONFIG": "/path/to/custom/config.json",
"GLM_API_KEY": "your-api-key"
}
}
}
}工具:analyze_image
使用配置的视觉模型并行分析图像。
参数:
| 名称 | 类型 | 描述 |
|---|---|---|
| images | string\[\] | 图像路径(本地文件、URL或base64数据) |
| prompt | string | 分析指令 |
例子:
{
"images": ["./design.png", "./screenshot.png"],
"prompt": "Compare these two images. The first is the design, the second is the implementation. List differences in layout, spacing, and colors."
}答复:
{
"results": [
{ "model": "glm-4.6v-flash", "result": "Analysis from GLM..." },
{ "model": "gemini-2.5-flash", "result": "Analysis from Gemini..." }
]
}支持的提供商
| 提供者 | 基本URL | 模型示例 |
|---|---|---|
| GLM | https://open.bigmodel.cn/api/paas/v4 | glm-4.6v-flash |
| 双子座 | https://generativelanguage.googleapis.com/v1beta/openai | gemini-2.5-flash |
| OpenAI | https://api.openai.com/v1 | gpt-4o |
| OpenRouter | https://openrouter.ai/api/v1 | 各种 |
可以使用任何与OpenAI兼容的API端点。
