Skip to content

fix(#1089): generated MCP configs launch through the inline node -e launcher; update/sync migrate legacy npx entries - #1208

Merged
admarble merged 8 commits into
mainfrom
fix/1089-inline-mcp-launcher
Sep 28, 2026
Merged

admarble merged 8 commits into
mainfrom
fix/1089-inline-mcp-launcher

Conversation

@admarble

Copy link
Copy Markdown
Contributor

Summary

Closes #1089. Every sequant MCP config sequant generates now launches the server through the inline node -e launcher from #1084, instead of running npx -y sequant@<pin> serve from the project directory. Before, a stale sequant in the project's own node_modules could no longer shadow the pin only for the plugin's own .mcp.json; now that holds everywhere.

Covered (all four consumers of getSequantMcpConfig(), plus the template):

  • createProjectMcpJson: the project .mcp.json
  • addSequantToMcpConfig: Claude Desktop, Cursor, VS Code + Continue. cwd/env handling is unchanged.
  • buildOpencodeMcpConfig: command: ["node", "-e", SOURCE, spec]
  • getPhaseMcpServersConfig: the sequant server injected into every phase agent. The issue didn't mention it, but it had the same exposure.
  • templates/mcp.json: the official-plugin-directory copy. prepare-marketplace.ts used to reject anything but command: "npx", so the validator was enforcing the vulnerable shape. It now requires the inline shape, a concrete pin, and args[1] matching the generator.

Design (owner-approved on the issue, 2026-09-28):

Field check (a copy of matcha-maps' real .mcp.json)

{"updated":true,"reason":"migrated","from":"[email protected]","to":"[email protected]"}
{"updated":false,"reason":"already-current"}              # second run is a no-op
supabase entry identical                                  # the other server ({type,url}) untouched
# the migrated command, launched from ~/Projects/matcha-maps with a fake npx on PATH:
mcp-launch: project dir /Users/tony/Projects/matcha-maps; launching npx from …/T/sequant-mcp-launch-9Idk9b
fake-npx cwd=/private/var/folders/…/T/sequant-mcp-launch-9Idk9b args=-y [email protected] serve

Acceptance criteria

  • AC-1, AC-4, AC-6: npx vitest run src/lib/mcp-config.test.ts passed, 68 of 68. AC-1 is an it.each over no clientType and every McpClientType. AC-4 covers: legacy migration keeping another server, legacy already on the current pin, a stale inline source, a local-binary entry byte-identical, and a dry run.
  • AC-2: npx vitest run scripts/mcp-launch.integration.test.ts. The new case spawns config.command/config.args exactly as returned, with a real node_modules/.bin/sequant symlink and a fake npx.
  • AC-3: npx vitest run scripts/plugin-mcp-pin.test.ts. The gate case checks that the generated module and templates/mcp.json args[1] equal generateInlineLauncherSource().
  • AC-5: npm run prepare:marketplace printed ✅ .mcp.json (MCP server config, pinned [email protected]) and ✅ shipped .mcp.json pinned [email protected], with no tracked files changed. Negative check: an npx-shaped dist .mcp.json fails --validate-only.
  • AC-7: CI test. Locally, after merging main: build exit 0, and the five files above plus sync.test.ts and update.test.ts passed, 144 of 144.

Mutation records

Mutation-verified: AC-2 — reverted getSequantMcpConfig to the npx -y serve form; scripts/mcp-launch.integration.test.ts failed (npx's recorded cwd equalled the project dir); restored.

Mutation-verified: AC-3 — changed one byte inside MCP_LAUNCHER_INLINE_SOURCE in src/lib/mcp-launch-inline.generated.ts; scripts/plugin-mcp-pin.test.ts failed; restored.

Notes for review

  • Docs: docs/features/mcp-server.md shows the inline form for Claude Code and says update/sync migrate. docs/troubleshooting.md points CONNECTION_CLOSED users at sequant update. The hand-written npx examples for other clients stay, with a note that they are still exposed to shadowing, because nobody writes an 8 KB launcher by hand.
  • Size: phase agents now carry about 8 KB of launcher source through the SDK's --mcp-config argv. That's fine on macOS/Linux; Windows has a 32 KB command-line limit, so keep an eye on it there.
  • After release: sequant update in each of the 12 local repos will migrate their .mcp.json. Every one of them still has the npx form today.

Test plan

  • AC commands above, run after merging main
  • Field migration on a copy of matcha-maps' .mcp.json
  • CI test + canary

🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(mcp): sequant init --mcp and the official-plugin-directory dist .mcp.json still invoke npx directly, retaining the #1084 shadowing exposure

1 participant