improve mcp CLI + ability to debug MCP oauth (#5980)

This commit is contained in:
Matt Silverlock
2025-12-22 23:27:38 -05:00
committed by GitHub
parent 161e9287a8
commit 1a2b656c4d
4 changed files with 333 additions and 23 deletions

View File

@@ -121,4 +121,15 @@ export namespace McpAuth {
await set(mcpName, entry)
}
}
/**
* Check if stored tokens are expired.
* Returns null if no tokens exist, false if no expiry or not expired, true if expired.
*/
export async function isTokenExpired(mcpName: string): Promise<boolean | null> {
const entry = await get(mcpName)
if (!entry?.tokens) return null
if (!entry.tokens.expiresAt) return false
return entry.tokens.expiresAt < Date.now() / 1000
}
}