GLM (Zhipu/Z.ai) as a ~10x cheaper file-editing subagent for AI coding agents.
Setup
Choose your client, copy the config, then fill in any required environment variables.
claude mcp add glm --env GLM_API_KEY='<GLM_API_KEY>' -- npx -y glm-mcp~/.codex/config.toml
[mcp_servers.glm]
command = "npx"
args = ["-y", "glm-mcp"]
env = { GLM_API_KEY = "<GLM_API_KEY>" }
# codex mcp add glm --env GLM_API_KEY='<GLM_API_KEY>' -- npx -y glm-mcp~/.cursor/mcp.json
{
"mcpServers": {
"glm": {
"command": "npx",
"args": [
"-y",
"glm-mcp"
],
"env": {
"GLM_API_KEY": "<GLM_API_KEY>"
}
}
}
}.vscode/mcp.json
{
"servers": {
"glm": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"glm-mcp"
],
"env": {
"GLM_API_KEY": "<GLM_API_KEY>"
}
}
}
}~/.gemini/settings.json
{
"mcpServers": {
"glm": {
"command": "npx",
"args": [
"-y",
"glm-mcp"
],
"env": {
"GLM_API_KEY": "<GLM_API_KEY>"
}
}
}
}claude_desktop_config.json
{
"mcpServers": {
"glm": {
"command": "npx",
"args": [
"-y",
"glm-mcp"
],
"env": {
"GLM_API_KEY": "<GLM_API_KEY>"
}
}
}
}.trae/mcp.json
{
"mcpServers": {
"glm": {
"command": "npx",
"args": [
"-y",
"glm-mcp"
],
"env": {
"GLM_API_KEY": "<GLM_API_KEY>"
}
}
}
}Environment variables
GLM_API_KEY
Replace the placeholders with your own credentials and keep them out of version control.