| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Fixes the extraction of resource metadata URL during OAuth connection to prevent 'Invalid api path' errors. Ensures the SDK correctly handles 401 responses to discover token endpoints for OAuth flows using separate authorization servers.
Extract resource metadata URL and scope from WWW-Authenticate header on 401 response.
🦋 Changeset detectedLatest commit: 261fe74 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
Sorry, something went wrong.
|
@modelcontextprotocol/client
npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/client@1472
npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/server@1472
npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/express@1472
npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/hono@1472
npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/node@1472 commit: 261fe74 |
Sorry, something went wrong.
|
Thanks for this, superseded by #1710. Closing. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Summary
Fixes resource metadata URL extraction from WWW-Authenticate headers during initial OAuth connection, enabling the SDK to work with MCP servers that use separate authorization servers (AWS Cognito, Auth0, Okta, etc.).
Closes #1450
Motivation and Context
When connecting to MCP servers using OAuth with separate authorization servers, the SDK was failing during token exchange with an "Invalid api path" error.
Root Cause: The resourceMetadataUrl from the WWW-Authenticate header was not being extracted during the initial connection attempt. This caused finishAuth() to fall back to using the MCP server URL as the authorization server URL, resulting in incorrect token endpoint construction.
Example Flow (Before Fix):
Example Flow (After Fix):
This fix is critical for enterprise deployments where MCP servers use managed identity providers separate from the MCP endpoint.
How Has This Been Tested?
Unit Tests ✅
Integration Tests ✅
Real-World Testing ✅
Verified with AWS Bedrock MCP server + AWS Cognito OAuth:
Test Environment:
Manual Verification
Used curl to verify each step of the OAuth discovery chain:
Breaking Changes
None. This is a bug fix that maintains backward compatibility with existing OAuth flows.
Types of changes
Checklist
Additional context
Files Modified
Source Code:
Documentation:
Implementation Details
The fix adds resource metadata URL and scope extraction when receiving a 401 response during initial connection:
This ensures the metadata is available when finishAuth() is called later in the OAuth flow.
Impact
This fix enables the TypeScript SDK to work with all MCP servers that use:
Affected Use Cases
Design Decisions