zhipu-glm-vision-mcp
基于智谱 GLM-4.6V-Flash(免费多模态视觉模型)的多模态理解 MCP 服务,支持图片、视频、文件三类理解能力,并支持思考模式(thinking)开关。
GLM-4.6V-Flash 上下文窗口 128K,在视觉理解精度上达到同参数规模 SOTA,原生支持多模态 Function Calling。本服务通过智谱 OpenAI 兼容接口接入,遵循 MCP v2 协议(mcp>=2.0.0 + MCPServer)。
使用
uvx zhipu-glm-vision-mcp
需要设置环境变量 ZHIPU_API_KEY(在 智谱开放平台 免费获取)。
可选环境变量:
| 变量 | 说明 | 默认 |
|---|---|---|
ZHIPU_API_KEY |
智谱 API Key(必需) | - |
GLM_MODEL |
模型名称 | glm-4.6v-flash |
GLM_THINKING |
思考模式默认,取值与工具 thinking 参数一致(disabled / enabled / enabled_with_reasoning;兼容布尔写法 true/false) |
disabled |
CLI 参数:--model <名称> 覆盖模型、--transport/-t stdio|streamable-http|sse(默认 stdio)、--thinking / --no-thinking / --reasoning 设置思考默认(分别对应 enabled / disabled / enabled_with_reasoning)。
工具
每个工具均接受列表参数(传 1 个即单条分析,传多个即在同一上下文内对比/关联分析),并支持 thinking 思考开关与 prompt 自定义提问。
图片理解
analyze_image(file_paths: list, prompt?, thinking?)- 分析 1..10 个本地图片路径(JPEG/PNG/GIF/WebP/BMP,每个 Base64 ≤50MB)analyze_image_url(urls: list, prompt?, thinking?)- 分析 1..10 个公网图片 URL
视频理解
analyze_video(file_paths: list, prompt?, thinking?)- 分析 1..10 个本地视频路径(MP4/MOV/AVI/WMV/MKV/WEBM/FLV,每个 Base64 ≤50MB)analyze_video_url(urls: list, prompt?, thinking?)- 分析 1..10 个公网视频 URL
文件/文档理解
analyze_file(file_paths: list, prompt?, thinking?)- 分析 1..N 个本地文件路径(PDF/TXT/MD/DOCX/PPTX/XLSX/HTML/JSON/CSV,每个 Base64 ≤50MB),支持多文档跨文档对比analyze_file_url(urls: list, prompt?, thinking?)- 分析 1..N 个公网文件 URL
可选参数
每个工具都接受以下可选参数:
| 参数 | 类型 | 说明 | 默认 |
|---|---|---|---|
prompt |
string | 自定义提问,覆盖默认提示词 | 按模态的默认中文提示词(描述/分析/总结) |
thinking |
string | 三态思考模式,见下 | 回落 GLM_THINKING 环境变量,再默认 disabled |
必选参数(二选一,按工具):
file_paths:本地文件路径列表,用于analyze_image/analyze_video/analyze_fileurls:公网 URL 列表,用于analyze_image_url/analyze_video_url/analyze_file_url
thinking 三态:
| 取值 | 行为 |
|---|---|
"disabled" |
关闭思考,只返回最终答案 |
"enabled" |
开启思考,不返回思考链 |
"enabled_with_reasoning" |
开启思考,并返回思考链(【思考过程】…\n【回答】…) |
优先级:单次调用 thinking 参数 > GLM_THINKING 环境变量(可用 CLI --reasoning/--thinking/--no-thinking 或启动前设置)> 默认 disabled。
开启思考后模型会先进行深度推理再作答,理解更细致但响应更慢;免费 flash 版默认关闭以换取更快响应。
示例:
analyze_image(file_paths=["a.png", "b.png"], prompt="这两张图有什么区别?", thinking="enabled_with_reasoning")
analyze_file_url(urls=["https://.../report.pdf"], thinking="enabled")
媒体限制
- 图片、视频、文件三者互斥:单次请求只能分析一种模态(GLM-4.6V 限制),因此拆分为独立工具。
- 同模态可多个:单个请求内图片/视频最多 10 个(
MAX_PARTS),文件同请求可传多个用于跨文档对比分析。 - Base64 本地传入上限 50MB(本地文件由本服务自动转 Base64 data URI)。
- 官方文档对视频/文件大小存在 5MB 与 200MB 两种表述,以 API 实际报错为准。
客户端注册
Claude Code:
claude mcp add zhipu-glm-vision-mcp \
-e ZHIPU_API_KEY=你的Key \
-- uvx zhipu-glm-vision-mcp
.mcp.json / claude_desktop_config.json:
{
"mcpServers": {
"zhipu-glm-vision-mcp": {
"command": "uvx",
"args": ["zhipu-glm-vision-mcp"],
"env": {
"ZHIPU_API_KEY": "你的Key"
}
}
}
}
发布新版本
- 修改
pyproject.toml中的version(必须严格递增) uv build,生成dist/*.whl与dist/*.tar.gztwine upload dist/*,按提示粘贴 PyPI API Token(用户名填__token__)- 验证:
uvx zhipu-glm-vision-mcp --help
相关文档
docs/ 目录存放了 GLM-4.6V-Flash 相关文档:
- GLM-4.6V-Flash API 参考快照 - 精简 API 契约(端点 / 请求格式 / 已知限制)
- GLM-4.6V-Flash 原始官方文档 - 官方完整能力文档原样存档
License
MIT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file zhipu_glm_vision_mcp-0.1.2.tar.gz.
File metadata
- Download URL: zhipu_glm_vision_mcp-0.1.2.tar.gz
- Upload date:
- Size: 19.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
12a5117cb68d7a261768346cfdea2acbd091f92c15568b63767aae555ea3e7e9
|
|
| MD5 |
a6dc51297df88f809f34cb4704fd92ec
|
|
| BLAKE2b-256 |
5810521f8c8687557e0621ec9543fe0f0e6ffd9dfe4ff8393351c03eccda7c46
|
File details
Details for the file zhipu_glm_vision_mcp-0.1.2-py3-none-any.whl.
File metadata
- Download URL: zhipu_glm_vision_mcp-0.1.2-py3-none-any.whl
- Upload date:
- Size: 9.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe3322ad3052d8a714c6c04ee97a535d83aa7a1c58922b237259e78a37a5f68a
|
|
| MD5 |
55259100500700dc828570b1a468f9cb
|
|
| BLAKE2b-256 |
459bdafc0d6322d730b1b9391f81cf8560356b728e6237ec98cf4ee0608b23ed
|