G

Glm MCP

by djerok · io.github.djerok/glm-mcp

Enables Claude Code to use GLM (Zhipu) as a cheap, full-capability subagent for file editing, code generation, and bash commands, with automatic routing between Opus and GLM based on task complexity.

npm Local · stdio GlamaOfficial MCP Registry High confidence

Install

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

Windows / Linux path
Windows: %APPDATA%\Claude\claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "io-github-djerok-glm-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "glm-mcp"
      ],
      "env": {
        "GLM_API_KEY": "<YOUR_VALUE>",
        "GLM_CAP": "off",
        "GLM_BASE_URL": "https://api.z.ai/api/anthropic",
        "GLM_COST_BIAS": "1.5",
        "GLM_MAX_TOKENS": "32768",
        "GLM_PEAK_MODEL": "glm-5.2",
        "GLM_PEAK_END_CN": "18",
        "GLM_OFFPEAK_MODEL": "glm-5.2",
        "GLM_PEAK_START_CN": "14",
        "GLM_MAX_CONCURRENT": "1",
        "GLM_AGENT_MAX_ITERS": "30",
        "GLM_MAX_TOKENS_CEILING": "131072"
      }
    }
  }
}

Restart Claude Desktop to activate the new server.

Add to .cursor/mcp.json (project) or ~/.cursor/mcp.json (global)

Windows / Linux path
Windows: .cursor\mcp.json (project) or %USERPROFILE%\.cursor\mcp.json (global)
Linux: .cursor/mcp.json (project) or ~/.cursor/mcp.json (global)
{
  "mcpServers": {
    "io-github-djerok-glm-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "glm-mcp"
      ],
      "env": {
        "GLM_API_KEY": "<YOUR_VALUE>",
        "GLM_CAP": "off",
        "GLM_BASE_URL": "https://api.z.ai/api/anthropic",
        "GLM_COST_BIAS": "1.5",
        "GLM_MAX_TOKENS": "32768",
        "GLM_PEAK_MODEL": "glm-5.2",
        "GLM_PEAK_END_CN": "18",
        "GLM_OFFPEAK_MODEL": "glm-5.2",
        "GLM_PEAK_START_CN": "14",
        "GLM_MAX_CONCURRENT": "1",
        "GLM_AGENT_MAX_ITERS": "30",
        "GLM_MAX_TOKENS_CEILING": "131072"
      }
    }
  }
}

Cursor usually picks up config changes automatically; if the server does not appear, reload the window.

Add to .mcp.json (project) or ~/.claude.json (global)

Windows / Linux path
Windows: .mcp.json (project) or %USERPROFILE%\.claude.json (global)
Linux: .mcp.json (project) or ~/.claude.json (global)
{
  "mcpServers": {
    "io-github-djerok-glm-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "glm-mcp"
      ],
      "env": {
        "GLM_API_KEY": "<YOUR_VALUE>",
        "GLM_CAP": "off",
        "GLM_BASE_URL": "https://api.z.ai/api/anthropic",
        "GLM_COST_BIAS": "1.5",
        "GLM_MAX_TOKENS": "32768",
        "GLM_PEAK_MODEL": "glm-5.2",
        "GLM_PEAK_END_CN": "18",
        "GLM_OFFPEAK_MODEL": "glm-5.2",
        "GLM_PEAK_START_CN": "14",
        "GLM_MAX_CONCURRENT": "1",
        "GLM_AGENT_MAX_ITERS": "30",
        "GLM_MAX_TOKENS_CEILING": "131072"
      }
    }
  }
}

The server will be available in the next Claude Code session.

Add to .vscode/mcp.json

Windows / Linux path
Windows: .vscode\mcp.json
Linux: .vscode/mcp.json
{
  "servers": {
    "io-github-djerok-glm-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "glm-mcp"
      ],
      "env": {
        "GLM_API_KEY": "<YOUR_VALUE>",
        "GLM_CAP": "off",
        "GLM_BASE_URL": "https://api.z.ai/api/anthropic",
        "GLM_COST_BIAS": "1.5",
        "GLM_MAX_TOKENS": "32768",
        "GLM_PEAK_MODEL": "glm-5.2",
        "GLM_PEAK_END_CN": "18",
        "GLM_OFFPEAK_MODEL": "glm-5.2",
        "GLM_PEAK_START_CN": "14",
        "GLM_MAX_CONCURRENT": "1",
        "GLM_AGENT_MAX_ITERS": "30",
        "GLM_MAX_TOKENS_CEILING": "131072"
      }
    }
  }
}

