Fix failure to extract resource metadata url from WWW-authenticate header#924
Merged
olaservo merged 2 commits intomodelcontextprotocol:mainfrom Jan 19, 2026
Merged
Conversation
- in connect()
- Pass authProvider in transport options
olaservo
approved these changes
Jan 19, 2026
Member
There was a problem hiding this comment.
Tested locally using the following:
Modified src/examples/server/simpleStreamableHttp.ts from the typescript SDK to expose the WWW-Authenticate header:
app.use(cors({
exposedHeaders: ['WWW-Authenticate']
}));Built inspector from this branch and tested connecting to the server, here's the server logs:
OAuth Authorization Server listening on port 3001
MCP Streamable HTTP Server listening on port 3000
Request body: {
method: 'initialize',
params: {
protocolVersion: '2025-11-25',
capabilities: { sampling: {}, elicitation: {}, roots: [Object] },
clientInfo: { name: 'inspector-client', version: '0.18.0' }
},
jsonrpc: '2.0',
id: 0
}
Authenticated user: {
token: '[REDACTED]',
clientId: '[REDACTED]',
scopes: [ 'mcp:tools' ],
expiresAt: 1768790456
}
Session initialized with ID: 620463f4-53a8-496c-a1ca-43c2d49d3e16
Request body: { method: 'notifications/initialized', jsonrpc: '2.0' }
Authenticated user: {
token: '[REDACTED]',
clientId: '[REDACTED]',
scopes: [ 'mcp:tools' ],
expiresAt: 1768790456
}
Request body: {
method: 'initialize',
params: {
protocolVersion: '2025-11-25',
capabilities: { sampling: {}, elicitation: {}, roots: [Object] },
clientInfo: { name: 'inspector-client', version: '0.18.0' }
},
jsonrpc: '2.0',
id: 0
}
Authenticated user: {
token: '[REDACTED]',
clientId: '[REDACTED]',
scopes: [ 'mcp:tools' ],
expiresAt: 1768790456
}
Session initialized with ID: d2af994c-4868-47f0-b8d8-decf32e95169
Request body: { method: 'notifications/initialized', jsonrpc: '2.0' }
Authenticated user: {
token: '[REDACTED]',
clientId: '[REDACTED]',
scopes: [ 'mcp:tools' ],
expiresAt: 1768790456
}
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Include the
authProviderparam oftransportOptionsfor sse and streamableHttp transports. This should help the transport code that handles a 401 extract the WWW-Authenticate header information and find the resource_metadata param if present.Type of Change
Changes Made
Related Issues
#576
Testing
Test Results and/or Instructions
Screenshots are encouraged to share your testing results for this change.
Checklist
npm run prettier-fix)Breaking Changes
Additional Context