Skip to content

fix: keep the saved helper version when authorizing a legacy MCP command - #2013

Open
playb0t wants to merge 1 commit into
nimbalyst:mainfrom
playb0t:playb0t/fix-bundled-mcp-bridge
Open

playb0t wants to merge 1 commit into
nimbalyst:mainfrom
playb0t:playb0t/fix-bundled-mcp-bridge

Conversation

@playb0t

@playb0t playb0t commented Nov 24, 2026 •

Copy link
Copy Markdown

Summary

A saved stdio command that still uses the legacy helper, such as npx -y [email protected] <url>, loses its package spec when the user presses Authorize: the launch is rebuilt as npx -y mcp-remote <url>, so npm picks the version at that moment. This change passes the saved version, tag or range through to the authorization launch. A command saved without a version uses 0.16.7, the version the code in mcpOAuth/ already follows.

The launch no longer goes through a shell. On Windows it runs npx.exe, or npm's npx-cli.js on a node.exe from PATH, so OAuth arguments with spaces, query parameters and JSON quotes arrive unchanged. The helper is requested under an npm alias, so a workspace dependency named mcp-remote cannot satisfy the request; npm still runs in the project and reads its .npmrc. A package spec that is not a registry version, tag or range is declined with invalid_config. The saved command itself is not modified.

Related issue

Follow-up to the native sign-in change that closed #1874. It covers the saved-command path that change left on the legacy helper.

Testing

  • New cases in MCPRemoteOAuth.trigger.test.ts: five saved package specs, a helper that cannot start, a non-registry source.
  • Seven neighbouring Vitest files: 179 passed, 1 live test skipped.
  • pnpm typecheck passes in all 39 workspaces.
  • pnpm test:prepush on Linux exits 1: 19505 passed, 1 failed, 30 skipped. The failing test is in claudeShellTrackingHost.test.ts, which this change does not touch. Run alone, that file fails one of its ten tests on unmodified main and on this commit, a different test each time.
  • With real npm 11.19.1 on Windows and on Ubuntu, a synthetic helper served from a loopback registry was selected correctly in 8 of 8 cases on each platform. The cases cover competing local versions, empty and exact selectors, a tag, a range, a project .npmrc registry, and an offline repeat from a warm cache.

Notes for reviewers

On Windows an installation that exposes only npx.cmd, with no npx.exe and no node_modules/npm folder in a PATH directory, now gets the "npx not found" help where it used to launch through the shell.

CHANGELOG.md gains one line under Fixed. pnpm-lock.yaml, pnpm-workspace.yaml and patches/ are unchanged.

@playb0t
playb0t requested a review from ghinkle as a code owner November 24, 2026 13:14
@playb0t
playb0t force-pushed the playb0t/fix-bundled-mcp-bridge branch from f7da600 to c50d84b Compare November 28, 2026 09:28
@playb0t playb0t changed the title fix: run the pinned MCP bridge on the bundled runtime fix: keep the saved helper version when authorizing a legacy MCP command Nov 28, 2026

This branch has not been deployed

No deployments
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.

[Bug]: Remote OAuth MCP servers still need a system npx — #197 does not cover the mcp-remote wrapper

1 participant