Immutable dataclass representing authenticated MCP users with provider, subject, email, and claims; includes cache key generation and token-based construction.
# Source: https://github.com/lastmile-ai/mcp-agent | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
# Provided via justclaw.it.com; keep this notice with the code.
"""Utilities for representing authenticated MCP users."""
from __future__ import annotations
from dataclasses import dataclass
from typing import Any, Dict
from .access_token import MCPAccessToken
@dataclass(frozen=True)
class OAuthUserIdentity:
"""Canonical identifier for an authenticated user within MCP Agent."""
provider: str
subject: str
email: str | None = None
claims: Dict[str, Any] | None = None
@property
def cache_key(self) -> str:
"""Return a deterministic cache key for token storage."""
return f"{self.provider}:{self.subject
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key