Skip to content

chore: Clean up MCP server tokens when URL is updated - #313

Merged
sr07asthana merged 8 commits into
mainfrom
sr-cleanup-token
Aug 18, 2026
Merged

sr07asthana merged 8 commits into
mainfrom
sr-cleanup-token

Conversation

@sr07asthana

@sr07asthana sr07asthana commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closes #

Changes

How was this tested?

Checklist

  • pnpm build, pnpm test, pnpm typecheck, pnpm lint:ci, and pnpm format:check pass locally
  • Tests added/updated where it makes sense
  • No hand-edits to generated code (packages/trueforge-sdk, .github/fern/openapi/openapi.json, docs/openapi.json)
  • Docs / .env.example updated if configuration or behavior changed

Note

Medium Risk
Changes OAuth token lifecycle on MCP URL updates (auth-critical path); behavior is transactional and covered by updated tests, but users must re-authorize after URL edits.

Overview
When a DCR MCP server’s URL is updated via settings PUT, the handler now treats the URL as the OAuth resource/audience and wipes all stored tokens and in-flight pending authorizations for that server (every user), in the same transaction as re-DCR and upsert.

IOAuthTokenStore gains deleteTokensForServer and deletePendingAuthorizationsForServer, implemented for Postgres, SQLite, and in-memory stores, with contract tests. PUT responses and API tests now expect auth_required after a URL change instead of carrying stale authenticated status from old tokens.

Reviewed by Cursor Bugbot for commit e7568fe. Bugbot is set up for automated code reviews on this repo. Configure here.

@changeset-bot

changeset-bot Bot commented Aug 18, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e7568fe

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

This PR includes changesets to release 1 package
Name Type
@truefoundry/trueforge 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

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 915022d. Configure here.

@sr07asthana
sr07asthana enabled auto-merge (squash) August 18, 2026 06:34
@sr07asthana
sr07asthana merged commit 9485811 into main Aug 18, 2026
8 checks passed
@sr07asthana
sr07asthana deleted the sr-cleanup-token branch August 18, 2026 06:37
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.

2 participants