Configuration Options
JWKS Configuration
Theoauth.jwks array configures one or more JWKS providers for JWT verification.
Remote JWKS URL
For the full JWKS configuration reference including all options (
refresh_unknown_kid, allowed_use, etc.), see Router Authentication.
Symmetric Secret
For development or testing, you can use a shared symmetric secret instead of a remote JWKS endpoint:Multiple Authorization Servers
The router can trust more than one OAuth 2.0 authorization server. Useauthorization_server_urls to list all trusted servers. Configure a JWKS entry for each issuer so the router can validate its tokens.
authorization_servers field of the RFC 9728 metadata endpoint. MCP clients pick one of the advertised servers for authorization.
The option authorization_server_url is deprecated. Use authorization_server_urls for new configurations. Existing configurations with authorization_server_url continue to work. When both options are set, the router merges them into one list, with the single URL first, and removes duplicates.
Environment Variables
HTTP Error Responses
401 Unauthorized
Returned when the token is missing, invalid, expired, or signature verification fails.scope parameter contains the initialize scopes (minimum scopes needed to connect). The resource_metadata URL points to the RFC 9728 metadata endpoint for OAuth discovery.
403 Forbidden
Returned when the token is valid but lacks required scopes. The exactscope parameter depends on which level of enforcement rejected the request:
Method-level rejection (e.g., missing tools_call scopes):
read:fact):
scope parameter always contains only the scopes needed for the specific operation that failed (unless scope_challenge_include_token_scopes is enabled).
Per the MCP specification, HTTP-level authentication failures return only HTTP status codes and headers - no JSON-RPC
response body is included.
RFC 9728 Protected Resource Metadata
When OAuth is enabled and at least one authorization server is configured (authorization_server_url or authorization_server_urls), the MCP server exposes a public (unauthenticated) metadata endpoint at:
scopes_supported field is automatically computed as the union of:
- All configured static scopes (
initialize,tools_list,tools_call) - All scopes extracted from
@requiresScopesdirectives on fields used by registered operations
Startup Validation
The router performs startup validation when OAuth is enabled:- If
oauth.jwksis empty, the router exits with a fatal error to prevent starting an unprotected endpoint - If
server.base_urlis empty, the router exits with a fatal error because it is required for RFC 9728 metadata discovery