zcodium-project/zcodium/diagnosing-mcp
Claude Code and agent skill by zcodium-project/zcodium
- community
- ext:[{"type":"config","description":"Configuration overrides"}]
Checking that the SKILL.md file is still in the repository.
Use to diagnose and fix ZCode MCP (Model Context Protocol) server configuration problems in the ZCode client. Applies when an MCP server will not connect, its tools (mcp__server__tool) do not appear, it shows as disabled or failed, connections time out, a command cannot be found, template variables are not expanded, or a server defined in a configuration file has no effect. Provides configuration locations, how to inspect status in Settings, common pitfalls, and a step-by-step localization and repair workflow.
Install
npx vskill@latest install zcodium-project/zcodium/diagnosing-mcpSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as zai-org/zcode/diagnosing-mcp.
Diagnosing MCP Configuration
Goal: reduce any MCP problem to a single concrete file-field edit. A person inspects status from the client; an agent reads and edits the configuration files directly.
Key points that are often misunderstood: the user configuration file is~/.zcode/cli/config.json;.agents/mcp.jsonis a compatibility fallback (read only when the same scope's.zcodehas no MCP servers); and in the desktop client, MCP status and repair live under Settings → MCP.
1. Configuration locations and precedence
| Scope | File | Field | |
|---|---|---|---|
| User | ~/.zcode/cli/config.json | mcp.servers | |
| User (fallback) | ~/.agents/mcp.json | mcpServers (used only if ~/.zcode/cli/config.json has no MCP servers) | |
| Workspace | <repo>/.zcode/config.json or <repo>/zcode.json (every directory from the repository root down to the working directory is read) | mcp.servers | |
| Workspace (fallback) | <repo>/.agents/mcp.json | mcpServers (used only if the workspace .zcode has no MCP servers) | |
| Plugin | <pluginRoot>/.mcp.json or the manifest's mcpServers field | Keys are namespaced as plugin:<plugin>:<server> |
Within each scope, .zcode takes priority and .agents/mcp.json is a same-scope fallback: if that scope's .zcode defines any MCP server, its .agents/mcp.json is ignored entirely. Note the different key shape — .zcode uses nested mcp.servers, while .agents/mcp.json uses a top-level mcpServers.
Override order across scopes for a same-named server: CLI → environment → user → workspace → system. In short, user overrides workspace. Plugin-provided servers form the base layer and are overridden by explicit configuration.
Auto-connect: MCP servers from every scope — user, workspace, plugin, environment, and CLI — are trusted and connected automatically at session start. Workspace-scoped servers were previously untrusted (reported Project MCP server requires explicit connection before use.); they now connect by default like any other scope. Use Settings → MCP as the supported client surface for inspecting status and repairing configuration.
2. Configuration schema
stdio: requirescommand; optionalargs[],cwd,env,enabled,timeoutMs.http/sse: requiresurl; optionalheaders,enabled,timeoutMs.- Standard field names are
envfor stdio environment variables andheadersfor HTTP/SSE request headers.commandis a string andargsis an array of strings; do not paste OpenCode-stylecommand: ["npx", "-y", "..."]into ZCode's JSON editor. - When
typeis omitted it is inferred: acommandimpliesstdio, aurlimplieshttp. Legacy forms are migrated automatically when the CLI reads config directly (type: "remote"→http,environment→env,enable→enabled,http_headers→headers). Desktop app-managed session creation may bypass part of that CLI file parser, so prefer canonical fields (env,headers,enabled,type: "http") in files that the desktop Settings → MCP page reads. - The configuration-file server schema is strict: an unknown key causes the server to be dropped.
- Template variables `${...}` are expanded only for plugin-provided MCP servers (for example
${CLAUDE_PLUGIN_ROOT}/${ZCODE_PLUGIN_ROOT},${CLAUDE_PROJECT_DIR},${user_config.KEY}). Configuration-file MCP servers do not expand templates — use absolute paths there. - The default timeout is 30000 ms.
Canonical examples:
3. How to inspect status
- List and status: open Settings → MCP in the client. Each entry shows whether the server is connected, disabled, disconnected, or failed, with any error inline. Plugin-provided servers are marked as built-in. (
untrustedis a legacy status that no longer appears for normally configured servers now that every scope auto-connects.) - After edits: restart the affected session, or restart ZCode if the Settings page still shows stale data, then reopen Settings → MCP to confirm the server status.
- Standard-I/O error output (the root cause of most failures): a stdio server's captured error stream is written to the ZCode log. To see the full output, run the server's
commandwith its arguments directly in a terminal.
4. Common pitfalls (symptom → cause → fix)
- Workspace server does not connect — a server defined in
<repo>/.zcode/config.json(or<repo>/.agents/mcp.json) is not connecting. Workspace servers now auto-connect like any other scope, so this is no longer a trust gate — the cause is a real config or startup problem. → Check its Settings → MCP status:failed→ go to step 4; absent → the config was not loaded (pitfall 5/9) or it is in.agents/mcp.jsonbut shadowed (pitfall 12). - `command not found` — the server shows
failedwith an error such asspawn npx ENOENT. Thecommandis not onPATH, or a relative path was not resolved. → Use an absolute path, addcwdwhen needed, and on Windows point at the.cmd/.exe. - `${...}` reaches the process literally — configuration-file MCP servers do not expand templates. → Use concrete absolute paths (templates are a plugin-only feature).
- Plugin is missing an environment value or secret — the plugin reports a missing variable. → Set the plugin's configuration value (Plugin Management → the plugin's advanced settings) or export the required environment variable; sensitive values may only be placed in
env/headers, not incommand/url. - Wrong transport type or unknown key — the server is silently dropped. → Make
typematch the fields, remove any extra top-level keys (the schema is strict), and ensure exactly one ofcommand(stdio) orurl(http/sse) is present. - Unexpected override — editing the workspace
mcp.serversentry has no effect. A same-named server in the user configuration is shadowing it (user overrides workspace for MCP). → Edit the user entry, or rename one of the servers. - Connection or tool-listing timeout —
failed ... timed out after 30000ms. → Add"timeoutMs": 60000to that server, and address the slow startup. - Only `Connection closed` with no cause — the error stream was not surfaced in the status line. → Check the ZCode log for the captured error output, or run the
commandwith its arguments in a terminal. - JSON syntax error in the configuration file — MCP servers (and possibly the whole file) go missing. → Validate the JSON, then fix the syntax.
- Server shows as disabled —
enabled: false(or legacyenable: false). → Set"enabled": trueor remove the field. - A desktop-managed server list overrides the file — edits to configuration files have no effect because the client is supplying the MCP list. → Manage MCP through Settings → MCP in that context.
- `.agents/mcp.json` edits have no effect, or use the wrong key — a server added to
.agents/mcp.jsonnever appears. Either the same scope's.zcodealready defines MCP servers (so.agents/mcp.jsonis ignored entirely for that scope), or the servers were placed undermcp.serversinstead of the top-levelmcpServersthat.agents/mcp.jsonexpects. → Move the definition into the.zcodefile for that scope, or ensure that scope's.zcodehas no MCP servers and use the top-levelmcpServerskey in.agents/mcp.json. - Server name appears in logs but no MCP tools appear in the model request — the desktop app read the server entry and passed its name to the runtime, but the server failed during startup, so
toolCountandregisteredToolCountare zero. A common cause is a legacyenvironmentfield in~/.zcode/cli/config.json: CLI direct config parsing can migrate it, but the desktop app-managed path currently expectsenvwhen converting to protocolmcpServers. → Renameenvironmenttoenv, keep the values unchanged, restart ZCode, and reopen Settings → MCP. - Settings → MCP crashes after JSON editing with `command.trim is not a function` — the saved server has a non-string
command, usually OpenCode-stylecommand: ["npx", "-y", "server"]. → Edit~/.zcode/cli/config.jsonmanually: set"command": "npx"and move the rest into"args": ["-y", "server"], then restart the app.
5. Localization workflow (in order; stop when the cause is found)
- Confirm MCP is enabled (it is by default).
- Open Settings → MCP and read the status:
disabled→ pitfall 10;failed (<error>)→ read the inline error and go to step 4; not listed at all → step 3. (untrustedshould no longer appear for a normally configured server.) - Verify the configuration is loaded and valid: check the JSON validity of
~/.zcode/cli/config.jsonand<repo>/.zcode/config.json(andzcode.json) — pitfall 9. A server that is in the file but not listed failed schema validation (pitfall 5 — look for unknown keys, wrongtype, or a missingcommand/url); a server defined only in.agents/mcp.jsonbut not appearing points to the fallback shadowing or wrong-key issue (pitfall 12). - Diagnose a
failedserver:ENOENT→ pitfall 2;timed out→ pitfall 7;Connection closed→ pitfall 8; an http/sse network error → check proxy/CA, URL reachability, andheaders. - If Settings → MCP or service logs show
mcpServerCount/ server names but the model request has nomcp__...tools, check startup logs formcp.startup.completedandmcp.tools.registered. IftoolCount=0with failed statuses, inspect the config field names first (envvsenvironment, stringcommandvs arraycommand) before treating it as a model-selection issue. - If edits have no effect → pitfall 6 (user overrides workspace) or pitfall 11 (desktop-managed list).
- If a
${...}appears literally → pitfall 3 (configuration files do not expand templates) or pitfall 4 (an unset plugin variable). - Apply the concrete fix — most commonly editing
~/.zcode/cli/config.jsonatmcp.servers.<name>(command/args/cwd/env/headers/timeoutMs/enabled) — then restart the session (every scope auto-connects) and reopen Settings → MCP to confirm.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingapps/zcode-cli/packages/zcode-guide-plugin/skills/diagnosing-mcp/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Extension points
configConfiguration overrides
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/zcodium-project/zcodium/diagnosing-mcp)