Documentation Index
Fetch the complete documentation index at: https://mcp-use.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
Server Authentication
Add enterprise-grade OAuth 2.0/2.1 authentication to your MCP server. Secure your tools with bearer token authentication, implement role-based access control (RBAC), and access authenticated user information in your tool callbacks.Quick Start
- Remote Auth (WorkOS)
- OAuth Proxy (Google)
Use a built-in provider when your identity provider supports remote authentication. Clients register and authenticate directly with the upstream provider — your server only verifies the resulting bearer token.
Providers
Remote Auth (built-in)
Clients register and authenticate directly with the provider.- Auth0 — Full OAuth 2.1 with PKCE and JWKS verification
- Better Auth — Self-hosted OAuth 2.1 via the Better Auth OAuth Provider plugin
- WorkOS — Enterprise SSO via WorkOS AuthKit
- Supabase — Authentication for Supabase projects
- Keycloak — Enterprise SSO with realm roles
- Custom Provider — Any DCR-capable provider with a custom
verifyTokenfunction
OAuth Proxy
For providers that don’t support remote client registration — Google, GitHub, Okta, Azure AD, or any provider where you register an application in a dashboard and receive a fixedclientId/clientSecret — use oauthProxy:
- OAuth Proxy — Bridge non-DCR providers with pre-registered client credentials, including ready-to-copy configs for Google, Okta, Azure AD, Auth0, and GitHub.
How it works
Remote auth flow
- Your server exposes
.well-known/*endpoints that pass through the upstream provider’s OAuth metadata — including itsregistration_endpoint. - MCP clients fetch that metadata, register themselves directly with the upstream provider, then run the full authorization + token exchange against it.
- On each
/mcp/*request, your server verifies the bearer token (JWKS signature check, issuer, audience).
OAuth proxy flow
- Your server exposes a
/registerendpoint that returns your pre-configuredclientId. - MCP clients run PKCE authorization against the upstream using that
clientId. - At token exchange, your server injects the
clientIdandclientSecretbefore forwarding to the upstream. - On each
/mcp/*request, your server verifies the bearer token via theverifyTokenfunction you provided.
OAuth Endpoints
When OAuth is configured, your server exposes these 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