MCP Logto OAuth Policy
Authenticate MCP gateway requests using a gateway-issued OAuth access token, with browser login delegated to Logto.
This is a Logto-friendly wrapper around McpOAuthInboundPolicy. Provide
logtoEndpoint + clientId + clientSecret, and Logto's /oidc issuer, JWKS
URL, and browser login endpoints are derived automatically.
Configuration
The configuration shows how to configure the policy in the 'policies.json' document.
config/policies.json
Policy Configuration
name<string>- The name of your policy instance. This is used as a reference in your routes.policyType<string>- The identifier of the policy. This is used by the Zuplo UI. Value should bemcp-logto-oauth-inbound.handler.export<string>- The name of the exported type. Value should beMcpLogtoOAuthInboundPolicy.handler.module<string>- The module containing the policy. Value should be$import(@zuplo/runtime).handler.options<object>- The options for this policy. See Policy Options below.
Policy Options
The options for this policy are specified below. All properties are optional unless specifically marked as required.
logtoEndpoint(required)<string>- Your Logto tenant endpoint or custom domain, without the /oidc path. The OIDC issuer, JWKS URL, authorization URL, and token URL are derived from this.clientId(required)<string>- The Logto application client_id registered for the gateway's browser login flow.clientSecret(required)<string>- The Logto application client_secret. Use $env(...) to source from a secret environment variable.scope<string>- OIDC scopes requested during browser login. Defaults to"openid profile email".gateway<object>- Gateway-side OAuth token settings. The gateway issuer and advertised URLs are derived from the incoming request origin.accessTokenTtlSeconds<integer>- Lifetime of access tokens issued by /oauth/token. Defaults to900.refreshTokenTtlSeconds<integer>- Lifetime of refresh tokens issued by /oauth/token. Defaults to2592000.cimdEnabled<boolean>- Whether to advertise client_id_metadata_document_supported in AS metadata. Defaults totrue.
browserLoginOverrides<object>- Optional overrides for the derived browser-login settings.remoteTimeoutMs<integer>- No description available. Defaults to10000.stateTtlSeconds<integer>- No description available. Defaults to900.sessionTtlSeconds<integer>- No description available. Defaults to28800.
Using the Policy
MCP Logto OAuth Inbound
Authenticate MCP gateway requests using a gateway-issued OAuth access token, with browser login delegated to Logto.
This is a thin Logto-friendly wrapper around the generic
McpOAuthInboundPolicy. Use it when you want to configure browser login with
logtoEndpoint + clientId + clientSecret instead of the full set of OIDC
URLs.
Derived configuration
Given logtoEndpoint: "https://acme.logto.app", the wrapper derives:
| Generic field | Derived value |
|---|---|
oidc.issuer | https://acme.logto.app/oidc |
oidc.jwksUrl | https://acme.logto.app/oidc/jwks |
browserLogin.url | https://acme.logto.app/oidc/auth |
browserLogin.tokenUrl | https://acme.logto.app/oidc/token |
browserLogin.clientId / clientSecret / scope | from policy options |
These endpoint shapes come from Logto's OIDC provider mounted at /oidc and its
discovery document at
https://<your-logto-endpoint>/oidc/.well-known/openid-configuration.
Configuration
Code
logtoEndpoint must be the HTTPS tenant base URL or custom domain. Do not
include /oidc, /.well-known/openid-configuration, or any trailing path.
Pairing
Pair this policy with McpTokenExchangeInboundPolicy and McpProxyHandler, the
same as McpOAuthInboundPolicy. Only one MCP OAuth policy is allowed per
project; attach the same policy by name to every MCP route.
Read more about how policies work