mirror of
https://github.com/mark3labs/kit.git
synced 2026-06-14 03:30:26 +00:00
aecce001ee
- Add MCPAuthHandler interface at SDK level (pkg/kit/) so all consumers (CLI, TUI, SDK embedders) control the OAuth UX through one interface - Default handler opens system browser + local callback server with PKCE - CLIMCPAuthHandler wraps default with status messages (stderr pre-TUI, system messages via TUI event system once running) - Always enable OAuth on remote transports (streamable HTTP, SSE) when handler is configured; harmless for servers that don't need it - Dynamic client registration when no client ID is pre-configured - File-based TokenStore persists tokens to ~/.config/.kit/mcp_tokens.json keyed by server URL so users don't re-auth on restart - Catch OAuthAuthorizationRequiredError at connection init (startup) and tool execution (mid-session token expiry), run auth flow, retry once - Fix error wrapping (%v -> %w) in connection pool so errors.As can unwrap through the chain to find OAuth errors - Thread AuthHandler through MCPToolManager -> AgentConfig -> AgentCreationOptions -> AgentSetupOptions -> kit.Options