Server Authentication
Add enterprise-grade OAuth 2.0/2.1 authentication to your MCP server with built-in support for popular identity providers. Secure your tools with bearer token authentication, implement role-based access control (RBAC), and access authenticated user information in your tool callbacks.Quick Start
Basic OAuth Server
OAuth Providers
mcp-use includes built-in support for major identity providers. Each provider is documented in detail:- Auth0 - Full OAuth 2.1 with PKCE and JWKS verification
- WorkOS - Enterprise SSO with direct mode OAuth
- Supabase - Authentication for Supabase projects
- Keycloak - Enterprise SSO with realm roles
- Custom Provider - Use any OAuth provider
OAuth Modes
Choose between proxy mode and direct mode based on your requirements:- Proxy Mode (Default) - Server proxies OAuth requests
- Direct Mode - Clients authenticate directly with provider
OAuth Endpoints
When OAuth is configured, your server automatically exposes these endpoints:Authorization Endpoint
response_type=code- Response typeclient_id- OAuth client IDredirect_uri- Callback URLscope- Requested scopesstate- CSRF protection tokencode_challenge- PKCE challengecode_challenge_method=S256- PKCE method
Token Endpoint
grant_type=authorization_code- Grant typecode- Authorization coderedirect_uri- Callback URLclient_id- OAuth client IDcode_verifier- PKCE verifier
Discovery Endpoints
Bearer Token Authentication
All/mcp/* endpoints require a valid bearer token when OAuth is configured:
Next Steps
- Client Authentication - Connect to OAuth servers from clients
- useMcp Hook - React hook with OAuth support
- User Context - Access user information in tools