MCPcopy Index your code
hub / github.com/modelcontextprotocol/typescript-sdk / OAuthClientProvider

Interface OAuthClientProvider

src/client/auth.ts:50–217  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48 * code verifiers should not cross different sessions.
49 */
50export interface OAuthClientProvider {
51 /**
52 * The URL to redirect the user agent to after authorization.
53 * Return undefined for non-interactive flows that don't require user interaction
54 * (e.g., client_credentials, jwt-bearer).
55 */
56 get redirectUrl(): string | URL | undefined;
57
58 /**
59 * External URL the server should use to fetch client metadata document
60 */
61 clientMetadataUrl?: string;
62
63 /**
64 * Metadata about this OAuth client.
65 */
66 get clientMetadata(): OAuthClientMetadata;
67
68 /**
69 * Returns a OAuth2 state parameter.
70 */
71 state?(): string | Promise<string>;
72
73 /**
74 * Loads information about this OAuth client, as registered already with the
75 * server, or returns `undefined` if the client is not registered with the
76 * server.
77 */
78 clientInformation(): OAuthClientInformationMixed | undefined | Promise<OAuthClientInformationMixed | undefined>;
79
80 /**
81 * If implemented, this permits the OAuth client to dynamically register with
82 * the server. Client information saved this way should later be read via
83 * `clientInformation()`.
84 *
85 * This method is not required to be implemented if client information is
86 * statically known (e.g., pre-registered).
87 */
88 saveClientInformation?(clientInformation: OAuthClientInformationMixed): void | Promise<void>;
89
90 /**
91 * Loads any existing OAuth tokens for the current session, or returns
92 * `undefined` if there are no saved tokens.
93 */
94 tokens(): OAuthTokens | undefined | Promise<OAuthTokens | undefined>;
95
96 /**
97 * Stores new OAuth tokens for the current session, after a successful
98 * authorization.
99 */
100 saveTokens(tokens: OAuthTokens): void | Promise<void>;
101
102 /**
103 * Invoked to redirect the user agent to the given URL to begin the authorization flow.
104 */
105 redirectToAuthorization(authorizationUrl: URL): void | Promise<void>;
106
107 /**

Callers 19

authInternalFunction · 0.80
authInternalFunction · 0.65
fetchTokenFunction · 0.65
authInternalFunction · 0.65
makeRequestFunction · 0.65
_commonHeadersMethod · 0.65
makeRequestFunction · 0.65
authInternalFunction · 0.65
_commonHeadersMethod · 0.65
authInternalFunction · 0.65
authInternalFunction · 0.65

Implementers 5

ConformanceOAuthProvidertest/conformance/src/helpers/conforman
ClientCredentialsProvidersrc/client/auth-extensions.ts
PrivateKeyJwtProvidersrc/client/auth-extensions.ts
StaticPrivateKeyJwtProvidersrc/client/auth-extensions.ts
InMemoryOAuthClientProvidersrc/examples/client/simpleOAuthClientP

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…