Repository navigation
feat(#793): pin generated MCP config to installed version instead of @latest - #794
Merged
admarble merged 1 commit intoJul 19, 2026
Conversation
…latest The generated `.mcp.json` launched the server with `sequant@latest`, forcing npx to re-resolve and reinstall on the first MCP reconnect after every release — the moment a corrupted npx cache (npm ENOTEMPTY) surfaces as an opaque `Failed to reconnect to sequant: -32000`. Pin to a concrete version so reconnects stop reinstalling; the MCP server tracks releases when the user runs `sequant update`, matching the plugin-cache pinning model. - getSequantMcpConfig() emits `sequant@<installed version>` via getVersion(), falling back to `@latest` if the version can't be resolved (never a bogus `@0.0.0` pin). init/setup write the pin. - New syncSequantMcpPin(): update/sync re-pins an existing `.mcp.json` to the installed version (no-ops on missing file, no sequant entry, a local-binary override, or an already-current pin; --dry-run previews without writing). Wired into `update` before the "up to date" short-circuit so a version-only upgrade still refreshes the pin. - prepare-marketplace stamps the plugin `.mcp.json` with the release version at build time (fixes the plugin-side incident) and validates the output is a concrete pin, not @latest. Source `templates/mcp.json` + root `.mcp.json` stay @latest as portable HEAD-tracking sources. - Tests: mcp-config, init, mcp-serve integration updated to assert the pin; added syncSequantMcpPin coverage. - Docs: mcp-server, plugin-distribution, mcp-integrations, setup SKILL (x3), and the troubleshooting -32000 entry explain the pin and release tracking.
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #793. The generated
.mcp.jsonlaunched the MCP server withsequant@latest, which forcesnpxto re-resolve and reinstall the package on the first MCP reconnect after every release — the exact moment a corrupted npx cache (npmENOTEMPTY) turns into an opaqueFailed to reconnect to sequant: -32000. This implements the issue's recommended Option 1: pin to a concrete version so reconnects stop reinstalling, and let the MCP server track releases when the user runssequant update(mirroring how the plugin cache already pins).Design: sources track HEAD, distributed artifacts are pinned
getSequantMcpConfig()output (user's.mcp.jsonvia init/update)sequant@<installed version>, refreshed bysequant update.mcp.json(viaprepare-marketplace)templates/mcp.json, root.mcp.json(source)@latestChanges
src/lib/mcp-config.ts—getSequantMcpConfig()emitssequant@<version>viagetVersion(), falling back to@latestif the version can't be resolved (never writes a bogus[email protected]). NewsyncSequantMcpPin()re-pins an existing.mcp.jsonto the installed version — no-ops on missing file, no sequant entry, a local-binary override (nosequant@…arg), or an already-current pin;--dry-runpreviews without writing.src/commands/update.ts— callssyncSequantMcpPin()before the "everything up to date" short-circuit, so a version-only upgrade still refreshes the pin.init/setupalready write the pin throughcreateProjectMcpJson.scripts/prepare-marketplace.ts— stamps the plugin.mcp.jsonwith the release version at build time (this step already runs on every release path, so no release-script edits) and validates the output is a concrete pin, not@latest. This addresses the observed incident, which was plugin-side (/pluginreconnect).mcp-config,init, and themcp-serveintegration test assert the pin; added asyncSequantMcpPinsuite (stale/@latest→pin, already-current no-op, absent file, no entry, local-binary override, dry-run).mcp-server.md(new "Version pinning" note + examples),plugin-distribution.md,mcp-integrations.md(cross-ref), the three mirroredsetup/SKILL.md, and the troubleshooting-32000entry now explain the pin and how the server tracks releases.Acceptance Criteria
getSequantMcpConfigemits the installed version;setup/update(re)write it; tests updated (mcp-config.test.ts,init.test.ts).mcp-server.md,mcp-integrations.md) explain the pin and release tracking.-32000/ ENOTEMPTY entry.Beyond the literal AC (flagged)
AC-2 scopes the change to the generator, but the reported incident was plugin-side. Rather than leave plugin users unfixed, I also pin the plugin's marketplace
.mcp.jsonvia build-time stamping — DRY, auto-tracks releases, and requires no changes to the release scripts. Sourcetemplates/mcp.jsonand the repo's own root.mcp.jsonintentionally stay@latest; a maintainer wanting the dev-repo config pinned can runsequant update.Verification
npm run build✅npm run lint✅ (0 warnings)mcp-config,version-check,init,update)npm run prepare:marketplacestamps[email protected]into the plugin config and the pin-validation passes.Risk assessment
getVersion()ever resolves the wrongpackage.json, the pin could target an unintended version — mitigated by the@latestfallback and the existing name-guarded lookup.prepare:marketplacerun, not an automated release e2e.🤖 Generated with Claude Code