Call Signature
FastMCPOptions.auth.
Use it when another service issues the tokens, such as Auth0, Keycloak or
Okta, and this server only verifies them. verifier checks each request, as
with jwtVerifier or introspectionVerifier. remoteAuth adds the
discovery information that lets MCP clients find the authorization server on
their own.
The resource URL is baseUrl joined with the path given to run(). For a
baseUrl of https://mcp.example.com and the default path /mcp, the
resource is https://mcp.example.com/mcp. Set baseUrl to the public URL
that clients use, such as the address of your reverse proxy. A wrong value
makes the advertised resource differ from the URL clients call.
Over HTTP the server then serves the RFC 9728 metadata document at
/.well-known/oauth-protected-resource followed by the MCP path. Each 401
response also carries a WWW-Authenticate: Bearer challenge whose
resource_metadata parameter points to that document.
If you set both this and oauth, oauth takes precedence.
Parameters
options
RemoteAuthOptions<TokenVerifier>
Returns
RemoteAuthProvider<TokenVerifier>
Example
Call Signature
FastMCPOptions.auth.
Use it when another service issues the tokens, such as Auth0, Keycloak or
Okta, and this server only verifies them. verifier checks each request, as
with jwtVerifier or introspectionVerifier. remoteAuth adds the
discovery information that lets MCP clients find the authorization server on
their own.
The resource URL is baseUrl joined with the path given to run(). For a
baseUrl of https://mcp.example.com and the default path /mcp, the
resource is https://mcp.example.com/mcp. Set baseUrl to the public URL
that clients use, such as the address of your reverse proxy. A wrong value
makes the advertised resource differ from the URL clients call.
Over HTTP the server then serves the RFC 9728 metadata document at
/.well-known/oauth-protected-resource followed by the MCP path. Each 401
response also carries a WWW-Authenticate: Bearer challenge whose
resource_metadata parameter points to that document.
If you set both this and oauth, oauth takes precedence.
Parameters
options
RemoteAuthOptions<RequestVerifier>
Returns
RemoteAuthProvider<RequestVerifier>