Skip to main content
Glama

glm-vision-mcp-server

基于智谱免费视觉模型 glm-4.6v-flash 的 MCP 服务器:理解本地图片或网络图片,返回中文描述或回答问题。

配套 Skill:~/.claude/skills/glm-vision/SKILL.md(贴图自动触发)。

效果展示

测试 1:GitHub 项目页面识别(左:输入图 → 右:GLM 识别结果)

输入

识别结果

测试 2:音乐播放器界面识别(左:输入图 → 右:GLM 识别结果)

输入

识别结果

Related MCP server: MCP Image Recognition Server

快速开始

仓库内已含 Skill 副本(.claude/skills/glm-vision/SKILL.md),修改后需同步复制到用户目录才生效。

# 1. 安装依赖(将下方路径替换为你实际的安装目录)
cd C:/Users/ASUS/.claude/mcp-servers/glm-vision-mcp-server
uv sync

# 2. 全局注册 MCP(stdio,--scope user 使其在任何项目可用)
claude mcp add vision --scope user --env ZHIPUAI_API_KEY=<你的key> -- uv run --directory C:/Users/ASUS/.claude/mcp-servers/glm-vision-mcp-server glm-vision-mcp

# 3. 安装 Skill(贴图自动触发,任何项目可用;已装过可跳过)
mkdir -p ~/.claude/skills/glm-vision
cp .claude/skills/glm-vision/SKILL.md ~/.claude/skills/glm-vision/SKILL.md

# 4. 重启 Claude Code 会话使 MCP 与 Skill 生效

API key 获取:https://open.bigmodel.cn/ (注册后「API Keys」页面创建,模型 glm-4.6v-flash 免费)。

工具

工具

参数

说明

understand_image

images(必填,1 张或多张,本地路径或 http(s) URL)、question(可选)

理解图片;单图自动描述、多图对比分析;传入问题则回答

隐私声明

⚠️ 调用本工具时,图片内容(本地图片 base64 编码或 URL)会发送至智谱 AI 的 API(open.bigmodel.cn,国内服务器)用于视觉理解。请勿向本工具传入包含敏感信息的截图(账号密码、身份证、聊天记录等)。如需自托管,请自行更换模型服务商(见「更换底层视觉模型」)。

开发

uv run pytest -v          # 单元测试(mock 网络)

配置

  • ZHIPUAI_API_KEY:智谱 API key(环境变量,勿硬编码)

  • GLM_VISION_MODEL:底层视觉模型 ID(可选,默认 glm-4.6v-flash

  • 图片限制:本地文件最大 10MB

更换底层视觉模型

原因:本服务器通过智谱的 OpenAI 兼容接口调用模型——鉴权方式、请求格式(content 数组、image_url/base64 传输)、响应结构对所有 glm 系列模型完全一致,底层模型只由请求中的 model 字段决定。因此更换模型 ID 即可无痛切换视觉模型,代码、Skill、MCP 注册均无需改动。

用法(设置环境变量 GLM_VISION_MODEL 即可):

# 免费版(默认值,不设置时生效)
export GLM_VISION_MODEL=glm-4.6v-flash

# 付费版 glm-4.6v(访问更稳定、限流更少,适合生产使用)
export GLM_VISION_MODEL=glm-4.6v

已在 claude mcp add 注册过的场景,重新注册并把模型带入 MCP 环境变量:

claude mcp add vision --scope user \
  --env ZHIPUAI_API_KEY=<你的key> \
  --env GLM_VISION_MODEL=glm-4.6v \
  -- uv run --directory C:/Users/ASUS/.claude/mcp-servers/glm-vision-mcp-server glm-vision-mcp

或直接改代码中 glm_client.pyDEFAULT_MODEL 常量(改后需重装/重启生效)。

常见问题

IMPORTANT

免费模型会间歇性限流(HTTP 429):提示"该模型当前访问量过大,请您稍后再试"是智谱免费模型(glm-4.6v-flash)的时段性共享配额限制,不是代码或配置问题。处理方式:

  1. 稍后重试:等待 15 秒以上再次调用(限流是时段性的,低谷时段即恢复,通常重试 1-2 次即可)

  2. 切换付费模型:设置 GLM_VISION_MODEL=glm-4.6v 绕过免费配额,访问更稳定(见「更换底层视觉模型」)

NOTE

修改工具代码后需退出并重新启动 Claude Code 才会生效:MCP 服务器进程在会话启动时加载,会话期间运行的始终是启动时的代码版本。改动 glm_client.py / server.py / Skill 后,需退出当前 Claude Code 会话并重新启动,工具才会运行新代码;claude mcp list 可查看服务器连接状态。

Available Tools

1 tool
understand_imageA

使用智谱免费视觉模型 glm-4.6v-flash 理解一张或多张图片(本地文件路径或 http(s) 图片 URL)。单图自动详细描述;多图分别描述并指出异同。可附带具体问题 question(中文回答)。

ParametersJSON Schema
NameRequiredDescriptionDefault
imagesYes
questionNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.1/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the burden of disclosing behavior. It reveals the underlying model (glm-4.6v-flash), input types (local path or URL), single-image vs. multi-image distinct behaviors, and language of answers (Chinese). This goes beyond basic operation and provides useful context, though it doesn't mention failure modes or side effects.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, well-structured sentence that uses semicolons to separate key behaviors. It front-loads the main purpose, includes necessary details (model, input types, single/multi behavior, question) without any fluff or repetition. Every clause adds useful information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description is sufficiently complete for an image understanding tool with only two parameters. It covers input formats, single vs. multiple handling, and optional question support. Since an output schema exists, return values are structured elsewhere. It lacks details on known limitations or edge cases, but overall provides a solid contextual picture.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It explains that 'images' can be local file paths or HTTP(s) URLs, and 'question' is an optional specific question to be answered in Chinese, which adds meaning beyond the raw schema. It also clarifies the behavior of images (single vs. multiple) that relates to parameter usage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool uses a vision model to understand one or more images, with specific behavior for single vs. multiple images. It names the resource (images) and the action (understand/describe). No sibling tools exist, so no differentiation is needed, but the verb 'understand' is slightly generic, though detailed description is mentioned.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context on when to use the tool: for understanding images via local paths or URLs, and optionally asking a specific question. It doesn't explicitly state exclusions or alternatives, but since no sibling tools are listed, this is acceptable. The behavior for single vs. multiple images is also a form of usage guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 1 tool updatev0.1.0
    • First observedunderstand_image

TDQS

A4.2/5.0

Scored across 1 tool

Disambiguation5/5

With only one tool, there is no possibility of tool confusion. The tool's purpose is clearly defined for image understanding.

Naming Consistency5/5

The single tool name follows a clear verb_noun pattern, indicating predictability, though with only one tool the pattern is not fully established.

Tool Count3/5

The server has exactly one tool, which feels thin even for a narrow vision domain. The tool itself is comprehensive, but the overall surface is minimal. This is borderline, so score 3.

Completeness5/5

The tool covers image description, multi-image comparison, and Q&A, which are the core capabilities expected of an image understanding server. No obvious gaps within its intended scope.

Maintenance

ActivitySlowing
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    B
    quality
    D
    maintenance
    Enables image analysis using GLM-4.5V's vision capabilities from Z.AI. Supports analyzing both local image files and URLs with customizable prompts and parameters.
    1
    7
    MIT