# djerok/glm-mcp [Health: Active]

**Category:** 🤖 Coding Agents  
**Repository:** https://github.com/djerok/glm-mcp  
**GitHub Stars:** 2  
**npm Downloads (last month):** 415  
**Views:** 6  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/djerok-glm-mcp

## Description
Run GLM (Zhipu/Z.ai) as a real sub-agent inside Claude Code or GitHub Copilot. GLM gets its own agent loop (read/write/edit/run) on your repo — not a single LLM call — with peak-aware Opus-vs-GLM routing, diff/dry-run/git-revert oversight, and a usage ledger. 10x cheaper than Opus. Requires a Z.ai GLM Coding Plan key.

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "glm-mcp": {
    "command": "npx",
    "args": ["-y","glm-mcp-claude"],
    "env": {
      "GLM_API_KEY": ""
    }
  }
}
```

**Requires environment variables:** `GLM_API_KEY` — the values above are empty placeholders; fill in real credentials before running (see the repository for what each one is for).

## Documentation

## What djerok/glm-mcp MCP server does

djerok/glm-mcp MCP server exposes Z.ai GLM to an MCP-compatible coding workflow. Its central `glm_agent` tool accepts a task and an absolute repository working directory, then lets GLM operate through an agent loop rather than making one isolated completion request. The loop can inspect files, modify them, enumerate directories, and execute Bash commands in the target repository.

The server is designed for a main agent such as Claude Code, GitHub Copilot, or Codex to delegate work and review the result. After the delegated run, the main agent receives a concise summary and a `GLM STATS` block containing the selected model, token counts, and estimated cost. Every GLM call is also appended to a `usage.jsonl` ledger.

## How it works

When `glm_agent` is called, a peak-aware router selects a GLM model and sends the request to Z.ai's Anthropic-compatible `/v1/messages` endpoint. GLM handles the tool loop against the supplied repository, and the MCP server relays the result to the orchestrating client. A cost bias keeps GLM as the default engine in the routing behavior described by the project.

The tool supports `dry_run: true`, which previews a diff without writing changes. A completed real run prints a Git checkpoint revert line, giving the primary agent a way to review or undo changes. Progress notifications report the current iteration, token count, and token rate. Cancellation stops the run promptly, although partial changes may remain and need review or reversion.

## Setup and configuration

For a general MCP client, install the published `glm-mcp` package with `npx -y glm-mcp`. Configure it as a stdio server and provide `GLM_API_KEY` with a Z.ai key. The server can start and answer MCP introspection requests without a key, but actual GLM calls require one.

The repository also provides separate installers for Claude Code, GitHub Copilot in VS Code, and Codex. Those installers add client-specific subagents, hooks, skills, or configuration in addition to registering the same underlying MCP server. The documented installer packages are `glm-mcp-claude`, `glm-mcp-copilot`, and `glm-mcp-codex`.

`GLM_DELEGATE=on` exposes the optional text-only delegation tool. `max_tokens` defaults to `auto`, or the orchestrating agent can provide a numeric limit. The default stall timeout is controlled by `GLM_STALL_TIMEOUT_MS`; client tool-call limits can also involve `MCP_TOOL_TIMEOUT` or `CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT`.

## Tools and capabilities

The djerok/glm-mcp MCP server provides four tools:

- `glm_agent`: delegates repository work to GLM, including read, write, edit, directory listing, and Bash execution.
- `glm_delegate`: performs text-in/text-out generation and is hidden unless `GLM_DELEGATE=on` is set.
- `glm_recommend`: gives a free local recommendation about GLM versus the main model, including model choice, confidence, and reasons.
- `glm_status`: reports the peak window, active model, usage-ledger totals, and configuration health without making a GLM request.

## Limitations and notes

The delegated agent can mutate files and run commands in the supplied repository, so the main agent should inspect its output and diffs. A dry run avoids writes, but normal execution can leave partial changes if cancelled. The server reports estimated cost and ledger totals, but the README does not establish those estimates as billing statements. GLM usage requires the user's Z.ai GLM Coding Plan key, and a hybrid main-agent workflow still consumes tokens for orchestration and review.

_Full upstream README: https://allmcps.com/mcp/djerok-glm-mcp/readme_

