3.1.0
Production servers often need to accept tokens from multiple authentication sources. An interactive application might authenticate through an OAuth proxy, while a backend service sends machine-to-machine JWT tokens directly. MultiAuth composes these sources into a single auth provider so every valid token is accepted regardless of where it was issued.
Understanding MultiAuth
MultiAuth wraps an optional auth server (like OAuthProxy) together with one or more token verifiers (like JWTVerifier). When a request arrives with a bearer token, MultiAuth tries each source in order and accepts the first successful verification.
The auth server, if provided, is tried first. It owns all OAuth routes and metadata — the verifiers contribute only token verification logic. This keeps the MCP discovery surface clean: one set of routes, one set of metadata, multiple verification paths.
Verification Order
MultiAuth checks sources in a deterministic order:
- Server (if provided) — the full auth provider’s
verify_tokenruns first - Verifiers — each
TokenVerifieris tried in list order
AccessToken wins. If every source returns None, the request receives a 401 response.
This ordering means the server acts as the “primary” authentication path, with verifiers as fallbacks for tokens the server doesn’t recognize.
Verifiers Only
You don’t always need a full OAuth server. If your server only needs to accept tokens from multiple issuers, pass verifiers without a server:API Reference
MultiAuth
| Parameter | Type | Description |
|---|---|---|
server | AuthProvider | None | Optional auth provider that owns routes and OAuth metadata. Also tried first for token verification. |
verifiers | list[TokenVerifier] | TokenVerifier | One or more token verifiers tried after the server. |
base_url | str | None | Override the base URL. Defaults to the server’s base_url. |
required_scopes | list[str] | None | Override required scopes. Defaults to the server’s scopes. |

