Skip to content

feat(mcp): rotate refresh tokens for SDK auth#1143

Merged
kunickiaj merged 1 commit into
mainfrom
b20m.4-mcp-refresh-resource-binding
May 24, 2026
Merged

feat(mcp): rotate refresh tokens for SDK auth#1143
kunickiaj merged 1 commit into
mainfrom
b20m.4-mcp-refresh-resource-binding

Conversation

@kunickiaj
Copy link
Copy Markdown
Owner

@kunickiaj kunickiaj commented May 24, 2026

Description

Adds refresh-token support to the SDK OAuth provider adapter.

Key points:

  • Adds an in-memory refresh-token grant store with HMAC-at-rest token hashes.
  • Issues refresh tokens alongside authorization-code access tokens.
  • Implements dual-token rotation for refresh-token grants.
  • Accepts one previous refresh token for retry tolerance, while preventing forked chains by invalidating the then-current token on previous-token retry.
  • Detects older refresh-token replay, revokes the grant, and cascades access-token revocation.
  • Preserves RFC 8707 resource binding across access tokens, refresh grants, refresh rotation, and AuthInfo.resource.
  • Rejects access tokens whose bound audience does not match the configured MCP resource URL.

Type of Change

  • 🚀 Feature (new functionality)
  • 🐛 Bug fix (fixes an issue)
  • 📚 Documentation (docs-only change)
  • 🔧 Maintenance (refactor, chore, CI, etc.)
  • 🧪 Testing (test-only changes)

Testing

  • Relevant checks pass locally (pnpm run tsc, pnpm run lint, pnpm run test)
  • Added/updated tests for changes
  • Manually verified changes work as expected

Validation run:

  • pnpm run lint
  • pnpm run tsc
  • pnpm exec vitest run packages/mcp-server/src/http.test.ts packages/mcp-server/src/oauth.test.ts packages/mcp-server/src/provider.test.ts
  • pnpm run test
  • CodeReviewer re-review: no blockers

Checklist

  • Code follows project style (pnpm run lint passes for touched files)
  • Self-review completed
  • Documentation updated (if needed)
  • No new warnings introduced

Docs are deferred to the final remote MCP OAuth docs/release validation slice.

Copy link
Copy Markdown
Owner Author

kunickiaj commented May 24, 2026

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4e26858418

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/mcp-server/src/oauth.ts Outdated
Comment thread packages/mcp-server/src/oauth.ts
@kunickiaj kunickiaj force-pushed the b20m.3-mcp-express-auth-router branch from 2d7a41f to 4ad56e1 Compare May 24, 2026 00:54
@kunickiaj kunickiaj force-pushed the b20m.4-mcp-refresh-resource-binding branch 2 times, most recently from d7a6bf1 to 95b8a84 Compare May 24, 2026 01:15
Copy link
Copy Markdown
Owner Author

kunickiaj commented May 24, 2026

Merge activity

  • May 24, 1:33 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • May 24, 1:41 AM UTC: Graphite rebased this pull request as part of a merge.
  • May 24, 1:42 AM UTC: @kunickiaj merged this pull request with Graphite.

@kunickiaj kunickiaj changed the base branch from b20m.3-mcp-express-auth-router to graphite-base/1143 May 24, 2026 01:37
@kunickiaj kunickiaj changed the base branch from graphite-base/1143 to main May 24, 2026 01:39
@kunickiaj kunickiaj force-pushed the b20m.4-mcp-refresh-resource-binding branch from 95b8a84 to c7b178a Compare May 24, 2026 01:40
@kunickiaj kunickiaj merged commit 465e7c3 into main May 24, 2026
11 checks passed
@kunickiaj kunickiaj deleted the b20m.4-mcp-refresh-resource-binding branch May 24, 2026 01:42
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.

1 participant