glm-vision-mcp
This server provides eight vision tools via MCP, using the GLM vision model (glm-5v-turbo) to analyze images and videos for AI coding clients.
UI to Artifact: Convert UI screenshots into frontend code, AI prompts, design specs, or natural language descriptions.
Text Extraction (OCR): Extract text, code (with indentation), terminal output, and documents from screenshots.
Error Diagnosis: Analyze error messages, stack traces, and logs to identify root causes and suggest fixes.
Technical Diagram Understanding: Interpret architecture, flowcharts, UML, ER, and sequence diagrams with structured explanations.
Data Visualization Analysis: Extract trends, anomalies, and business insights from dashboards and charts.
UI Diff Check: Compare two UI screenshots to detect visual differences and implementation deviations.
General Image Analysis: Comprehensive understanding of any visual content not covered by specialized tools.
Video Analysis: Understand scenes, extract key moments, and identify objects/people/activities (supports MP4, MOV, M4V, etc., max 8MB).
Additional features: smart retry with exponential backoff, local LRU caching (optional disk persistence), and wide image/video format support (jpg, png, webp, gif, bmp, tiff, avi, mkv, webm, flv).
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@glm-vision-mcp Describe what's happening in this image."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
English · 中文
Features
Feature | Description |
8 tools, same names | Identical tool names and parameter schemas as |
Next-gen model by default | Uses glm-5v-turbo — improved accuracy and reasoning over the official glm-4.6v |
Smart retry | 429 / 5xx / network errors retried with exponential backoff; 4xx fails immediately — saves quota |
Local result cache | LRU memory cache + optional disk persistence; same image + prompt skips the API call |
|
|
Extended formats | Images: jpg, png, webp, gif, bmp, tiff. Video: mp4, mov, m4v, avi, mkv, webm, flv |
Related MCP server: glm-vision
Quick Start
# 1. Copy and edit .env
cp .env.example .env
# Set Z_AI_API_KEY=your_coding_plan_key
# 2. Add to your MCP client
claude mcp add glm-vision-mcp \
--env Z_AI_API_KEY=YOUR_KEY \
-- npx -y glm-vision-mcpUsage
The server exposes 8 vision tools through stdio. Your MCP client handles tool discovery and invocation automatically.
Claude Code
claude mcp add glm-vision-mcp \
--env Z_AI_API_KEY=YOUR_KEY \
-- npx -y glm-vision-mcpOpenCode
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"glm-vision-mcp": {
"type": "local",
"command": ["npx", "-y", "glm-vision-mcp"],
"environment": { "Z_AI_API_KEY": "YOUR_KEY", "Z_AI_MODE": "ZHIPU" }
}
}
}Cline / Roo Code
{
"mcpServers": {
"glm-vision-mcp": {
"command": "npx",
"args": ["-y", "glm-vision-mcp"],
"env": { "Z_AI_API_KEY": "YOUR_KEY", "Z_AI_MODE": "ZHIPU" }
}
}
}Architecture
flowchart LR
Client["MCP Client\n(Claude Code / OpenCode / Cline)"]
Server["glm-vision-mcp\n(stdio transport)"]
Cache["Result Cache\n(LRU + disk)"]
Vision["VisionService\n(unified handler)"]
Chat["ChatService\n(retry + backoff)"]
API["GLM Vision API\n(ZHIPU / ZAI)"]
Client --> Server
Server --> Cache
Cache -->|"miss"| Vision
Cache -->|"hit"| Server
Vision --> Chat
Chat --> API
API --> VisionConfiguration
Variable | Default | Description |
| Required | Zhipu API key (Coding Plan key or pay-as-you-go key) |
| — | Fallback alias (auto-mapped) |
|
| Endpoint mode — see Billing Modes |
|
| Vision model ID |
|
| Sampling temperature |
|
| Nucleus sampling |
|
| Max output tokens |
|
| Request timeout (ms) |
|
| Max retries (retryable errors only) |
|
| Enable result caching |
|
| Cache TTL in seconds (7 days) |
|
| Max LRU cache entries |
|
| Max image file size |
|
| Max video file size |
Billing Modes
Choose the endpoint via Z_AI_MODE:
| Endpoint | Billing |
|
| GLM Coding Plan subscription quota |
|
| Pay-as-you-go API billing |
|
| International z.ai platform |
Use the key that matches your billing plan: a Coding Plan key with ZHIPU, or a pay-as-you-go API key with ZHIPU_API.
Directory Structure
src/
├── core/ # Environment, chat, vision, file, cache services
│ ├── environment.ts # Dotenv + multi-endpoint + key fallback
│ ├── chat-service.ts # GLM API calls with smart retry
│ ├── vision-service.ts # Unified analysis orchestration
│ ├── file-service.ts # Validation, base64 encoding, fingerprinting
│ └── cache.ts # LRU + disk cache
├── tools/
│ ├── definitions.ts # 8-tool data-driven definitions
│ └── registry.ts # Tool registration on MCP server
├── prompts/ # 8 specialized system prompts
├── types/ # Error type hierarchy
└── utils/ # Logger, sanitization, validation
tests/
scripts/
└── smoke.ts # End-to-end verification with real keyTech Stack
Layer | Technology |
Runtime | Node.js ≥ 18 |
Language | TypeScript 5 |
Protocol |
|
Validation | Zod |
Config | dotenv |
Build | TypeScript compiler ( |
Dev | tsx (hot-reload), vitest (64 tests) |
Contributing
Fork → branch → commit → open a pull request. Run npm test before pushing.
License
Released under the MIT License.
Available Tools
8 toolsanalyze_data_visualizationA
阅读仪表盘、统计图表,提炼趋势、异常与业务要点。
仅在用户需要以下操作时使用:
从图表提取洞察
识别趋势与模式
检测异常值
提供业务影响分析
不要用于:技术架构图、UI 截图、错误诊断。
Inputs: prompt (required), image_source (required), analysis_focus.
analyze_imageA
通用图像理解能力,适配未被专项工具覆盖的视觉内容。
仅在用户需要以下操作时使用:
当专项工具(UI/OCR/错误/图表/数据可视化/视频)都不适用时
灵活理解任何视觉内容
全面的图像描述和分析
这是兜底工具,优先使用更专业的工具。
Inputs: prompt (required), image_source (required).
analyze_videoA
使用 AI 视觉模型分析视频内容。
仅在用户需要以下操作时使用:
理解视频中发生了什么
提取关键时刻或动作
分析视频内容、场景或序列
识别视频中的对象、人物或活动
支持本地文件与远程 URL,最大 8MB,支持 MP4/MOV/M4V 等格式。
Inputs: prompt (required), video_source (required).
diagnose_error_screenshotA
解析错误弹窗、堆栈跟踪和日志截图,给出定位与修复建议。
仅在用户需要以下操作时使用:
分析错误消息和堆栈跟踪
定位根本原因
提供可操作的修复方案
不要用于:提取代码、UI 分析、图表解读。
Inputs: prompt (required), image_source (required), context.
extract_text_from_screenshotA
使用 OCR 从截图中提取和识别文字。专门用于代码、终端输出、文档和通用文本提取。
仅在用户需要以下操作时使用:
从截图提取代码(保持正确缩进与格式)
提取终端输出和日志
提取文档和文本内容
不要用于:UI 转 code、错误诊断、图表分析。
Inputs: prompt (required), image_source (required), programming_language.
ui_diff_checkA
对比两张 UI 截图,识别视觉差异和实现偏差。专门用于 UI 质量保证和设计到实现的验证。
仅在用户需要以下操作时使用:
比较预期 UI 与实际实现
识别视觉差异
提供详细差异报告
按严重程度排列问题优先级
需要两张图:预期/参考图 与 实际/当前图。
Inputs: prompt (required), actual_image_source (required), expected_image_source (required).
ui_to_artifactA
将 UI 截图转换为代码、提示词、设计规范或自然语言描述。
仅在用户需要以下操作时使用:
从 UI 设计生成前端代码(output_type='code')
创建用于 UI 复刻的 AI 提示词(output_type='prompt')
提取设计规范文档(output_type='spec')
获取 UI 的自然语言描述(output_type='description')
不要用于:需提取的文字/代码、错误信息、技术图表、数据可视化。
Inputs: prompt (required), output_type (required), image_source (required).
understand_technical_diagramA
分析技术图表并生成结构化解读,覆盖架构图、流程图、UML、ER 图、序列图等。
仅在用户需要以下操作时使用:
分析架构图
理解流程图与 UML 图
解释 ER 图与序列图
识别设计模式
不要用于:UI 截图、错误消息、数据可视化图表。
Inputs: prompt (required), image_source (required), diagram_type.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 8 tools
Each tool targets a distinct visual input type (UI, text, error, diagram, data viz, diff, generic, video) with explicit 'do not use for' boundaries. The generic analyze_image is clearly positioned as a fallback, preventing overlap with specialized tools.
All names use snake_case, but verb-first pattern is inconsistent: ui_to_artifact and ui_diff_check are noun-first while others are verb-first. Still, the style is uniform and readable.
8 tools is well-scoped for a vision analysis server, covering major categories of visual understanding without unnecessary bloat.
The tool surface covers UI conversion, OCR, error diagnosis, diagrams, data visualization, diff checking, generic image analysis, and video analysis—a comprehensive set for the domain. The fallback analyze_image ensures no dead ends.
Maintenance
Related MCP Connectors
MCP server for GLM chat completions using Zhipu AI models via AceDataCloud
MCP server for Qwen Image 3 AI image generation
MCP server for OpenAI API (chat completions, image generation, embeddings) via AceDataCloud
MCP server for AI dialogue using various LLM models via AceDataCloud
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceAn MCP server that leverages Zhipu's free GLM-4.6V-Flash vision model to enable image, video, and file understanding (OCR, table parsing, defect detection, document Q&A, and more) across MCP-compatible clients like Codex and Claude Desktop.-
- FlicenseNot gradedqualityDmaintenanceMCP server that gives text-only models vision capabilities via free GLM vision models, supporting image description, OCR, chart/document analysis, and grounding with automatic model fallback.1-
- AlicenseAqualityAmaintenanceThis MCP server gives pure-text LLM agents vision capabilities by integrating the free GLM-4.6V-Flash visual model, enabling image, video, and file understanding through standard MCP tools.31MIT
- AlicenseAqualityDmaintenanceAn MCP server providing vision understanding tools (image QA, OCR, video and document understanding) via OpenAI-compatible endpoints, defaulting to Zhipu GLM vision models.4MIT