ExMCP.Authorization.ErrorHandler (ex_mcp v0.10.0)
View SourceHandles authorization-related errors and triggers appropriate OAuth flows.
This module implements the MCP specification requirements for handling 401 Unauthorized and 403 Forbidden responses, automatically initiating OAuth flows when needed.
Summary
Functions
Handles HTTP authorization errors according to MCP specification.
Processes an OAuth error response according to RFC 6749.
Functions
@spec handle_auth_error(integer(), list(), binary(), map()) :: {:error, atom() | {atom(), any()}} | {:retry, map()}
Handles HTTP authorization errors according to MCP specification.
- 401 Unauthorized: Token is invalid or required
- 403 Forbidden: Insufficient permissions
Returns {:error, reason} or {:retry, auth_params} to trigger OAuth flow.
Processes an OAuth error response according to RFC 6749.