An MCP server that delegates coding and text tasks to Z.ai GLM models through an Anthropic-compatible /v1/messages endpoint. It provides tools for repo-based agent work, pure text generation, model recommendations, and usage/status reporting, with ledgered GLM token usage.
From the registry: GLM (Zhipu/Z.ai) as a ~10x cheaper file-editing subagent for AI coding agents.
Please install the `glm-mcp` MCP server into my current AI client (that's you).
Required prerequisites (do these first if not already done):
- **Install Node.js and npm** — Node.js is required to run the MCP server via npx.
- **Obtain a Z.ai / Zhipu GLM API key** — Required for actual GLM calls. The server can start and answer MCP introspection without a key, but tool calls to GLM require GLM_API_KEY.
Canonical MCP server config (stdio transport):
- command: `npx`
- args: ["-y","glm-mcp"]
- required environment variables:
- `GLM_API_KEY`: Your Z.ai / Zhipu GLM Coding Plan API key. Required for actual GLM tool calls in normal use. (example: `<your-zai-key>`)
- optional environment variables:
- `GLM_BASE_URL`: Anthropic-compatible base endpoint for GLM. (example: `<your-anthropic-compatible-base-url>`)
- `GLM_USE_HAIKU`: Set to on to allow the Haiku-orchestrated subagent; off keeps all tokens on GLM. (example: `<on-or-off>`)
- `GLM_COST_BIAS`: How strongly to favor GLM over the main model. (example: `<cost-bias>`)
- `GLM_MAX_CONCURRENT`: Maximum number of concurrent in-flight GLM requests. (example: `<max-concurrent>`)
- `GLM_CAP`: Whether to enforce GLM_MAX_TOKENS as a hard cap. (example: `<on-or-off>`)
- `GLM_MAX_TOKENS`: Hard per-call token limit when GLM_CAP is on. (example: `<max-tokens>`)
- `GLM_MAX_TOKENS_CEILING`: Generous per-call token ceiling used when GLM_CAP is off. (example: `<max-tokens-ceiling>`)
- `GLM_MAX_RETRIES`: Maximum retry attempts for 429, concurrency, and 5xx errors. (example: `<max-retries>`)
- `GLM_TIMEOUT_MS`: Per-HTTP-request timeout for GLM calls, in milliseconds. (example: `<timeout-ms>`)
- `GLM_AGENT_MAX_ITERS`: Maximum tool-loop turns for glm_agent. (example: `<max-iters>`)
- `GLM_AGENT_BASH_TIMEOUT_MS`: Per-run_bash command timeout inside glm_agent, in milliseconds. (example: `<bash-timeout-ms>`)
- `GLM_OFFPEAK_MODEL`: Candidate model or comma-separated model list for auto routing during off-peak hours. (example: `<offpeak-model-or-comma-list>`)
- `GLM_PEAK_MODEL`: Candidate model or comma-separated model list for auto routing during peak hours. (example: `<peak-model-or-comma-list>`)
- `GLM_CHEAP_MODEL`: Cheap model used in the full-GLM launcher's Haiku slot. (example: `<cheap-model>`)
- `GLM_PEAK_START_CN`: Peak window start hour in China time (UTC+8). (example: `<peak-start-hour>`)
- `GLM_PEAK_END_CN`: Peak window end hour in China time (UTC+8, exclusive). (example: `<peak-end-hour>`)
- `GLM_STALL_TIMEOUT_MS`: Idle/stall timeout for actively streaming turns, in milliseconds. (example: `<stall-timeout-ms>`)
Note: Prefer the standalone npm package for generic MCP clients. Canonical config is stdio via `npx -y glm-mcp`. The README also documents Docker (`docker run --rm -i -e GLM_API_KEY=<your-zai-key> glm-mcp`) as an alternative runtime, but the npm stdio path is the simplest portable install. The server can boot without GLM_API_KEY for introspection only.
Add this MCP server to my current client's config in the correct format for you. If you need secrets or credentials I haven't provided, ASK me — do not invent values or leave raw placeholders. After adding it, tell me how to verify the server is connected.GLM_API_KEYrequiredAPI key for Z.ai/Zhipu GLM Coding Plan, required for actual GLM calls.AI orchestration with hive-mind swarms, neural networks, and 87 MCP tools for enterprise dev.
Persistent codebase knowledge graph. Survives session restarts and context compaction.
A powerful toolkit for coding, providing semantic retrieval and editing capabilities.