Repository navigation
Description
Problem
The generated project MCP config (src/lib/mcp-config.ts, written into every user's .mcp.json) launches the server with:
"command": "npx", "args": ["-y", "sequant@latest", "serve"]The -y + @latest combination forces npx to re-resolve and reinstall the package whenever the published latest version changes. In practice that means the first MCP reconnect after every sequant release triggers a fresh npx install. That reconnect is the exact moment a half-written or interrupted npx cache turns into a hard, opaque failure that surfaces to the user only as Failed to reconnect to sequant: -32000 (a generic JSON-RPC transport error that names neither npx nor the real cause).
Observed incident (2026-07-18, v2.9.0 release)
Immediately after publishing 2.9.0, /plugin reconnect failed with -32000. Running the launch command by hand surfaced the real error, an npm atomic-rename collision with a leftover temp dir:
npm error code ENOTEMPTY
npm error syscall rename
npm error ENOTEMPTY: directory not empty, rename
'.../_npx/<hash>/node_modules/sequant' -> '.../_npx/<hash>/node_modules/.sequant-XXXXXXXX'
Because the failure happens inside npx, before sequant serve executes, sequant cannot catch or self-heal it. Cleared the stale temp dir and it reconnected fine. Troubleshooting steps are now documented under "MCP Server Issues" in docs/troubleshooting.md.
Why this is a design question, not just a cache bug
The ENOTEMPTY corruption is an upstream npm issue and out of our control. What is in our control is how often we force an npx reinstall. @latest maximizes that frequency (every release), which maximizes exposure to any npx cache fragility — amplified on machines with multiple node prefixes (fnm/nvm + Homebrew) sharing one ~/.npm/_npx cache.
Options to weigh
- Pin to the installed version.
setup/updatewritessequant@<version>instead ofsequant@latest, and rewrites it on the nextupdate. Reconnects stop reinstalling on every release; the MCP server tracks releases only when the user runsupdate— matching the plugin-cache pinning model. Trade-off: MCP server no longer auto-tracks new releases. - Keep
@latest, improve diagnosability. Can't catch the npx failure in-process, but we could document more loudly / add a preflight insetupthat runs the launch command once and reports a cache problem clearly. Weaker fix. - Prefer a local binary when present.
setupdetects a global/linkedsequantand writessequant serve; else falls back tonpx. Trade-off: static JSON can't branch per-machine, so this is a write-time decision that can go stale, and the committed.mcp.jsonmust stay on the portablenpxform for other contributors.
Recommendation
Lean toward Option 1 (pin to installed version) as the most robust default — it removes the release-triggered reinstall entirely and is consistent with how the plugin cache already pins. Needs a decision on the auto-track-vs-determinism trade-off before implementing.
Acceptance Criteria
- Decide whether the generated
.mcp.jsonshould pin the MCP server to a concrete version instead of@latest - If pinning:
getSequantMcpConfigemits the installed version;setupandupdate(re)write it; tests updated (mcp-config.test.ts,init.test.tscurrently assertsequant@latest) - Docs updated (
docs/features/mcp-server.md,docs/guides/mcp-integrations.md) to explain the pin and how the MCP server tracks releases - Cross-reference the troubleshooting entry added for the
-32000/ ENOTEMPTY case
Notes
- Not fixing the npm ENOTEMPTY bug itself — that's upstream and unreachable from our code.
- The troubleshooting doc entry (portable version of the manual fix) already landed; this issue is only about the config-design decision.
Activity
admarble commentedon Jul 19, 2026
/fullsolve Complete → PR #794
Decision (AC-1): Pin to the installed version (Option 1), confirmed with the maintainer as best practice —
@latestin a committed, auto-launched command is non-reproducible and re-resolves on every release, which is what surfaced as-32000.AC Coverage
getSequantMcpConfigemitssequant@<version>;init/setupwrite it andupdatere-pins via newsyncSequantMcpPin(); tests updated.mcp-server.md+mcp-integrations.md(andplugin-distribution.md, setup SKILL ×3) explain the pin and release tracking.-32000/ ENOTEMPTY entry.Beyond literal AC (flagged for review)
The observed incident was plugin-side.
prepare-marketplacenow stamps the plugin.mcp.jsonwith the release version at build time (no release-script changes needed) so plugin users are actually fixed. Sourcetemplates/mcp.json+ root.mcp.jsonintentionally stay@latestas portable HEAD-tracking sources.Quality
prepare:marketplacestamps + validates a concrete pin (rejects@latest).Risk
getVersion()resolving the wrongpackage.json→ mitigated by the@latestfallback and name-guarded lookup.prepare:marketplacerun.Verdict: READY_FOR_MERGE — awaiting human review.
feat(#793): pin generated MCP config to installed version instead of @…
fix: close three pre-2.10.0 gaps found by release verification (#851)
feat(#793): pin generated MCP config to installed version instead of @…