# v3.19.4 — fix failing `cortex` MCP server when working in the plugin repo

Fourth entry in the 3.19.x reliability series. This one fixes a confusing
failure that only appeared when the Cortex plugin source repo itself was the
working directory: `/mcp` showed a failing `cortex` server with
"MCP error -32000: Connection closed", alongside the healthy
`plugin:cortex:cortex` server.

## What it fixes

The repo-root `.mcp.json` served double duty:

1. **Plugin MCP config** — `.claude-plugin/plugin.json` referenced it as
   `"mcpServers": "./.mcp.json"`.
2. **Project-scoped MCP config** — unintentionally. Claude Code picks up a
   repo-root `.mcp.json` as project configuration whenever that repo is the
   working directory.

In project scope `${CLAUDE_PLUGIN_ROOT}` is never substituted (it is a
plugin-scope-only variable), so the project-scoped registration spawned a
literal `python3 '<repo>/${CLAUDE_PLUGIN_ROOT}/scripts/launcher.py'` →
ENOENT → -32000. The phantom `cortex` entry shadowed the healthy
plugin-scoped server (which connected in ~1.7 s in the same session's logs)
and made the plugin look broken to anyone developing it.

## The fix

- The MCP server config moved **inline** into `.claude-plugin/plugin.json`
  `mcpServers` (the documented object form) — inline plugin config is
  invisible to project-scope discovery.
- The repo-root `.mcp.json` was **deleted**.
- The contract test (`tests_py/scripts/test_mcp_json_contract.py`) now reads
  the inline object and pins the absence of a repo-root `.mcp.json` as a
  regression guard.

## Verification

- Post-restart, only `plugin:cortex:cortex` registers; the failing `cortex`
  log stream (`mcp-logs-cortex/`) received no new entries.
- `pytest tests_py/scripts/` — 12 passed.
- `claude plugin validate .` — passes.

## Diagnosis notes (for future -32000 triage)

Two distinct -32000 root causes are now on record:

- **2026-06-09:** stale `postmaster.pid` after unclean PostgreSQL shutdown.
- **2026-06-12 (this release):** project-scope shadow registration of the
  plugin's `.mcp.json`.

Per-project MCP logs live at
`~/Library/Caches/claude-cli-nodejs/<project>/mcp-logs-<server>/` (JSONL,
parse per-line). Two log directories for one conceptual server = two
registrations — check scope before debugging the server itself.
