# GLM MCP

Offloads code editing and repo tasks to Zhipu GLM models via MCP, keeping expensive tokens focused on top-level orchestration.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 7
- Author: djerok
- License: MIT · policy=link-only · description only; the file stays with the author
- Source: https://github.com/djerok/glm-mcp/tree/HEAD/claude/glm-mcp
- Updated: 2026-07-15
- HTML: https://affpapa.org/en/nevibecode/mcp/glm-mcp

## What it 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.

## Requirements
- Needs: Node.js (commands run via npx)
- Environment variables: `GLM_API_KEY` — keys and tokens: ask the human for the values, never commit them or put them in shared files.

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add glm-mcp -e GLM_API_KEY=<GLM_API_KEY> -- npx -y glm-mcp
```
Replace <…> with your own values

### Codex

**Platform CLI**
```bash
codex mcp add glm-mcp --env GLM_API_KEY=<GLM_API_KEY> -- npx -y glm-mcp
```
Replace <…> with your own values

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "glm-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "glm-mcp"
            ],
            "env": {
                "GLM_API_KEY": "<GLM_API_KEY>"
            }
        }
    }
}
```
Replace <…> with your own values

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "glm-mcp": {
            "type": "stdio",
            "command": "npx",
            "args": [
                "-y",
                "glm-mcp"
            ],
            "env": {
                "GLM_API_KEY": "<GLM_API_KEY>"
            }
        }
    }
}
```
Replace <…> with your own values

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add -e GLM_API_KEY=<GLM_API_KEY> glm-mcp npx -y glm-mcp
```
Replace <…> with your own values

## When to use it
- 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.jsonl` file
- check GLM engine recommendations without making remote API calls

## Example prompts
- Use `glm_agent` to refactor the database connector in `./backend`
- Run `glm_agent` with `dry_run: true` to inspect the planned migration diff
- Check GLM token usage and system status with `glm_status`

## Similar
- [REA](https://affpapa.org/en/nevibecode/mcp/rea.md) — MCP server · ★ 392262
- [GitHub](https://affpapa.org/en/nevibecode/mcp/github.md) — MCP server · ★ 33989
- [Netdata](https://affpapa.org/en/nevibecode/mcp/netdata.md) — MCP server · ★ 81163
- [browser-use](https://affpapa.org/en/nevibecode/mcp/browser-use.md) — MCP server · ★ 119231
- [Codebase Memory](https://affpapa.org/en/nevibecode/mcp/codebase-memory.md) — MCP server · ★ 47577
- [mcp-server](https://affpapa.org/en/nevibecode/mcp/mcp-server.md) — MCP server · ★ 43902

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
