Documentation
¶
Index ¶
- func NewKeyringTokenStore() mcp.OAuthTokenStore
- func Register()
- type KeyringTokenStore
- func (s *KeyringTokenStore) GetToken(resourceURL string) (*mcp.OAuthToken, error)
- func (s *KeyringTokenStore) ListOAuthTokens() []mcp.OAuthTokenEntry
- func (s *KeyringTokenStore) RemoveToken(resourceURL string) error
- func (s *KeyringTokenStore) StoreToken(resourceURL string, token *mcp.OAuthToken) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewKeyringTokenStore ¶
func NewKeyringTokenStore() mcp.OAuthTokenStore
NewKeyringTokenStore returns the process-wide token store backed by the OS keyring, falling back to InMemoryTokenStore when no backend is available. It always returns the same instance.
func Register ¶
func Register()
Register installs the keyring-backed token store as the default for MCP OAuth. The CLI calls this during startup; embedders that don't need persistent keyring-backed storage can simply not call it and keep the in-memory default.
Register is idempotent: root.Execute can run several times in one process (e2e tests do this), and once a remote MCP toolset has materialized the store, re-installing the same factory would otherwise trip the misordering panic in SetDefaultTokenStoreFactory.
Types ¶
type KeyringTokenStore ¶
type KeyringTokenStore struct {
// contains filtered or unexported fields
}
KeyringTokenStore keeps OAuth tokens in memory, sealing them to disk with a key held in the OS keyring. The keyring is touched at most once per process (to fetch or create the key), so the user's "Always Allow" decision keeps applying to refreshes and to newly authorized servers.
func (*KeyringTokenStore) GetToken ¶
func (s *KeyringTokenStore) GetToken(resourceURL string) (*mcp.OAuthToken, error)
func (*KeyringTokenStore) ListOAuthTokens ¶
func (s *KeyringTokenStore) ListOAuthTokens() []mcp.OAuthTokenEntry
ListOAuthTokens returns a snapshot of all stored tokens.
func (*KeyringTokenStore) RemoveToken ¶
func (s *KeyringTokenStore) RemoveToken(resourceURL string) error
func (*KeyringTokenStore) StoreToken ¶
func (s *KeyringTokenStore) StoreToken(resourceURL string, token *mcp.OAuthToken) error