Add OIDC ID token support#680
Merged
pcarleton merged 1 commit intomodelcontextprotocol:mainfrom Jul 14, 2025
Merged
Conversation
…e returned from the auth server. This change does not enforce this, but simply does not throw away the id token if it is present.
pcarleton
approved these changes
Jul 14, 2025
Member
pcarleton
left a comment
There was a problem hiding this comment.
Thanks! appreciate the very targeted and well tested PR.
chenxi-null
pushed a commit
to chenxi-null/typescript-sdk
that referenced
this pull request
Jul 28, 2025
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.
<!-- Provide a brief summary of your changes -->
Add support for OpenID Connect ID tokens in OAuth responses. When an auth server returns an ID token (typically when the scope includes "openid"), it will now be preserved and passed through to the client.
Motivation and Context
<!-- Why is this change needed? What problem does it solve? -->
This change enables MCP SDK to work with OpenID Connect providers that return ID tokens. Previously, the SDK would discard ID tokens even when they were provided by the auth server. This is needed for full OIDC compliance and to support auth providers that require ID token validation.
How Has This Been Tested?
<!-- Have you tested this in a real application? Which scenarios were tested? -->
Breaking Changes
<!-- Will users need to update their code or configurations? -->
No breaking changes. The ID token field is optional and existing code will continue to work without modification.
Types of changes
<!-- What types of changes does your code introduce? Put an
xin all the boxes that apply: -->Checklist
<!-- Go over all the following points, and put an
xin all the boxes that apply. -->Additional context
<!-- Add any other context, implementation notes, or design decisions -->
This change is minimal and non-invasive - it simply adds an optional
id_tokenfield to theOAuthTokensSchema. The field is marked as optional to maintain backward compatibility. No additional validation or processing of the ID token is performed at this time.