-
Notifications
You must be signed in to change notification settings - Fork 1.9k
feat(core,client): restore OAuth error subclasses and transient-error classification #2242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
felixweinberger
wants to merge
5
commits into
main
Choose a base branch
from
fweinberger/oauth-error-compat
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+621
−96
Draft
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
a9ab5ea
Restore deprecated OAuth error subclasses and add transient-error helper
felixweinberger 9a729ea
Construct client OAuth errors through oauthErrorFromCode
felixweinberger 3988c55
Document OAuth error compatibility and unknown-code retry semantics
felixweinberger ec7dbf1
Add token-endpoint round-trip tests for OAuth error classes
felixweinberger 3ea50ff
Widen auth() refresh fallback to v1-parity error classification; guar…
felixweinberger File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| --- | ||
| '@modelcontextprotocol/core': minor | ||
| '@modelcontextprotocol/client': patch | ||
| --- | ||
|
|
||
| Restore OAuth error backwards compatibility with SDK 1.x: the per-code error subclasses (`InvalidGrantError`, `ServerError`, …) are exported again as deprecated wrappers around `OAuthError`, and SDK-produced OAuth errors are constructed as the matching subclass so 1.x-style | ||
| `instanceof` classification keeps working. Adds `oauthErrorFromCode()`, `isTransientOAuthError()` (which treats unknown error codes as transient, matching 1.x retry semantics), a deprecated `errorCode` alias for `code`, and the deprecated `OAUTH_ERRORS` map. The OAuth | ||
| `InvalidRequestError` returns as `OAuthInvalidRequestError` (the original name is taken by a JSON-RPC protocol type). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔴 The OAuth-section rewrite in docs/migration-SKILL.md accidentally deleted unrelated migration content: the
## 6. McpServer API Changesheading, the variadic.tool()/.prompt()/.resource()removal note, the "IMPORTANT: v2 requires Standard Schema objects (wrap withz.object())" paragraph, and the "Unchanged APIs" paragraph. The file's numbering now jumps from section 5 to section 7, the### Tools/### Prompts/### Resourcessubsections are orphaned, and step 4 of section 15 still references the now-missing "section 6" — please restore the deleted heading and paragraphs alongside the new OAuth content.Extended reasoning...
What happened: The diff hunk in
docs/migration-SKILL.md(lines ~178–230) replaces the old OAuth-error table with the new compatibility-focused prose. But the deleted span extends past the OAuth section boundary: it also removes (1) the**Unchanged APIs** (only import paths changed)…paragraph that closed the error-class section, (2) the## 6. McpServer API Changesheading, (3) the sentence "The variadic.tool(),.prompt(),.resource()methods are removed. Use theregister*methods with a config object.", and (4) the**IMPORTANT**: v2 requires schema objects implementing Standard Schema…paragraph (raw shapes no longer supported, wrap withz.object(),fromJsonSchemaguidance). None of this content is re-added anywhere in the new text — the added lines are exclusively about OAuth errors.\n\nHow it manifests in the post-PR file: The top-level numbering jumps from## 5. Removed / Renamed Type Aliases and Symbols(line 82) directly to## 7. Headers API(line 294) — there is no section 6 anywhere in the file. The### Tools,### Prompts,### Resources,### Schema Migration Quick Reference, and### Removed core exportssubsections that previously belonged under "McpServer API Changes" now sit orphaned directly after the OAuth-error subsection, structurally nested under section 5. Grepping the post-PR file forMcpServer API Changes,variadic, orUnchanged APIsreturns nothing, confirming the content was deleted rather than moved.\n\nStep-by-step proof:\n1. Pre-PR, the file's structure was:### OAuth error consolidation(table + rewrite example) →**Unchanged APIs**paragraph →## 6. McpServer API Changes→ variadic-removal sentence → IMPORTANT/Standard-Schema paragraph →### Tools→ … →## 7. Headers API.\n2. The diff hunk@@ -178,52 +178,34 @@removes everything from the old OAuth table through the IMPORTANT paragraph and inserts only the new OAuth compatibility prose, ending right before### Tools.\n3. Post-PR, line 527 (## 15. Migration Steps, step 4) still reads "Replace.tool()/.prompt()/.resource()calls withregisterTool/registerPrompt/registerResourceper section 6" — a dangling reference to a section that no longer exists.\n4. The PR description scopes the change to OAuth error compatibility; nothing in it claims to restructure the McpServer API section, so this is collateral damage from the rewrite, not an intentional doc change.\n\nWhy it matters: This file is the LLM-targeted migration skill (migrate-v1-to-v2). The deleted variadic-method-removal statement and the Standard-Schema/z.object()requirement are core migration directives that an LLM consuming the skill relies on; some of that guidance partially survives in step 5 of section 15 and in the Schema Migration Quick Reference table, but the section heading, the variadic-removal statement, and the Unchanged-APIs paragraph are simply gone, and the broken numbering/orphaned subsections degrade the skill's structure.\n\nHow to fix: Re-insert, between the new OAuth code example and the### Toolssubsection, the previously existing content: the**Unchanged APIs**paragraph, the## 6. McpServer API Changesheading, the variadic-removal sentence, and the IMPORTANT Standard-Schema paragraph. That restores the section numbering (5 → 6 → 7), re-parents the### Tools/### Prompts/### Resourcessubsections, and makes the "per section 6" reference in section 15 valid again.