GLM MCP — Claude Code MCP server: what it does, how to install
Offloads code editing and repo tasks to Zhipu GLM models via MCP, keeping expensive tokens focused on top-level orchestration.
claude mcp add glm-mcp -e GLM_API_KEY=<GLM_API_KEY> -- npx -y glm-mcpWhat GLM MCP does
This MCP server turns Zhipu GLM into a delegating subagent for environments like Claude Code, Codex, and Cursor. Your primary model plans and reviews code changes, while GLM handles file reading, writing, directory listing, and bash command execution through the Z.ai messages API.
The integration exposes four tools. glm_agent runs the file-editing loop, while glm_delegate handles plain text generation when enabled by GLM_DELEGATE=on. Local utilities include glm_recommend for engine guidance and glm_status for monitoring connection health and token counters logged to usage.jsonl.
Without a valid Zhipu credential in GLM_API_KEY, the server cannot execute any remote queries. If you need to inspect planned modifications before updating files, run tasks with dry_run: true to generate diff previews safely.
What it helps with
- delegate file edits and terminal commands to a secondary model
- inspect planned code modifications before writing via
dry_run - track delegated token consumption in the local
usage.jsonlfile - check GLM engine recommendations without making remote API calls
Example prompts for the agent
- Use
glm_agentto refactor the database connector in./backend - Run
glm_agentwithdry_run: trueto inspect the planned migration diff - Check GLM token usage and system status with
glm_status
How to install GLM MCP
Platform CLI
claude mcp add glm-mcp -e GLM_API_KEY=<GLM_API_KEY> -- npx -y glm-mcpReplace <…> with your own values
Platform CLI
codex mcp add glm-mcp --env GLM_API_KEY=<GLM_API_KEY> -- npx -y glm-mcpReplace <…> with your own values
Config file
{
"mcpServers": {
"glm-mcp": {
"command": "npx",
"args": [
"-y",
"glm-mcp"
],
"env": {
"GLM_API_KEY": "<GLM_API_KEY>"
}
}
}
}Replace <…> with your own values
Config file
{
"servers": {
"glm-mcp": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"glm-mcp"
],
"env": {
"GLM_API_KEY": "<GLM_API_KEY>"
}
}
}
}Replace <…> with your own values
Platform CLI
gemini mcp add -e GLM_API_KEY=<GLM_API_KEY> glm-mcp npx -y glm-mcpReplace <…> with your own values
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about GLM MCP
How to install GLM MCP in Claude Code?
Run claude mcp add glm-mcp -e GLM_API_KEY=<GLM_API_KEY> -- npx -y glm-mcp. Replace <GLM_API_KEY> with your active Z.ai API key before launching.
What does GLM MCP do?
It lets your orchestrating agent offload direct repository edits and command execution to Zhipu GLM. GLM carries out file changes autonomously and reports back with status summaries and token counts.
Can GLM preview edits without touching files?
Yes, set dry_run: true when invoking glm_agent. The subagent produces a diff preview and exits without altering any files on disk.