Skip to content

Conversation

@adam-kuhn
Copy link

Microsoft Entra login returns a string for the "expires_in" property. The proposed changes addresses this by coercing the string value to a number.

Motivation and Context

When building an MCP server Entra login the token exchange fails as zod validation because "expires_in" is a string.
An issue we originally created for the inspector as that is where this was first noticed, but after some digging I found the root cause to be in the SDK itself.
Example token response:

{
    "token_type": "Bearer",
    "scope": "email openid profile User.Read",
    "expires_in": "5287",
    "ext_expires_in": "5287",
    "expires_on": "1762781958",
    "not_before": "1762776370",
    "resource": "<resource>",
    "access_token": "<access_token>",
    "refresh_token": "<refresh_token>",
    "id_token": "<id_token>"
}

Original issue:
modelcontextprotocol/inspector#912

How Has This Been Tested?

Add unit tests

Breaking Changes

No

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

@adam-kuhn adam-kuhn requested a review from a team as a code owner November 14, 2025 08:09
@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 14, 2025

Open in StackBlitz

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/sdk@1111

commit: 038aff6

@KKonstantinov
Copy link
Contributor

KKonstantinov commented Nov 16, 2025

Thank you for working on this. Have resolved some incoming conflicts from main for you.

cc @pcarleton

@KKonstantinov KKonstantinov self-assigned this Nov 16, 2025
@KKonstantinov KKonstantinov added the P3 Nice to haves, rare edge cases label Nov 16, 2025
@KKonstantinov
Copy link
Contributor

KKonstantinov commented Nov 16, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Nice to haves, rare edge cases

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support non-standard expires_in responses in OAuthTokensSchema

2 participants