@@ -10,6 +10,7 @@ import type { OAuthProviderOptions, StaticOAuthClientMetadata } from './types'
10
10
import { readJsonFile , writeJsonFile , readTextFile , writeTextFile } from './mcp-auth-config'
11
11
import { StaticOAuthClientInformationFull } from './types'
12
12
import { getServerUrlHash , log , debugLog , DEBUG , MCP_REMOTE_VERSION } from './utils'
13
+ import { randomUUID } from 'node:crypto'
13
14
14
15
/**
15
16
* Implements the OAuthClientProvider interface for Node.js environments.
@@ -24,6 +25,7 @@ export class NodeOAuthClientProvider implements OAuthClientProvider {
24
25
private softwareVersion : string
25
26
private staticOAuthClientMetadata : StaticOAuthClientMetadata
26
27
private staticOAuthClientInfo : StaticOAuthClientInformationFull
28
+ private _state : string
27
29
28
30
/**
29
31
* Creates a new NodeOAuthClientProvider
@@ -38,6 +40,7 @@ export class NodeOAuthClientProvider implements OAuthClientProvider {
38
40
this . softwareVersion = options . softwareVersion || MCP_REMOTE_VERSION
39
41
this . staticOAuthClientMetadata = options . staticOAuthClientMetadata
40
42
this . staticOAuthClientInfo = options . staticOAuthClientInfo
43
+ this . _state = randomUUID ( )
41
44
}
42
45
43
46
get redirectUrl ( ) : string {
@@ -58,6 +61,10 @@ export class NodeOAuthClientProvider implements OAuthClientProvider {
58
61
}
59
62
}
60
63
64
+ state ( ) : string {
65
+ return this . _state
66
+ }
67
+
61
68
/**
62
69
* Gets the client information if it exists
63
70
* @returns The client information or undefined
0 commit comments