Optional ReadonlycallbackExpress handler for the OAuth callback route (GET /callback).
Required for OAuth providers that use server-side callbacks (e.g., GitHub, Google) where the upstream provider redirects back to the MCP server rather than directly to the MCP client.
The handler receives the authorization code from the upstream provider and redirects the user to the MCP client's redirect_uri.
Only effective when a full OAuth provider is configured.
Optional ReadonlyheaderCustom header name for token extraction.
When set, the framework extracts the token from this header instead of
the standard Authorization: Bearer <token> header. Only allowed with
TokenVerifier providers (not with full OAuth providers).
Optional ReadonlyissuerOAuth issuer URL (Authorization Server identifier).
Required for full OAuth providers. Used as the issuer in
OAuth Authorization Server Metadata (RFC 8414).
Must use HTTPS scheme and have no query or fragment components.
Optional ReadonlyonHook called after successful token verification.
Use this to map OAuth clientId/scopes to your own user model.
The returned data is available in tool handlers via context.auth.extra.
Verified auth info from the token
Extra data for context.auth.extra, or undefined
ReadonlyproviderAuthentication provider (full OAuth or token verifier)
Optional ReadonlyrequiredGlobal required scopes for the /mcp endpoint.
All requests to /mcp must have tokens with these scopes.
Per-capability scopes can be set via requiredScopes on tool, resource, and prompt definitions.
Optional ReadonlyresourceProtected Resource Metadata URL (RFC 9728).
Included in WWW-Authenticate headers for 401 responses,
allowing clients to discover the authorization server.
Optional ReadonlyscopeWhen true, capability list handlers (tools/list, resources/list, prompts/list)
filter out entries whose requiredScopes are not satisfied by the requesting user's token.
Default: false (spec-konform — all capabilities are listed regardless of scopes).
Enforcement always happens at execution time (403), independent of this setting.
Enable this for UIs that should only show actionable items to users.
Authentication configuration for the server.
Passed via
ServerOptions.authorMcpServerBuilder.withAuthOptions().Example: External OAuth provider (e.g. GitHub via SDK's ProxyOAuthServerProvider)
Example: Custom header auth (e.g. X-API-Key)
Example: Token verification only (Bearer)