|
| 1 | +# v3.19.4 — fix failing `cortex` MCP server when working in the plugin repo |
| 2 | + |
| 3 | +Fourth entry in the 3.19.x reliability series. This one fixes a confusing |
| 4 | +failure that only appeared when the Cortex plugin source repo itself was the |
| 5 | +working directory: `/mcp` showed a failing `cortex` server with |
| 6 | +"MCP error -32000: Connection closed", alongside the healthy |
| 7 | +`plugin:cortex:cortex` server. |
| 8 | + |
| 9 | +## What it fixes |
| 10 | + |
| 11 | +The repo-root `.mcp.json` served double duty: |
| 12 | + |
| 13 | +1. **Plugin MCP config** — `.claude-plugin/plugin.json` referenced it as |
| 14 | + `"mcpServers": "./.mcp.json"`. |
| 15 | +2. **Project-scoped MCP config** — unintentionally. Claude Code picks up a |
| 16 | + repo-root `.mcp.json` as project configuration whenever that repo is the |
| 17 | + working directory. |
| 18 | + |
| 19 | +In project scope `${CLAUDE_PLUGIN_ROOT}` is never substituted (it is a |
| 20 | +plugin-scope-only variable), so the project-scoped registration spawned a |
| 21 | +literal `python3 '<repo>/${CLAUDE_PLUGIN_ROOT}/scripts/launcher.py'` → |
| 22 | +ENOENT → -32000. The phantom `cortex` entry shadowed the healthy |
| 23 | +plugin-scoped server (which connected in ~1.7 s in the same session's logs) |
| 24 | +and made the plugin look broken to anyone developing it. |
| 25 | + |
| 26 | +## The fix |
| 27 | + |
| 28 | +- The MCP server config moved **inline** into `.claude-plugin/plugin.json` |
| 29 | + `mcpServers` (the documented object form) — inline plugin config is |
| 30 | + invisible to project-scope discovery. |
| 31 | +- The repo-root `.mcp.json` was **deleted**. |
| 32 | +- The contract test (`tests_py/scripts/test_mcp_json_contract.py`) now reads |
| 33 | + the inline object and pins the absence of a repo-root `.mcp.json` as a |
| 34 | + regression guard. |
| 35 | + |
| 36 | +## Verification |
| 37 | + |
| 38 | +- Post-restart, only `plugin:cortex:cortex` registers; the failing `cortex` |
| 39 | + log stream (`mcp-logs-cortex/`) received no new entries. |
| 40 | +- `pytest tests_py/scripts/` — 12 passed. |
| 41 | +- `claude plugin validate .` — passes. |
| 42 | + |
| 43 | +## Diagnosis notes (for future -32000 triage) |
| 44 | + |
| 45 | +Two distinct -32000 root causes are now on record: |
| 46 | + |
| 47 | +- **2026-06-09:** stale `postmaster.pid` after unclean PostgreSQL shutdown. |
| 48 | +- **2026-06-12 (this release):** project-scope shadow registration of the |
| 49 | + plugin's `.mcp.json`. |
| 50 | + |
| 51 | +Per-project MCP logs live at |
| 52 | +`~/Library/Caches/claude-cli-nodejs/<project>/mcp-logs-<server>/` (JSONL, |
| 53 | +parse per-line). Two log directories for one conceptual server = two |
| 54 | +registrations — check scope before debugging the server itself. |
0 commit comments