There was an error while loading. Please reload this page.
1 parent 7018afc commit f5b4d89Copy full SHA for f5b4d89
1 file changed
src/mcp/shared/auth.py
@@ -29,6 +29,12 @@ class OAuthToken(BaseModel):
29
access_token: str
30
token_type: Literal["Bearer"] = "Bearer"
31
expires_in: int | None = None
32
+ # Absolute unix timestamp when the access token expires. The spec's
33
+ # `expires_in` is relative, so a persisted token alone can't tell a fresh
34
+ # process whether it's already stale — that caused mcp2cli issues #50/#57
35
+ # (a stale Bearer sent, then a wasted 401 round-trip before re-auth).
36
+ # Persisting the absolute expiry and restoring it on _initialize fixes the
37
+ # whole class. Backwards compatible: None means "unknown, re-auth once".
38
expires_at: float | None = None
39
scope: str | None = None
40
refresh_token: str | None = None
0 commit comments