Table of Contents

Interface ITokenCache

Namespace
ModelContextProtocol.Authentication
Assembly
ModelContextProtocol.Core.dll

Allows the client to cache access tokens beyond the lifetime of the transport.

public interface ITokenCache

Methods

GetTokensAsync(CancellationToken)

Get the cached token. This method is invoked for every request.

ValueTask<TokenContainer?> GetTokensAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

Returns

ValueTask<TokenContainer>

StoreTokensAsync(TokenContainer, CancellationToken)

Cache the token. After a new access token is acquired, this method is invoked to store it.

ValueTask StoreTokensAsync(TokenContainer tokens, CancellationToken cancellationToken)

Parameters

tokens TokenContainer
cancellationToken CancellationToken

Returns

ValueTask