Skip to content

fix(#1265): plugin MCP launcher starts through a symlinked path; upgrade test handles an unpublished pin - #1280

Merged
admarble merged 2 commits into
mainfrom
fix/mcp-launch-symlink-ismain
Oct 2, 2026
Merged

admarble merged 2 commits into
mainfrom
fix/mcp-launch-symlink-ismain

Conversation

@admarble

@admarble admarble commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #1265 (PR #1275). Found while getting release PR #1255 green.

Problem

#1265 switched plugin/.mcp.json to node ${CLAUDE_PLUGIN_ROOT}/mcp-launch.mjs sequant@<version>. The launcher's direct-invocation guard compared process.argv[1] with fileURLToPath(import.meta.url) as strings. import.meta.url is always the resolved path, so when the plugin path goes through a symlink, main() is skipped: the launcher exits 0 having started nothing, and Claude Code reports CONNECTION_CLOSED. Examples of symlinked paths: a symlinked ~/.claude (dotfiles setups), or a config dir under macOS /var (→ /private/var).

A second, separate failure showed up on #1255: on a release PR the plugin pins the version about to be published, so npx -y [email protected] can't start before npm publish, and the upgrade job's MCP check fails.

Changes

  • scripts/mcp-launch.mjs: the guard compares realpathSync of both paths (try/catch → false). The generator's IMPORT_BLOCK/REQUIRE_BLOCK/MAIN_GUARD_BLOCK are updated to match. The inline copies (.mcp.json, templates/mcp.json, src/lib/mcp-launch-inline.generated.ts) and plugin/mcp-launch.mjs are regenerated with npm run mcp-launch:inline.
  • scripts/mcp-launch.integration.test.ts: a new case starts the launcher through a symlinked directory and expects main() to run ("missing package spec argument", exit 1). The test makes its own symlink, so it covers Linux CI too.
  • plugin-install-test.yml upgrade job: if the cloned config's MCP pin isn't on npm, it points the config at the latest published sequant for the connection check.

Verification

  • The 22 test files that reference mcp-launch, .mcp.json or plugin/ pass: 1,244 tests.
  • The upgrade job run locally on macOS against this branch: the cache path goes through /var → /private/var, and plugin:sequant:sequant … mcp-launch.mjs [email protected] - ✔ Connected. Before the fix it was ✘ Failed to connect — CONNECTION_CLOSED.

Mutation-verified: AC-1 — restored the string compare process.argv[1] === fileURLToPath(import.meta.url) in scripts/mcp-launch.mjs; scripts/mcp-launch.integration.test.ts > mcp-launch.mjs starts when invoked through a symlinked path > runs main() (rejects the missing spec) instead of exiting silently failed; restored.

After merge

Merge main into #1255 (v2.19.0). Otherwise the release ships the symlink bug to every plugin user with a symlinked config dir.

🤖 Generated with Claude Code

…ymlink

plugin/.mcp.json now runs node ${CLAUDE_PLUGIN_ROOT}/mcp-launch.mjs (#1265). The launcher's direct-invocation guard compared process.argv[1] with fileURLToPath(import.meta.url) as strings; import.meta.url is always resolved, so a symlinked plugin path (a symlinked ~/.claude, macOS /var -> /private/var) skipped main(), exited 0 and Claude Code reported CONNECTION_CLOSED. Compare realpathSync of both. Inline copies regenerated.

Entire-Checkpoint: e5f3f352cc83
…en the MCP pin isn't on npm yet

On a release PR the plugin pins the version about to be published, so npx -y sequant@<pin> can't start and the MCP connection check fails (seen on #1255). The check is about the launcher file and the connection, so point the cloned config at the latest published version in that case.

Entire-Checkpoint: 4f6fc532f472
@admarble admarble added the bug Something isn't working label Oct 2, 2026
@admarble
admarble merged commit 7444932 into main Oct 2, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant