oauth, tool, resource, and prompt callbacks receive verified authentication data on ctx.auth. The provider determines the static type of ctx.auth.user; there is no generic UserInfo shape.
Auth shape
Every provider exposes this top-level shape:useris the provider’s normalized user type.payloadcontains the verified token claims or introspection data.accessTokenis the verified bearer token. Forward it only when calling an upstream API on behalf of the user.scopesare copied from the auth information returned by the token verifier.permissionsare produced by the provider’s mapping.clientIdis present when the token has a client identifier.expiresAtis a Unix timestamp in seconds.resourceis the protected resource validated by the verifier.
Use provider-specific fields
All built-in users haveid. Optional profile and organization fields vary:
payload only when you deliberately need a provider claim that is not mapped.
Check scopes and permissions
Scopes describe OAuth grants. Permissions describe provider-mapped application authorization.client:role, and Supabase maps AAL to aal:<level>.
Map custom claims
For another authorization server,oauthCustomProvider separates verification from application mapping:
createTokenVerifier receives the canonical MCP resource. mapAuthInfo runs only after SDK auth information has been verified and must return { user, payload, permissions }. It does not rewrite ctx.auth.scopes; those come from the verifier’s verified auth info.
Next steps
Authentication
Choose and configure an OAuth provider.
Custom Provider
Implement resource-bound token verification and claim mapping.
Middleware
Apply shared authorization checks.