Skip to main content
Glama

glm-vision MCP Server

Gives any AI Agent the ability to "see" images. Under the hood, it calls 智谱's completely free vision reasoning models, exposes them as standard tools via the MCP protocol, and any MCP-compatible client can use them directly — zero API cost.

💡 Free Guarantee: All free models from the 智谱 benefits zone are used (GLM-4.6V-Flash / GLM-4.1V-Thinking-Flash / GLM-4V-Flash), no paid models are included, and long-term use will not incur any charges.

Exposed Tools

analyze_image(image_input, question, thinking)

Parameter

Type

Default

Description

image_input

string

Required

The http/https URL of the image or an absolute local file path

question

string

请详细描述这张图片

The question to ask the model

thinking

bool

false

Enables thinking mode, more accurate for complex charts/GUI/reasoning scenarios

Returns: The text analysis result output by the model.

Features

  • Local images are automatically read and transmitted as raw base64, no image hosting or public URL required

  • Single-image 5MB size limit validation (智谱 restriction)

  • Automatic backoff retry 3 times on 429 rate limiting (1.5s / 3s / 4.5s)

  • If still failing, automatically degrades: glm-4.6v-flashglm-4.1v-thinking-flashglm-4v-flash (all free), and when degraded, the model used is indicated at the beginning of the answer


Related MCP server: Kimi Vision MCP Server

Three-Step Deployment

1. Install Dependencies

pip install -r requirements.txt

⚠️ Key pitfall: mcp must be 1.x. The latest mcp 2.0.0 removed the built-in mcp.server.fastmcp module, which will cause an ImportError if installed. So use pip install "mcp<2".

⚠️ Another pitfall: Do not install zai or zhipuai — on PyPI both names are unrelated placeholder packages (zai belongs to Zalando, and zhipuai's import name has changed). This server uses an OpenAI-compatible client to connect directly to the 智谱 API (base_url=https://open.bigmodel.cn/api/paas/v4); you only need the openai package.

2. Configure API Key

Register at bigmodel.cn with your phone number → create a new one under "API Keys" in the console. Free.

There are two ways to provide the Key, environment variables take higher priority:

  • Method A (recommended): Set the environment variable ZHIPU_API_KEY=你的key

  • Method B: Rename zhipu_key.txt.example to zhipu_key.txt and fill in the Key (the script will automatically read this file in the same directory).

3. Configure in the Client

Add a block to your client's MCP configuration file (change the path to your own):

{
  "mcpServers": {
    "glm-vision": {
      "command": "python",
      "args": ["/绝对路径/到/glm_vision_mcp.py"],
      "env": {
        "ZHIPU_API_KEY": "你的key"
      }
    }
  }
}

Configuration file locations for each client:

Client

Configuration file path

WorkBuddy

~/.workbuddy/mcp.json

Claude Desktop (Win)

%APPDATA%\Claude\claude_desktop_config.json

Claude Desktop (Mac)

~/Library/Application Support/Claude/claude_desktop_config.json

Cursor

in project .cursor/mcp.json or global ~/.cursor/mcp.json

Cline / Roo (VSCode)

cline_mcp_settings.json in plugin settings

Continue

the mcpServers section of ~/.continue/config.json

For command, it is recommended to use the absolute path of the Python interpreter (e.g. D:/python/python.exe), to avoid the client not finding python in PATH at startup.

You must restart the client after configuring — the MCP process is spawned only once when the client starts; changing configuration or code will not hot-reload.


Verify It Works

After restarting the client, just have the Agent analyze an image:

Take a look at D:\test.png and tell me what is in this image.

If the Agent says it cannot find the tool, check: whether the configuration file's JSON syntax is valid, whether the script's absolute path is correct, whether the client was restarted, and whether the client requires manually "trusting/enabling" this server (WorkBuddy and Cursor both have this step).

Common Errors Reference

Symptom

Cause

429 / 1305

Free model rate limit, not an invalid Key. The server has automatically retried and degraded.

401

The Key is genuinely invalid or was not read.

ModuleNotFoundError: mcp.server.fastmcp

mcp 2.x was installed; reinstall with pip install "mcp<2".

未配置智谱 API Key

Neither the environment variable nor zhipu_key.txt exists.

图片过大

Single image exceeds 5MB; compress it first.

File List

File

Required

Description

glm_vision_mcp.py

The server itself, the only core file.

requirements.txt

Recommended

Dependency list

zhipu_key.txt

Optional

Only needed when not using environment variables; content is a single line Key.

README.md

Optional

This document

A
license - permissive license
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables analysis of local images through Kimi (Moonshot AI) vision models via the MCP protocol, supporting features like OCR and long context understanding.
    65
    MIT
  • A
    license
    A
    quality
    C
    maintenance
    Provides image recognition capabilities to MCP clients by integrating with OpenAI-compatible vision models, supporting local images, URLs, multi-image comparison, and model listing.
    4
    MIT

View all related MCP servers

Related MCP Connectors

  • MCP server for GLM chat completions using Zhipu AI models via AceDataCloud

  • OCR, transcription, file extraction, and image generation for AI agents via MCP.

  • Generate images and video on Google Flow (Veo, Nano Banana) from any MCP client

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Chu-Nian/glm-vision-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server