This is the documentation for v2 — looking for the v1 documentation?
Skip to content

MCP TypeScript SDK (V2) / @modelcontextprotocol/server-legacy / auth

auth ​

Interfaces ​

AuthInfo ​

Defined in: packages/core-internal/src/types/types.ts:727

Information about a validated access token, provided to request handlers.

Properties ​

clientId ​

clientId: string

Defined in: packages/core-internal/src/types/types.ts:736

The client ID associated with this token.

expiresAt? ​

optional expiresAt?: number

Defined in: packages/core-internal/src/types/types.ts:746

When the token expires (in seconds since epoch).

extra? ​

optional extra?: Record<string, unknown>

Defined in: packages/core-internal/src/types/types.ts:771

Additional data associated with the token. This field should be used for any additional data that needs to be attached to the auth info.

resource? ​

optional resource?: URL

Defined in: packages/core-internal/src/types/types.ts:752

The RFC 8707 resource server identifier for which this token is valid. If set, this MUST match the MCP server's resource identifier (minus hash fragment).

resourceMetadataUrl? ​

optional resourceMetadataUrl?: string

Defined in: packages/core-internal/src/types/types.ts:765

URL of the RFC 9728 Protected Resource Metadata document for the resource server that accepted this token.

The bearer-auth helpers stamp their configured resourceMetadataUrl here when verification succeeds, so challenge responses built after authentication (for example per-operation insufficient_scope scope challenges) can advertise the same document as the authentication gate's own challenges without separate configuration. Verifiers may also populate it directly; a verifier-set value wins.

scopes ​

scopes: string[]

Defined in: packages/core-internal/src/types/types.ts:741

Scopes associated with this token.

token ​

token: string

Defined in: packages/core-internal/src/types/types.ts:731

The access token.

References ​

AccessDeniedError ​

Re-exports AccessDeniedError


allowedMethods ​

Re-exports allowedMethods


authenticateClient ​

Re-exports authenticateClient


AuthMetadataOptions ​

Re-exports AuthMetadataOptions


authorizationHandler ​

Re-exports authorizationHandler


AuthorizationHandlerOptions ​

Re-exports AuthorizationHandlerOptions


AuthorizationParams ​

Re-exports AuthorizationParams


AuthRouterOptions ​

Re-exports AuthRouterOptions


BearerAuthMiddlewareOptions ​

Re-exports BearerAuthMiddlewareOptions


ClientAuthenticationMiddlewareOptions ​

Re-exports ClientAuthenticationMiddlewareOptions


clientRegistrationHandler ​

Re-exports clientRegistrationHandler


ClientRegistrationHandlerOptions ​

Re-exports ClientRegistrationHandlerOptions


createOAuthMetadata ​

Re-exports createOAuthMetadata


CustomOAuthError ​

Re-exports CustomOAuthError


getOAuthProtectedResourceMetadataUrl ​

Re-exports getOAuthProtectedResourceMetadataUrl


InsufficientScopeError ​

Re-exports InsufficientScopeError


InvalidClientError ​

Re-exports InvalidClientError


InvalidClientMetadataError ​

Re-exports InvalidClientMetadataError


InvalidGrantError ​

Re-exports InvalidGrantError


InvalidRequestError ​

Re-exports InvalidRequestError


InvalidScopeError ​

Re-exports InvalidScopeError


InvalidTargetError ​

Re-exports InvalidTargetError


InvalidTokenError ​

Re-exports InvalidTokenError


mcpAuthMetadataRouter ​

Re-exports mcpAuthMetadataRouter


mcpAuthRouter ​

Re-exports mcpAuthRouter


metadataHandler ​

Re-exports metadataHandler


MethodNotAllowedError ​

Re-exports MethodNotAllowedError


OAUTH_ERRORS ​

Re-exports OAUTH_ERRORS


OAuthError ​

Re-exports OAuthError


OAuthRegisteredClientsStore ​

Re-exports OAuthRegisteredClientsStore


OAuthServerProvider ​

Re-exports OAuthServerProvider


OAuthTokenVerifier ​

Re-exports OAuthTokenVerifier


ProxyEndpoints ​

Re-exports ProxyEndpoints


ProxyOAuthServerProvider ​

Re-exports ProxyOAuthServerProvider


ProxyOptions ​

Re-exports ProxyOptions


redirectUriMatches ​

Re-exports redirectUriMatches


requireBearerAuth ​

Re-exports requireBearerAuth


revocationHandler ​

Re-exports revocationHandler


RevocationHandlerOptions ​

Re-exports RevocationHandlerOptions


ServerError ​

Re-exports ServerError


TemporarilyUnavailableError ​

Re-exports TemporarilyUnavailableError


tokenHandler ​

Re-exports tokenHandler


TokenHandlerOptions ​

Re-exports TokenHandlerOptions


TooManyRequestsError ​

Re-exports TooManyRequestsError


UnauthorizedClientError ​

Re-exports UnauthorizedClientError


UnsupportedGrantTypeError ​

Re-exports UnsupportedGrantTypeError


UnsupportedResponseTypeError ​

Re-exports UnsupportedResponseTypeError


UnsupportedTokenTypeError ​

Re-exports UnsupportedTokenTypeError