zcode-worker-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., "@zcode-worker-mcp Start a background task to fix the auth bug in ./api, using high reasoning."
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.
zcode-worker-mcp
English | 简体中文
A lightweight, transparent MCP server to delegate coding tasks to local ZCode (zcode / ZCode Desktop) with per-task model selection, detached worker survival across MCP restarts, OS PID start-time verification, and unified real-time session observability.
Why zcode-worker-mcp?
Capability | Legacy Bridge Setup |
|
Per-task model & reasoning | Relies on global default or opaque overrides |
|
MCP restart / | Child worker often dies or becomes orphaned on MCP reload | Workers run detached with logs redirected to disk; reconnecting MCP picks up state cleanly from SQLite |
Windows PID reuse safety | Naive PID tree checks can misidentify recycled PIDs (e.g. | Captures OS process creation ticks ( |
Mid-run observability | Isolated MCP SQLite DB hides ZCode Desktop/CLI sessions and internal progress | Unified observer joins |
Existing session resume | Usually starts from scratch or only by bridge task ID |
|
Runtime footprint | Large monolithic bundled JS + heavy process coordination | Clean TypeScript + |
Related MCP server: dsh-zcode-bridge
Requirements
Node.js
>= 22.18.0(tested on Node24.x, using built-innode:sqlite— zero native C++ addons)Local ZCode Desktop or ZCode runtime installed and signed in
Quick Start
Option 1: Install globally or link from source (recommended, no hardcoded paths)
If installed from npm (or directly from GitHub):
npm install -g zcode-worker-mcp
# Or before publishing to npm:
# npm install -g github:Hope-08/zcode-worker-mcpOr from a local clone:
git clone https://github.com/Hope-08/zcode-worker-mcp.git
cd zcode-worker-mcp
npm install
npm run build
npm linkThen configure your MCP client with the global binary name (no local path needed):
{
"mcpServers": {
"zcode": {
"command": "zcode-worker-mcp"
}
}
}Option 2: Zero-install via npx
{
"mcpServers": {
"zcode": {
"command": "npx",
"args": ["-y", "zcode-worker-mcp"]
}
}
}Note (GitHub & Windows): Before publishing to npm, replace
"zcode-worker-mcp"with"github:Hope-08/zcode-worker-mcp". On Windows hosts that invokespawn()withoutshell: true, use"command": "npx.cmd"(or"cmd"with["/c", "npx", "-y", ...]) if"npx"fails withENOENT/EINVAL.
Option 3: Direct node invocation (fastest startup, zero npm wrapper overhead)
{
"mcpServers": {
"zcode": {
"command": "node",
"args": ["/path/to/zcode-worker-mcp/dist/index.js"]
}
}
}Claude Code / Codex CLI
claude mcp add zcode -- zcode-worker-mcp
# or:
claude mcp add zcode -- npx -y zcode-worker-mcpOptional environment variables:
ZCODE_WORKER_MCP_DATA_DIR: Override state DB and worker log directory (defaults to~/.zcode-worker-mcp).ZCODE_HOME/ZCODE_DATA_BASE_DIR: Override where ZCode'scli/db/db.sqliteandv2/tasks-index.sqlitelive if customized.ZCODE_INSTALL_DIR/ZCODE_WINDOWS_APP_INSTALL_DIR: Override the ZCode desktop installation root if installed in a non-standard directory.
MCP Tools (9 Total)
Discovery & Environment
Tool | Description |
| Inspect ZCode installation paths, SQLite stores, node runtime, and active workers (automatically reconciles dead workers; never exposes API keys). |
| Probe ZCode's |
Task Execution & Control
Tool | Description |
| Start a structured task in a detached worker, optionally specifying |
| Resume a finished or failed managed task on its bound ZCode |
| Respond to a |
| Safely terminate verified |
Unified Observability
Tool | Description |
| List paginated sessions ( |
| Inspect full live details by either |
| Short-poll (<=25s, AbortSignal-aware) a task or session for periodic progress inspection or hosts without background command wakeup. |
Waiting Modes: Notification-First (wait) & Periodic Inspection
After zcode_start or zcode_continue, two complementary workflows are supported:
Default — Zero-polling completion wakeup (
waitCLI): Run the local blocker command in the background and end your agent turn so zero LLM polling tokens are burned while ZCode works:zcode-worker-mcp wait <task_id_or_session_id> --timeout 3600 [--notify]Checks SQLite & OS process health quietly without touching
stdoutuntil the task reaches a terminal state (completed,failed,cancelled,stalled_or_exited) orwaiting_input, then prints a single JSON snapshot and exits0(124on timeout,2if not found).Pass
--notify(or--toast) to also trigger a best-effort OS desktop notification.
Optional — Periodic inspection: Use
zcode_watch_session/zcode_inspect_session(or delegate to a lightweight watcher subagent / schedule) when periodic progress updates are desired or when the MCP client has no background shell wakeup.
Best-practice workflow guidance (worktree isolation, per-task model scoping, wait-first notifications, safe interaction replies, and independent post-task verification) is built directly into the MCP server's instructions and tool descriptions, so any MCP client gets it out of the box without installing extra skills.
Architecture Overview
MCP Client (Antigravity / Claude Code / Codex)
├── stdio JSON-RPC ──► zcode-worker-mcp (McpServer @modelcontextprotocol/server v2 + instructions)
│ ├── Read-only Observability ──► ~/.zcode/cli/db/db.sqlite + v2/tasks-index.sqlite + state.sqlite
│ ├── Model Probe ──────────────► zcode.cjs app-server (persistence: "deferred")
│ └── Task Dispatch / Cancel ───► detached node dist/worker.js <dataRoot> <taskId>
│ ├── survives MCP server restart / EOF
│ ├── stores state & interactions in state.sqlite (WAL)
│ └── drives zcode.cjs app-server (--surface desktop)
└── background wait ─► zcode-worker-mcp wait <task_id> [--notify] (0 LLM polling, exits on done/waiting_input)Development
npm run typecheck # TypeScript strict check
npm run build # Compile src/ -> dist/
npm test # Build + run node --test suiteLicense
MIT — see LICENSE.
Available Tools
9 toolszcode_cancelSafely Cancel a Managed ZCode Worker TaskADestructiveIdempotent
Terminate verified worker/app-server processes (strictly guarding against Windows PID reuse) and release the workspace lock.
Inputs: task_id (required), reason.
zcode_continueContinue an Existing Managed TaskB
Continue an existing task on its bound ZCode session_id with new feedback, optional updated requirements, or a different model/mode.
Inputs: task_id (required), feedback (required), mode, model, +2 more.
zcode_doctorZCode Environment & Worker Health CheckARead-onlyIdempotent
Inspect local ZCode CLI/Desktop installation, SQLite stores, configured runtime availability, and live worker processes without leaking credentials.
Inputs: no named parameters.
zcode_inspect_sessionInspect Live Progress of Any ZCode Task or SessionARead-only
Get real-time progress by task_id or session_id: effective state, live PID check, todos, recent tool calls, assistant messages, pending interactions, and final result/report.
Inputs: task_id, session_id, tool_limit, message_limit.
zcode_list_sessionsList Unified ZCode SessionsARead-only
List sessions across zcode-worker-mcp, ZCode Desktop, and ZCode CLI with live runtime PID checks, model/mode info, todo counts, pagination, and latest assistant previews.
Inputs: limit, offset, workspace, active_only, +1 more.
zcode_modelsList Available ZCode ModelsARead-only
Probe local ZCode app-server for the current model selection and all available providers, model_id values, and reasoning levels (sanitized, no API keys).
Inputs: workspace.
zcode_replyReply to a Pending Worker Permission or Input RequestB
Answer a waiting_input task's pending interaction (permission allow/deny, plan approval, or user input answers) so ZCode resumes.
Inputs: task_id (required), reason, answers, decision, +2 more.
zcode_startStart (or Resume) a Detached ZCode Worker TaskA
Dispatch a structured coding or analysis task to a detached ZCode worker that survives MCP restarts. Supports per-task model/provider/reasoning selection and optional resume_session_id.
Inputs: task_id (required), objective (required), workspace (required), mode, +11 more.
zcode_watch_sessionWatch a ZCode Session for Progress or CompletionARead-only
Short-poll (<=25s) for periodic progress checks or environments without background commands. For zero-token completion wakeup, prefer running zcode-worker-mcp wait <task_id> in background.
Inputs: task_id, session_id, tool_limit, interval_ms, +2 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 9 tools
Most tools target distinct lifecycle actions (start, continue, reply, cancel), but zcode_list_sessions, zcode_inspect_session, and zcode_watch_session all touch session progress monitoring and could be confused. Descriptions clarify snapshot vs short-poll behavior, so the overlap is manageable.
All names use a uniform zcode_ prefix and snake_case, with mostly verb-led names like zcode_start and zcode_inspect_session. zcode_models and zcode_doctor are noun-style exceptions, but the overall pattern remains readable and predictable.
Nine tools is well-scoped for a worker orchestration server, and each maps to a clear lifecycle stage: discovery, start, continue, monitor, reply, and cancel. There is no obvious bloat.
The surface covers model discovery, environment diagnostics, task dispatch, continuation, monitoring, interaction replies, and cancellation, which is strong lifecycle coverage. Minor gaps include no explicit session deletion/cleanup operation and no standalone result-only endpoint, though zcode_inspect_session covers final results.
Maintenance
Related MCP Connectors
Hosted runtime for persistent agent teams, durable workflows, memory, schedules, and goals.
The team layer for AI coding agents: shared contracts, collision alerts, E2EE sessions.
Remote shell and detached long-running jobs on your own machines — no SSH, open ports or VPN.
Durable background job execution, async task scheduling, and state persistence for AI agents.
Related MCP Servers
- AlicenseAqualityCmaintenanceEnables external agents to delegate coding tasks to a local zcode/GLM coding agent, with multi-turn sessions, model selection, and task cancellation.31MIT
- AlicenseAqualityAmaintenanceEnables a DeepSeek Harness agent to delegate bounded coding tasks to a local ZCode runtime, follow their progress through events, and review the resulting diffs before accepting or continuing the work. It also exposes model catalog, default-model, and setup-diagnostics tools for managing those delegated tasks.12Apache 2.0
- AlicenseNot gradedqualityBmaintenanceEnables MCP clients to delegate bounded tasks to a local OpenCode worker while monitoring progress, reviewing evidence, and managing session rework or recovery. It also supports persistent TUI tabs for delegated task workspaces.2MIT
- AlicenseNot gradedqualityBmaintenanceEnables Codex conversations to delegate tasks to persistent worker subagents backed by models configured in VS Code, including BYOK endpoints. Provides workspace inspection and controlled editing tools, approval-gated shell commands, transcripts, and worker lifecycle management.1MIT