@@ -10,6 +10,7 @@ import type { OAuthProviderOptions, StaticOAuthClientMetadata } from './types'
1010import { readJsonFile , writeJsonFile , readTextFile , writeTextFile } from './mcp-auth-config'
1111import { StaticOAuthClientInformationFull } from './types'
1212import { getServerUrlHash , log , debugLog , DEBUG , MCP_REMOTE_VERSION } from './utils'
13+ import { randomUUID } from "node:crypto" ;
1314
1415/**
1516 * Implements the OAuthClientProvider interface for Node.js environments.
@@ -24,6 +25,7 @@ export class NodeOAuthClientProvider implements OAuthClientProvider {
2425 private softwareVersion : string
2526 private staticOAuthClientMetadata : StaticOAuthClientMetadata
2627 private staticOAuthClientInfo : StaticOAuthClientInformationFull
28+ private _state : string
2729
2830 /**
2931 * Creates a new NodeOAuthClientProvider
@@ -38,6 +40,7 @@ export class NodeOAuthClientProvider implements OAuthClientProvider {
3840 this . softwareVersion = options . softwareVersion || MCP_REMOTE_VERSION
3941 this . staticOAuthClientMetadata = options . staticOAuthClientMetadata
4042 this . staticOAuthClientInfo = options . staticOAuthClientInfo
43+ this . _state = randomUUID ( )
4144 }
4245
4346 get redirectUrl ( ) : string {
@@ -58,6 +61,10 @@ export class NodeOAuthClientProvider implements OAuthClientProvider {
5861 }
5962 }
6063
64+ state ( ) : string {
65+ return this . _state ;
66+ }
67+
6168 /**
6269 * Gets the client information if it exists
6370 * @returns The client information or undefined
0 commit comments