glm-subagent-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@glm-subagent-mcp Delegate fixing the failing tests in src/ and verify with npm test."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
glm-subagent-mcp
MCP server that delegates work to a Claude Code subprocess billed against a GLM Coding Plan.
Parent agent keeps its own auth. The child claude -p process is isolated (CLAUDE_CONFIG_DIR, --bare) so it cannot steal the parent's Anthropic OAuth or recurse into this MCP server.
Install
uvx --from git+https://github.com/gaztrabisme/glm-subagent-mcp glm-subagent-mcpClaude Code
{
"mcpServers": {
"glm-subagent": {
"command": "uvx",
"args": [
"--from", "git+https://github.com/gaztrabisme/glm-subagent-mcp",
"glm-subagent-mcp"
],
"env": {
"GLM_API_KEY": "your-z.ai-key",
"GSA_WORKSPACE": "/path/to/your/project"
}
}
}
}Requires claude on PATH (Claude Code CLI). Do not put ANTHROPIC_BASE_URL into ~/.claude/settings.json — that would reroute the parent. This server injects GLM credentials only into the child process.
Related MCP server: opencode-mcp
Tools
Tool | What it does |
| Start a new Claude Code subagent on a task. Returns |
| Block until a run finishes; returns the result. |
| Follow-up work in the same Claude Code session ( |
| Every agent this server owns, with state, cost, and run history. |
| SIGTERM the in-flight process and close the agent. |
| Activity log — tool calls, messages, raw response. |
Typical loop: glm_delegate → glm_await → (glm_continue) → glm_cancel.
Every delegation needs a verification command. The server runs it after the child finishes. Exit 0 → completed; otherwise completed_unverified. Pass "true" if there is nothing to check.
Isolation
Child env:
ANTHROPIC_BASE_URL=https://api.z.ai/api/anthropic,ANTHROPIC_AUTH_TOKEN=$GLM_API_KEYCLAUDE_CONFIG_DIRunder.gsa-sessions/agents/<id>/claude-home--bareso project.mcp.jsonand host~/.claudeare not loaded (recursion kill)--dangerously-skip-permissionsplus a PreToolUse guard (same policy as deepseek-subagent-mcp)Default model:
glm-5.3[1m](GSA_MODEL/glm_delegate(model=...))
Configuration
Every setting is an environment variable on the server process. See wiki/implementation-brief.md for the full table. Common ones:
Variable | Default | Meaning |
| — | Z.ai API key (also |
|
| Anthropic-compatible GLM endpoint |
|
| Model for delegated work |
|
| Haiku-slot mapping |
| server cwd | Directory the child reads and writes |
|
| Concurrent in-flight children |
|
|
|
|
| Seconds before a run is killed |
|
|
|
Limits
claudemust be on PATH. This server does not bundle Claude Code.--bareskips the workspaceCLAUDE.md; if the file exists it is passed via--append-system-prompt-file.Cancel is SIGTERM. Edits already written stay on disk.
A GLM Coding Plan key is required at spawn time, not at import.
Development
uv sync
uv run pytest -qAvailable Tools
6 toolsglm_awaitA
Wait for a run to finish and return its result.
Safe to call repeatedly. If the run is still going when wait_seconds elapses, this returns the current state rather than an error. Runs whose agent has since been reaped are still readable — their results are archived.
Args: run_id: The run to wait on, from glm_delegate or glm_continue. wait_seconds: Maximum time to block. Use a longer value for big tasks.
Inputs: run_id (required), wait_seconds. Returns: object
glm_cancelA
Stop a subagent and release its runtime process.
The harness protocol has no mid-turn cancel, so this kills the child process. Any in-flight run is reported as cancelled, and file edits it already made stay on disk. Cancelling ends the session: its context cannot be resumed, so start a new agent rather than continuing this one.
Args: agent_id: Agent to stop.
Inputs: agent_id (required). Returns: object
glm_continueA
Send follow-up work to an existing subagent, in its original session.
The child keeps the full context of its earlier turns, so refer to prior work directly ("the migration you just wrote"). Work is queued: if the agent is mid-run, this message runs after it.
Args: agent_id: Agent to continue, from glm_delegate or glm_list. message: The follow-up instruction. verification: Command proving this follow-up is done. Omit to skip verification for this turn; the run then reports completed_unverified. wait_seconds: Block up to this long for the run to finish. 0 returns at once.
Inputs: message (required), agent_id (required), verification, wait_seconds. Returns: object
glm_delegateA
Start a new Claude Code subagent on a task.
Returns immediately with an agent_id and run_id unless wait_seconds is set. Each call creates a fresh agent with its own runtime process and session; use glm_continue to give more work to an agent that already exists.
Args: task: What to do, with a clear definition of done. The child cannot ask you clarifying questions, so state the acceptance criteria. verification: The shell command that proves the task is done, run by this server in the workspace after the child finishes — e.g. "pytest -q" or "npm test && npm run lint". Its exit code decides whether the run is reported completed or completed_unverified. Pass "true" if there is genuinely nothing to check. workspace: Directory the child reads and writes. Relative paths resolve against the server's configured workspace. Defaults to that workspace. instructions: Optional standing guidance prepended to the task, e.g. coding conventions or files to leave alone. model: GLM model id. Defaults to the server's configured model. name: Human label for this agent, shown in glm_list. wait_seconds: Block up to this long for the run to finish. 0 returns at once.
Inputs: task (required), verification (required), name, model, +3 more. Returns: object
glm_listA
List every subagent this server owns, with its state, cost, and run history.
Inputs: no named parameters. Returns: object
glm_transcriptA
Show what a subagent actually did during a run.
Returns the tail of its activity log — tool calls, assistant messages, turn endings. Use this to check progress on a long run, or to understand a failure. Returns live data while the run is still going.
Args: run_id: The run to inspect. limit: How many of the most recent activity lines to return. raw: Also return the child's full uncapped response. glm_delegate returns a distilled version when the answer is large; this is where the original text lives.
Inputs: run_id (required), raw, limit. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool targets a distinct lifecycle action: listing, delegating, waiting, continuing, cancelling, and inspecting subagents. The only potentially related pair, glm_await and glm_transcript, are clearly separated by wait-for-result versus inspect-activity-log semantics.
All tools share a consistent glm_ prefix followed by a single clear verb or noun: list, delegate, await, continue, cancel, transcript. The naming pattern is uniform, predictable, and matches each tool's purpose.
Six tools is well-scoped for a subagent management server. Each tool covers a necessary part of the agent lifecycle without redundancy or bloat.
The surface covers the full subagent workflow: create via glm_delegate, follow-up via glm_continue, monitor via glm_await and glm_transcript, terminate via glm_cancel, and observe overall state via glm_list. Archived results and live progress handling close the remaining operational gaps.
Related MCP Connectors
Source-checked CLI guides and model-aware planning for Claude Code, Codex, and Grok Build.
Build Apps and run code in 30 languages — sandboxed, with persistent sessions for agent loops.
Shared control plane for AI coding agents — tasks, memory, decisions, file locks. 12 tools.
Run your AI-run company from Claude Code, Codex, Cursor or ChatGPT: inbox, tasks, team, Studio.
Related MCP Servers
- AlicenseAqualityDmaintenanceWraps Claude Code as tools for MCP clients, enabling autonomous coding tasks via a 4-tool lifecycle with session management, async polling, and permission controls.493 npm21MIT
- AlicenseAqualityBmaintenanceEnables Claude Code to delegate tasks to OpenCode subagents asynchronously, with tools for starting tasks, polling status, and fetching results.7630 npm6MIT
- AlicenseNot gradedqualityDmaintenanceDelegates coding tasks to the local Claude Code CLI via MCP, offering run, review, and status tools for MCP-compatible agents.25 npmMIT
- FlicenseNot gradedqualityCmaintenanceEnables orchestrators to drive Claude Code as a structured software-engineering worker over HTTP, with tools to submit coding tasks, poll for normalized results, resume, review, and cancel jobs.-