ZuploZuplo
LoginStart for Free
  • Documentation
  • API Reference

MCP WorkOS OAuth Policy

Authenticate MCP gateway requests using a gateway-issued OAuth access token, with browser login delegated to WorkOS.

This is a WorkOS-friendly wrapper around McpOAuthInboundPolicy. Provide clientId + clientSecret, and the WorkOS 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
{ "name": "my-mcp-workos-oauth-inbound-policy", "policyType": "mcp-workos-oauth-inbound", "handler": { "export": "McpWorkosOAuthInboundPolicy", "module": "$import(@zuplo/runtime)", "options": { "browserLoginOverrides": { "remoteTimeoutMs": 10000, "sessionTtlSeconds": 28800, "stateTtlSeconds": 900 }, "clientId": "$env(WORKOS_CLIENT_ID)", "clientSecret": "$env(WORKOS_CLIENT_SECRET)", "gateway": { "accessTokenTtlSeconds": 900, "cimdEnabled": true, "refreshTokenTtlSeconds": 2592000 }, "scope": "openid profile email" } } }

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 be mcp-workos-oauth-inbound.
  • handler.export <string> - The name of the exported type. Value should be McpWorkosOAuthInboundPolicy.
  • 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.

  • clientId (required) <string> - The WorkOS client_id registered for the gateway's browser login flow. The OIDC issuer and JWKS URL are derived from this client ID.
  • clientSecret (required) <string> - The WorkOS 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 to 900.
    • refreshTokenTtlSeconds <integer> - Lifetime of refresh tokens issued by /oauth/token. Defaults to 2592000.
    • cimdEnabled <boolean> - Whether to advertise client_id_metadata_document_supported in AS metadata. Defaults to true.
  • browserLoginOverrides <object> - Optional overrides for the derived browser-login settings.
    • remoteTimeoutMs <integer> - No description available. Defaults to 10000.
    • stateTtlSeconds <integer> - No description available. Defaults to 900.
    • sessionTtlSeconds <integer> - No description available. Defaults to 28800.

Using the Policy

MCP WorkOS OAuth Inbound

Authenticate MCP gateway requests using a gateway-issued OAuth access token, with browser login delegated to WorkOS.

This is a thin WorkOS-friendly wrapper around the generic McpOAuthInboundPolicy. Use it when you want to configure browser login with just clientId + clientSecret instead of the full set of OIDC URLs.

Derived configuration

Given clientId: "client_01KC6057N3C66XJAXZ65YHAC72", the wrapper derives:

Generic fieldDerived value
oidc.issuerhttps://api.workos.com/user_management/client_01KC6057N3C66XJAXZ65YHAC72
oidc.jwksUrlhttps://api.workos.com/sso/jwks/client_01KC6057N3C66XJAXZ65YHAC72
browserLogin.urlhttps://api.workos.com/user_management/authorize
browserLogin.tokenUrlhttps://api.workos.com/user_management/authenticate
browserLogin.clientId / clientSecret / scopefrom policy options (clientSecret is required)

These endpoint shapes come from WorkOS OIDC discovery at https://api.workos.com/user_management/{clientId}/.well-known/openid-configuration.

Configuration

Code
{ "name": "workos-managed-oauth", "policyType": "mcp-workos-oauth-inbound", "handler": { "module": "$import(@zuplo/runtime/mcp-gateway)", "export": "McpWorkosOAuthInboundPolicy", "options": { "clientId": "$env(WORKOS_CLIENT_ID)", "clientSecret": "$env(WORKOS_CLIENT_SECRET)" } } }

clientId must be the WorkOS client ID, such as client_01KC6057N3C66XJAXZ65YHAC72. The policy rejects issuer URLs, WorkOS API hostnames, and values that do not use the client_ ID shape.

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

Edit this page
Last modified on June 6, 2026
On this page
  • Configuration
    • Policy Configuration
    • Policy Options
  • Using the Policy
JSON
JSON