Reload the VS Code window to activate.

Add to ~/.codeium/windsurf/mcp_config.json

Windows / Linux path
Windows: %USERPROFILE%\.codeium\windsurf\mcp_config.json
Linux: ~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "io-github-djerok-glm-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "glm-mcp"
      ],
      "env": {
        "GLM_API_KEY": "<YOUR_VALUE>",
        "GLM_CAP": "off",
        "GLM_BASE_URL": "https://api.z.ai/api/anthropic",
        "GLM_COST_BIAS": "1.5",
        "GLM_MAX_TOKENS": "32768",
        "GLM_PEAK_MODEL": "glm-5.2",
        "GLM_PEAK_END_CN": "18",
        "GLM_OFFPEAK_MODEL": "glm-5.2",
        "GLM_PEAK_START_CN": "14",
        "GLM_MAX_CONCURRENT": "1",
        "GLM_AGENT_MAX_ITERS": "30",
        "GLM_MAX_TOKENS_CEILING": "131072"
      }
    }
  }
}

Restart Windsurf (or refresh its MCP servers panel) to activate the new server.

Windsurf Next uses ~/.codeium/windsurf-next/mcp_config.json. Devin Desktop (the Windsurf rebrand) uses ~/.config/devin/mcp_config.json and imports the Windsurf file.

Add to ~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json

Windows / Linux path
Windows: %APPDATA%\Code\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.json
Linux: ~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
{
  "mcpServers": {
    "io-github-djerok-glm-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "glm-mcp"
      ],
      "env": {
        "GLM_API_KEY": "<YOUR_VALUE>",
        "GLM_CAP": "off",
        "GLM_BASE_URL": "https://api.z.ai/api/anthropic",
        "GLM_COST_BIAS": "1.5",
        "GLM_MAX_TOKENS": "32768",
        "GLM_PEAK_MODEL": "glm-5.2",
        "GLM_PEAK_END_CN": "18",
        "GLM_OFFPEAK_MODEL": "glm-5.2",
        "GLM_PEAK_START_CN": "14",
        "GLM_MAX_CONCURRENT": "1",
        "GLM_AGENT_MAX_ITERS": "30",
        "GLM_MAX_TOKENS_CEILING": "131072"
      }
    }
  }
}

Cline reloads cline_mcp_settings.json automatically; if the server does not appear, reload the VS Code window.

Open it from Cline's MCP Servers panel → Configure. Roo Code uses a different file and format.

Configuration

Environment variables this server reads. Secrets stay on your machine.

NameRequiredDescription
GLM_API_KEY secret Yes Your Z.ai API key with GLM Coding Plan access. Required.
GLM_CAP No Output-token cap. Off by default = generous (up to 131072 per call). Set on to enforce GLM_MAX_TOKENS. Default: off Default: off
GLM_BASE_URL No Anthropic-compatible endpoint. Default: https://api.z.ai/api/anthropic Default: https://api.z.ai/api/anthropic
GLM_COST_BIAS No How hard to favor GLM (it's ~10x cheaper). Higher = more GLM; 0 = decide on capability only. Default: 1.5 Default: 1.5
GLM_MAX_TOKENS No The hard per-call limit applied only when GLM_CAP=on. Default: 32768 Default: 32768
GLM_PEAK_MODEL No Model used during China peak. Default: glm-5.2 Default: glm-5.2
GLM_PEAK_END_CN No Peak window end (China hour, UTC+8). Default: 18 Default: 18
GLM_OFFPEAK_MODEL No Model used off-peak. Default: glm-5.2 Default: glm-5.2
GLM_PEAK_START_CN No Peak window start (China hour, UTC+8). Default: 14 Default: 14
GLM_MAX_CONCURRENT No GLM caps in-flight requests; keep at 1. Default: 1 Default: 1
GLM_AGENT_MAX_ITERS No Max tool-loop turns for glm_agent. Default: 30 Default: 30
GLM_MAX_TOKENS_CEILING No The generous default used when the cap is off. Default: 131072 Default: 131072

Similar servers