OptionalvalidateResource: (resource?: URL) => booleanBegins the authorization flow, which can either be implemented by this server itself or via redirection to a separate authorization server.
This server must eventually issue a redirect with an authorization response or an error response to the given redirect URI. Per OAuth 2.1:
code and state (if present) query parameters.error query parameter, and MAY include an optional error_description query parameter.Returns the codeChallenge that was used when the indicated authorization began.
Exchanges an authorization code for an access token.
Optional_codeVerifier: stringExchanges a refresh token for an access token.
Optional_scopes: string[]Optional_resource: URLVerifies an access token and returns information about it.
🚨 DEMO ONLY - NOT FOR PRODUCTION
This example demonstrates MCP OAuth flow but lacks some of the features required for production use, for example: