Skip to content

fix(client): propagate refreshed token save errors#2110

Draft
pragnyanramtha wants to merge 1 commit into
modelcontextprotocol:mainfrom
pragnyanramtha:pragnyan/propagate-token-save-errors
Draft

fix(client): propagate refreshed token save errors#2110
pragnyanramtha wants to merge 1 commit into
modelcontextprotocol:mainfrom
pragnyanramtha:pragnyan/propagate-token-save-errors

Conversation

@pragnyanramtha
Copy link
Copy Markdown

Summary

  • move saveTokens(newTokens) outside the OAuth refresh failure catch
  • preserve existing fallback-to-reauth behavior for refresh failures
  • propagate post-refresh token persistence errors so rotated tokens are not silently lost

Fixes #2034.

Validation

  • pnpm --dir packages/client exec vitest run test/client/auth.test.ts -t "propagates saveTokens errors"
  • pnpm --dir packages/client exec vitest run test/client/auth.test.ts (168 passed)
  • pnpm --filter @modelcontextprotocol/client typecheck
  • pnpm --filter @modelcontextprotocol/client lint
  • git diff --check

Note

The repo pre-push hook also ran full workspace checks, but the unrelated @modelcontextprotocol/test-helpers lint currently fails on vitest being imported from a package devDependency in existing test/helpers files. This PR only changes packages/client and the changeset.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 16, 2026

🦋 Changeset detected

Latest commit: 0eb334c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@modelcontextprotocol/client Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 16, 2026

Open in StackBlitz

@modelcontextprotocol/client

npm i https://pkg.pr.new/@modelcontextprotocol/client@2110

@modelcontextprotocol/server

npm i https://pkg.pr.new/@modelcontextprotocol/server@2110

@modelcontextprotocol/express

npm i https://pkg.pr.new/@modelcontextprotocol/express@2110

@modelcontextprotocol/fastify

npm i https://pkg.pr.new/@modelcontextprotocol/fastify@2110

@modelcontextprotocol/hono

npm i https://pkg.pr.new/@modelcontextprotocol/hono@2110

@modelcontextprotocol/node

npm i https://pkg.pr.new/@modelcontextprotocol/node@2110

commit: 0eb334c

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.

auth() silently swallows non-OAuthError exceptions from refreshAuthorization / saveTokens, preventing token persistence

1 participant